chore: Make the security-scan log path safe for uncontainerised jobs #33
Labels
No labels
priority/P0
priority/P1
priority/P2
priority/P3
size/L
size/M
size/S
size/XL
size/XS
state/done
state/in-progress
state/in-review
state/needs-refinement
state/ready
type/bug
type/chore
type/feature
type/refactor
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
amtronics/platform-actions#33
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
security-scanwrites to a fixed/tmp/security-scan.logand truncates it when the action starts, on the premise that a runner may reuse/tmpbetween jobs. Raised in the review of #32 as a question rather than a finding: if the runner shares a filesystem across concurrently-running jobs, twosecurityjobs would interleave into one file and each would see a mixed tail.Not reachable today, and here is the evidence rather than the assumption:
The only consumer runs the action inside a per-job container, so
/tmpis that container's. The exposure begins the moment a consumer adds asecurityjob without acontainer:.The consequence is a mixed or truncated tail on a failure — diagnostic quality, not a wrong exit code. That is why it was not a blocker for #32.
Why it was not simply fixed there
RUNNER_TEMPandrunner.tempare referenced nowhere in this repository or the consuming ones, so their behaviour on this runner is untested. Ifrunner.tempexpands to empty,outputs.log-pathbecomes/security-scan.logwhile the shell writes somewhere else — a silently wrong path, which is a worse failure than the one it prevents. Swapping a known-good constant for an unverified expression, on an approved change, to fix something no consumer can currently hit, is the wrong order to do things in.Scope
/tmpper job; if it does not, make the log path unique per job and keepoutputs.log-pathagreeing with it.Acceptance criteria
/tmpisolated per job, or shared.${{ runner.temp }}is used in a workflow on this runner, when the job runs, then it is confirmed to expand to a non-empty per-job path before anything depends on it.outputs.log-path, then it names the same file the action wrote — verified by a consuming job, not by inspection.securityjobs run concurrently without containers, when both fail, then each posts only its own output.Notes
The second criterion is the one that matters. The reason this is an issue rather than a commit is precisely that the obvious fix depends on an untested assumption, and substituting one unverified premise for another is not progress.