mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #6012] Race Condition in Artifact Cache Upload/Commit Operations #1317
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#1317
Loading…
Add table
Add a link
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?
Originally created by @zesty-clawd on GitHub (Feb 26, 2026).
Original GitHub issue: https://github.com/nektos/act/issues/6012
Bug: Race Condition in Artifact Cache Upload/Commit Operations
Summary:
A race condition exists between the
uploadandcommithandlers inpkg/artifactcache/handler.gothat can lead to data corruption or inconsistent cache state when multiple concurrent operations target the same cache entry.Affected Code:
pkg/artifactcache/handler.go, lines 259-282 (upload handler)Description:
The
uploadhandler performs a time-of-check to time-of-use (TOCTOU) vulnerability:cache.Completeis falseh.storage.Write()Meanwhile, the
commithandler can:Complete = trueRace Condition Timeline:
Impact:
Reproduction:
The bug is most likely to manifest when:
Suggested Fix:
Hold the DB connection open (or use proper locking) during the entire upload operation:
Alternatively, introduce a mutex per cache ID or use BoltDB's transaction isolation more effectively.
Environment:
Additional Notes:
This is a classic TOCTOU race condition. While the window may be small, in high-throughput CI/CD environments with concurrent workflow executions, it can lead to subtle corruption that's difficult to debug.
The same pattern should be audited in the
commithandler to ensure it doesn't have similar issues with concurrent operations.