Repository navigation
Use public permissions for extracted ZIP logs - #65463
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused change matches the requested behavior, includes regression coverage, and has no identified blocking issues.
Review effort: Balanced
Findings: None
What changed in this PR
Updates gh-aw ZIP log extraction to avoid preserving restrictive archive permissions, addressing #65456.
Changes:
- Creates extracted files using
constants.FilePermPublic. - Updates regression coverage to check world-read permission for an entry stored with mode
0600.
| File | Description |
|---|---|
pkg/cli/logs_extract_zip_test.go |
Checks public readability after extraction. |
pkg/cli/logs_download_zip.go |
Uses public file-creation permissions. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Warning Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs for details.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship.
|
|
✅ PR Code Quality Reviewer completed the code quality review. testing cli availability only
|
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /diagnosing-bugs — small, well-targeted fix with good regression coverage. No blocking issues found.
📋 Analysis
Root cause & fix
The bug (restrictive ZIP entry modes, e.g. 0600, making extracted logs unreadable by later tooling) is fixed at its source: os.OpenFile now always uses constants.FilePermPublic (0o644) instead of propagating f.Mode() from the ZIP entry. This is consistent with the existing constants.DirPermPublic usage a few lines above for directories, so the module stays internally consistent.
Test quality (/tdd)
- The test was correctly renamed from
TestExtractZipFilePreservesMode→TestExtractZipFileUsesPublicPermissionsto reflect the new contract instead of leaving a stale, misleading name. - The fixture now encodes an owner-only
0600mode (previously0755/executable), which is the actual regression scenario described in the PR body, and the assertion (info.Mode().Perm()&0o004 != 0) directly verifies world-readability — a precise regression test for the reported bug.
Checked for side effects
Confirmed no downstream code in pkg/cli executes extracted log/artifact files (only parses/reads them), so dropping the execute bit for all entries is safe and doesn't regress any workflow that might have relied on executable extracted files.
Minor, non-blocking observation
f.Mode() is now unused for regular files in extractZipFile; worth double-checking there isn't a separate unused-import/lint warning once this merges (a quick make fmt/lint pass should catch it if so).
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 27.3 AIC · ⌖ 14.3 AIC · ⊞ 10K
Comment /matt to run again
There was a problem hiding this comment.
Reviewed with Impeccable skill lens (change_type: bug_fix — but this is backend Go file-permission logic, not UI, so harden/audit modes do not surface relevant findings).
The fix correctly replaces the ZIP entry's stored mode with constants.FilePermPublic (0o644), consistent with the existing DirPermPublic usage in the same file. The regression test was properly updated to assert world-read permission on an extracted 0600-mode entry rather than mode preservation.
No blocking or high-signal issues found in the changed lines.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 15 AIC · ⌖ 13.9 AIC · ⊞ 8.1K
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Request changes
This patch fixes the ZIP-mode bug by opening every extracted workflow log as public, but that creates a new confidentiality regression and the regression test locks that weaker behavior in.
Blocking themes
- pkg/cli/logs_download_zip.go: workflow-run logs are downloaded remote content and log output, so opening them with FilePermPublic violates the repo permission policy and can expose sensitive run data on shared machines.
- pkg/cli/logs_extract_zip_test.go: the new assertion requires world-readable output, which both cements the security regression and makes the test environment-dependent because 0644 is still filtered by umask.
The safer fix is to ignore the archive entry mode while still writing extracted logs with constants.FilePermSensitive, then update the test to assert that sensitive, non-executable behavior instead of public readability.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 34.4 AIC · ⌖ 7.34 AIC · ⊞ 19.4K
Comment /review to run again
|
|
||
| // Create the destination file | ||
| destFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) | ||
| destFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, constants.FilePermPublic) |
There was a problem hiding this comment.
This widens downloaded workflow logs from owner-only to world-readable, which contradicts the repository permission policy for remote content and log output and can leak sensitive run data on shared machines.
💡 Why this should be fixed
extractZipFile is only used for workflow-run log archives, and constants.FilePermSensitive is explicitly documented for downloaded remote content and audit/log output. Switching to FilePermPublic makes every extracted log file readable to other local users/groups even though the caller created the workflow-log area as sensitive.
Use a fixed sensitive mode instead of the ZIP entry mode:
destFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, constants.FilePermSensitive)That still fixes the original bug (ignore restrictive ZIP metadata) without downgrading log confidentiality.
There was a problem hiding this comment.
Addressed in 1d5db5f: extracted log files now use constants.FilePermSensitive, and the regression verifies owner-only permissions.
|
|
||
| // Create the destination file | ||
| destFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) | ||
| destFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, constants.FilePermPublic) |
There was a problem hiding this comment.
This widens downloaded workflow logs from owner-only to world-readable, which contradicts the repository permission policy for remote content and log output and can leak sensitive run data on shared machines.
💡 Why this should be fixed
This extractor is only used for workflow-run log archives, and the constants package documents FilePermSensitive for downloaded remote content and audit/log output. Switching to FilePermPublic makes each extracted log file readable to other local users/groups even though the workflow-log area is created as sensitive.
Use a fixed sensitive mode here instead of the ZIP entry mode so the original bug is still fixed without downgrading log confidentiality.
There was a problem hiding this comment.
Addressed in 1d5db5f: extracted log files now use constants.FilePermSensitive, and the regression verifies owner-only permissions.
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: a522e8c
|
…ix-zip-log-extraction 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>
Merged the latest |
|
🎉 This pull request is included in a new release. Release: |
GitHub Actions ZIP entries can carry restrictive file modes, leaving downloaded logs unreadable to later tooling. Extraction should not preserve those source permissions.
constants.FilePermPublicrather than the ZIP entry’s stored mode.