-
Notifications
You must be signed in to change notification settings - Fork 322
Lock-file integrity check must cover compiled YAML content, not only .md frontmatter #24156
Description
Summary
The runtime integrity check (check_workflow_timestamp_api.cjs) validates only a hash of the .md frontmatter, stored as a YAML comment in the lock file (# gh-aw-metadata: {"frontmatter_hash":"..."}). It does not validate the compiled YAML body. An actor with repository write access can modify security-critical YAML fields in .github/workflows/*.lock.yml—permissions:, --allow-domains, GITHUB_READ_ONLY, GH_AW_INFO_ALLOWED_DOMAINS, --allowed-tools—while leaving the metadata comment line untouched. The integrity check logs ✅ Lock file is up to date (hashes match) and the agent runs with the tampered configuration. The [gh-aw architecture docs]((githubnext.github.io/redacted) describe a "Validate Lock File" step, creating false assurance that the lock file as a whole is protected.
Affected Area
Activation-stage runtime integrity control — actions/setup/js/check_workflow_timestamp_api.cjs and actions/setup/js/frontmatter_hash_pure.cjs
Reproduction Outline
- Clone a repository using gh-aw workflows. Do not modify any
.mdsource file. - Edit
.github/workflows/<workflow>.lock.yml: changepermissions:(e.g., addcontents: write,pull-requests: write) or widenGH_AW_INFO_ALLOWED_DOMAINS/--allow-domains/--allowed-tools, or clearGITHUB_READ_ONLY. - Leave the
# gh-aw-metadata: {...}comment line completely unchanged. - Commit and push (direct push or merge via PR without lock-file review).
- Trigger the workflow. Observe the activation job "Check workflow file timestamps" step: it logs
✅ Lock file is up to date (hashes match). - The agent job executes with the tampered permissions, network policy, or tool list.
Observed Behavior
check_workflow_timestamp_api.cjs recomputes the hash only from the .md frontmatter text (canonical["frontmatter-text"] = normalizeFrontmatterText(frontmatterText) in frontmatter_hash_pure.cjs). The compiled YAML body is never included. A tampered lock file that escalates permissions and widens network access passes the check silently.
Expected Behavior
The integrity check should detect any modification to the compiled YAML content of the lock file. The hash (or a separate compiled_hash) should cover the non-comment YAML body—or activation should recompile the .md source in a read-only sandbox and diff against the checked-in lock file, failing if they diverge.
Security Relevance
This undermines the compilation security model: compilation is the documented gate that derives safe runtime parameters from markdown. The integrity check provides false tamper-detection assurance. Exploitation requires repo write access (direct push or a merged PR without careful lock-file diff review), but it specifically bypasses a documented control, enabling privilege escalation, network policy widening, and tool allowlist manipulation with no runtime detection.
gh-aw version: v0.65.5
Original finding: https://github.com/githubnext/gh-aw-security/issues/1674
Generated by File Issue · ◷