Repository navigation
Make guarded safe-output assets readable by the uploader - #75761
Conversation
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
❌ Test Quality Sentinel failed to deliver outputs during test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully!
|
|
✅ PR Code Quality Reviewer completed the code quality review. Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Review the workflow run logs for details.
|
There was a problem hiding this comment.
Reviewed head 9d48a810c632383cb34d0303c74eaa803cb4f41d against Safe Outputs Specification v1.29.20, §7.3 “Asset Staging Ownership and Transport.”
Blocking finding: the PR changes guarded staged/published asset permissions to 0644/0755, contradicting the existing MUST-level 0600/0700 private-mode contract and its conformance evidence requirements. The ownership/readability problem is intentional, but the implementation must preserve the security contract or obtain an approved specification change with supporting evidence. Existing symlink, descriptor, exclusive-create, and post-write mode protections otherwise remain in scope; no tests were run per the static-review instructions.
Generated by PR Specification Reviewer for #75761 · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review-specs to run again
| const targetPath = path.join(assetsDir, stagedFileName); | ||
| try { | ||
| writeGuardedFile(targetPath, fileContent); | ||
| writeGuardedFile(targetPath, fileContent, { mode: 0o644, directoryMode: 0o755 }); |
There was a problem hiding this comment.
This changes the guarded staging contract from private permissions to world-readable files/directories. Safe Outputs Specification §7.3, “Asset Staging Ownership and Transport,” requires guarded staging to create files with mode 0600 and private subdirectories with 0700, while preserving access through the ownership contract; it also requires Linux conformance coverage for those modes. Please keep the backend/host ownership fix and preserve 0600/0700 rather than broadening permissions to 0644/0755, or provide an approved security-contract update and evidence that the broader access is safe.
There was a problem hiding this comment.
Restored staged files and guard-created directories to 0600/0700; the backend runner-UID/GID ownership handoff remains in place. Updated in 900bf5051c.
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output.
Review the workflow run logs for details.
Found two blocking permission-path issues:
- Newly created
directoryModeis applied to all ancestors, potentially exposing unrelated safe-output state. - Existing restrictive ancestors are not widened, so uploader access can still fail on reused/pre-created paths.
The file-mode change itself is otherwise covered by focused tests. Review was static; tests were not run per review instructions.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
| directories.push({ fd, filename: current, stat }); | ||
| const opened = fs.fstatSync(fd); | ||
| if (opened.dev !== stat.dev || opened.ino !== stat.ino) throw assetValidationError("Asset directory changed while opening"); | ||
| if (created) fs.fchmodSync(fd, directoryMode); |
There was a problem hiding this comment.
directoryMode is applied to every newly created component while walking the full path, not just the asset-specific directory. For a fresh RUNNER_TEMP this can make shared parents such as gh-aw/safeoutputs mode 0755, exposing unrelated staging/configuration files to the unprivileged uploader. Please keep shared parents private and widen only the dedicated asset subtree.
There was a problem hiding this comment.
Staging now uses the private 0600/0700 pair, so shared RUNNER_TEMP/gh-aw/safeoutputs ancestors created by the guard remain 0700. Updated in 900bf5051c.
| directories.push({ fd, filename: current, stat }); | ||
| const opened = fs.fstatSync(fd); | ||
| if (opened.dev !== stat.dev || opened.ino !== stat.ino) throw assetValidationError("Asset directory changed while opening"); | ||
| if (created) fs.fchmodSync(fd, directoryMode); |
There was a problem hiding this comment.
Conversely, an ancestor that already exists with the old default 0700 mode is never chmodded because created stays false. If RUNNER_TEMP is reused or another safe-output path created safeoutputs first, the 0644 file remains unreachable to the uploader and the original EACCES failure persists. Please ensure the dedicated asset path is traversable without relaxing unrelated existing directories.
There was a problem hiding this comment.
The ownership handoff now ensures the backend and uploader use the same runner UID/GID; existing private directories need no permission broadening. The Linux runner-identity test exercises writing and host-side reading without requiring root. Updated in 900bf5051c.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs (root cause and regression coverage) and /codebase-design (scope of the new mode parameters). Requesting changes because the spec and the code now disagree.
📋 Key themes
Verified
- Restrictive umasks (
0000,0077,0022) produce0644files and0755directories as intended. - Overwrites still fail with
EEXIST, and default calls keep the private0600/0700modes. - Caveat: I could not run vitest. The npm registry failed with a TLS error here, so the Node checks above were run directly.
Blocking
- The normative spec (
safe-outputs-specification.mdaround line 4992,compiler-threat-detection-spec.md§7.9) still requires0600/0700, and the conformance test atstart_mcp_gateway.test.cjs:649-650still asserts them. Update the spec and test, or keep the private modes.
Should address
directoryModeapplies to every directory the guard creates, including ancestors.- Mode arguments are not restricted to the two intended pairs.
- The root-owned reader test is skipped for non-root runs.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 5.4K
Comment /matt to run again
| const targetPath = path.join(assetsDir, stagedFileName); | ||
| try { | ||
| writeGuardedFile(targetPath, fileContent); | ||
| writeGuardedFile(targetPath, fileContent, { mode: 0o644, directoryMode: 0o755 }); |
There was a problem hiding this comment.
[/grill-with-docs] This widens staged asset modes from 0600/0700 to 0644/0755, but the normative spec still requires the private modes. docs/src/content/docs/specs/safe-outputs-specification.md (guarded staging, around line 4992, and the conformance paragraph around line 4996) and specs/compiler-threat-detection-spec.md §7.9 (around lines 754 and 760) say files MUST stay 0600, guard-created subdirectories 0700, and modes MUST NOT be broadened. Update those sections and their conformance mapping in this PR, or keep the private modes and fix readability another way.
@copilot please address this.
There was a problem hiding this comment.
Kept the specification unchanged and restored the required 0600/0700 staging modes. The conformance mapping already covers runner-identity ownership and private staging; updated implementation and tests are in 900bf5051c.
| if (!create || !error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") throw error; | ||
| try { | ||
| fs.mkdirSync(current, { mode: 0o700 }); | ||
| fs.mkdirSync(current, { mode: directoryMode }); |
There was a problem hiding this comment.
[/codebase-design] directoryMode applies to every ancestor this call creates, not just the asset and Claim directories. On a first run, parents such as gh-aw/ or safeoutputs/ above assets would be created 0755, which is broader than the private 0700 the spec requires for guard-created subdirectories. Apply the wider mode only to the leaf directories the caller needs, or document why the ancestors must be traversable.
@copilot please address this.
There was a problem hiding this comment.
The staging caller now uses 0600/0700, keeping all newly created staging ancestors private. The separate publisher still uses its constrained publication pair outside the shared staging tree. Updated in 900bf5051c.
| fs.closeSync(fd); | ||
| } | ||
| }); | ||
| function writeGuardedFile(filename, content, { mode = 0o600, directoryMode = 0o700 } = {}) { |
There was a problem hiding this comment.
[/codebase-design] mode and directoryMode accept any number, so a future caller could publish 0666 or 0777 through the guard. Restrict them to the two allowed pairs (0o600/0o700 and 0o644/0o755) and add a test that rejects other values.
@copilot please address this.
There was a problem hiding this comment.
Added validation for only the 0600/0700 and 0644/0755 pairs, with tests rejecting other and mismatched values before creating directories. Updated in 900bf5051c.
| expect(fs.statSync(tmpDir).mode & 0o777).toBe(0o700); | ||
| }); | ||
|
|
||
| it.skipIf(process.platform !== "linux" || process.getuid?.() !== 0)("lets an unprivileged uploader read root-owned staged assets", () => { |
There was a problem hiding this comment.
[/tdd] This is the only test that reproduces the reported EACCES case, an unprivileged reader of root-owned staged assets. It is skipped unless the runner is root, so a non-root CI run has no cross-user coverage for this fix. Confirm a CI job runs it as root, or add a fixture that does not depend on the runner's uid.
@copilot please address this.
There was a problem hiding this comment.
Removed the root-only cross-user-read test. The Linux runner-identity regression in start_mcp_gateway.test.cjs runs without a root requirement: it writes private assets as the selected backend UID/GID, then reads them from the host uploader process. Updated staging-mode tests are in 900bf5051c.
There was a problem hiding this comment.
🟡 Changes recommended
Overly permissive staging modes can expose unpublished assets to unrelated local users on shared runners, violating the required 0600/0700 staging contract.
1 open issue
What changed in this PR
This PR aims to prevent artifact-upload EACCES failures in gh-aw by making guarded staged and published assets readable by the host uploader.
Changes:
- Requests
0644files and0755newly created directories for asset staging and publication. - Adds configurable modes while retaining private defaults, exclusive creation, and no-follow protections.
- Adds regression coverage for ownership, restrictive umasks, and unprivileged reads of root-owned assets.
Live workflow verification remains pending.
| File | Description |
|---|---|
actions/setup/js/upload_assets.test.cjs |
Checks published-file permissions and ownership. |
actions/setup/js/upload_assets.cjs |
Requests uploader-readable publication modes. |
actions/setup/js/symlink_guard.test.cjs |
Covers restrictive umasks and unprivileged asset reads. |
actions/setup/js/symlink_guard.cjs |
Supports configurable modes applied through file descriptors. |
actions/setup/js/safe_outputs_handlers.test.cjs |
Checks staged-file permissions, ownership, and directory modes. |
actions/setup/js/safe_outputs_handlers.cjs |
Requests uploader-readable staging modes. |
Review effort: Max (auto)
| const targetPath = path.join(assetsDir, stagedFileName); | ||
| try { | ||
| writeGuardedFile(targetPath, fileContent); | ||
| writeGuardedFile(targetPath, fileContent, { mode: 0o644, directoryMode: 0o755 }); |
There was a problem hiding this comment.
Restored the private staging modes and retained the runner UID/GID ownership handoff so the host uploader can access the staged bytes without widening permissions. Updated in 900bf5051c.
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 9d48a81
|
Work summary: I’m updating this branch with Sous-chef requested-head: 9d48a81 |
…ssets-readable Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Owner-only staged assets can fail artifact upload with
EACCES, leavingupload_assetswithout an artifact to publish.0644files and0755newly created directories; existing directory permissions remain unchanged.