fix(ci,device): drop workflow_dispatch ref input + narrow bare except in CPU info parser - #3217
Conversation
… in CPU info parser Two legitimate findings from a shoulder.dev security scan (the rest of that report triaged as false positives). - .github/workflows/marketing-screenshots.yaml — drop the workflow_dispatch `inputs.ref`. The GH UI's "Use workflow from" picker already sets github.ref for operator-triggered runs, so the explicit input only added capability to API callers: a stolen GITHUB_TOKEN with actions:write could dispatch this workflow against an attacker-supplied SHA / fork ref and execute it on a runner. Checkout now defaults to github.ref with no `ref:` override. - src/anthias_common/device_helper.py — replace `except Exception: pass` in parse_cpu_info with an explicit split-length guard + continue. Also fixes a latent bug: under the old fall-through, a colon-less line whose token matched a captured key (Serial/Hardware/Revision/Model) recorded the previous line's stale `value`. Adds a regression test. - .gitignore — shoulder.dev's local cache directory. Supersedes and takes over the stale worktree-branch PR (opened 2026-05; all three findings still present on master). Reimplemented against current master (the checkout action has since advanced to v7.0.1). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJ3ucEkn62cbgPoisAZ5LQ
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3217 +/- ##
=========================================
Coverage ? 89.46%
=========================================
Files ? 76
Lines ? 8340
Branches ? 891
=========================================
Hits ? 7461
Misses ? 665
Partials ? 214 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Validated on real hardware — full fleetRan the branch's
Covers armv6l / armv7l / aarch64 / x86_64. On every board the new parser is byte-identical to the old, with correct values (core counts, models, serials, revisions). Scope, stated honestly: real hardware never emits the malformed/colon-less line the fix targets, so Addresses the "end-to-end test for Raspberry Pi devices" and "tested for x86 devices" checklist items. |



Takes over #2914, which was opened from a stale worktree branch in 2026-05. All three findings are still present on
master, so I reimplemented them against currentmaster(theactions/checkoutpin has since advanced to v7.0.1) and added a regression test.Two legitimate findings from a shoulder.dev security scan; the rest of that report triaged as false positives (upload path-traversal sinks are protected by
uuid.*().hex+_SAFE_EXT_RE; the@authorizeddecorator covers the routes flagged as "missing authz";mark_safeinasset_filters.to_jsonis preceded by JSON-encode +&<>'hex-escape; the open-redirect sink usesreverse()+url_has_allowed_host_and_scheme).Changes
.github/workflows/marketing-screenshots.yaml— drop theworkflow_dispatchinputs.ref. The GH UI's "Use workflow from" picker already setsgithub.reffor operator-triggered runs, so the explicit input only added capability to API callers: a stolenGITHUB_TOKENwithactions:writecould otherwise dispatch this workflow against an attacker-supplied SHA / fork ref and execute it on a runner. Checkout now defaults togithub.refwith noref:override.src/anthias_common/device_helper.py— replaceexcept Exception: passinparse_cpu_infowith an explicit split-length guard +continue. Also fixes a latent bug: under the old fall-through, a colon-less line whose token matched a captured key (Serial/Hardware/Revision/Model) recorded the previous line's stalevalue.tests/test_device_helper.py— regression test (processor/Serial/colon-lessModel); it recordsmodel='abc123'on the old code and is correctly skipped on the fix..gitignore— shoulder.dev's local cache directory.Verification
tests/test_device_helper.py: 12 passed against the fix.abc123) and passes after.ruff==0.15.21clean; workflow YAML parses.🤖 Generated with Claude Code
https://claude.ai/code/session_01HJ3ucEkn62cbgPoisAZ5LQ