-
Notifications
You must be signed in to change notification settings - Fork 322
docs: clarify frontmatter hash is stale-lock detection, not tamper protection #24198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,12 @@ | |
| /// <reference types="@actions/github-script" /> | ||
|
|
||
| /** | ||
| * Check workflow lock file integrity using frontmatter hash validation. | ||
| * Check for a stale workflow lock file using frontmatter hash comparison. | ||
| * This script verifies that the stored frontmatter hash in the lock file | ||
| * matches the recomputed hash from the source .md file, regardless of | ||
| * commit timestamps. | ||
| * matches the recomputed hash from the source .md file, detecting cases where | ||
| * the workflow was edited without recompiling the lock file. It does not | ||
| * provide tamper protection — use code review to guard against intentional | ||
| * modifications. | ||
| * | ||
| * Supports both same-repo and cross-repo reusable workflow scenarios: | ||
| * - Primary: GitHub API (uses GITHUB_WORKFLOW_REF to identify source repo) | ||
|
|
@@ -33,7 +35,7 @@ async function main() { | |
| const workflowMdPath = `.github/workflows/${workflowBasename}.md`; | ||
| const lockFilePath = `.github/workflows/${workflowFile}`; | ||
|
|
||
| core.info(`Checking workflow lock file integrity using frontmatter hash:`); | ||
| core.info(`Checking for stale lock file using frontmatter hash:`); | ||
| core.info(` Source: ${workflowMdPath}`); | ||
| core.info(` Lock file: ${lockFilePath}`); | ||
|
|
||
|
|
@@ -193,11 +195,11 @@ async function main() { | |
| if (!hashComparison) { | ||
| // Could not compute hash - be conservative and fail | ||
| core.warning("Could not compare frontmatter hashes - assuming lock file is outdated"); | ||
| const warningMessage = `Lock file '${lockFilePath}' integrity check failed! Could not verify frontmatter hash for '${workflowMdPath}'. Run 'gh aw compile' to regenerate the lock file.`; | ||
| const warningMessage = `Lock file '${lockFilePath}' is outdated or unverifiable! Could not verify frontmatter hash for '${workflowMdPath}'. Run 'gh aw compile' to regenerate the lock file.`; | ||
|
|
||
|
Comment on lines
195
to
199
|
||
| let summary = core.summary | ||
| .addRaw("### ⚠️ Workflow Lock File Warning\n\n") | ||
| .addRaw("**WARNING**: Lock file integrity check failed. Could not verify frontmatter hash.\n\n") | ||
| .addRaw("**WARNING**: Could not verify whether lock file is up to date. Frontmatter hash check failed.\n\n") | ||
| .addRaw("**Files:**\n") | ||
| .addRaw(`- Source: \`${workflowMdPath}\`\n`) | ||
| .addRaw(`- Lock: \`${lockFilePath}\`\n\n`) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,9 +10,9 @@ This document specifies the algorithm for computing a deterministic hash of agen | |||||
| ## Purpose | ||||||
|
|
||||||
| The frontmatter hash provides: | ||||||
| 1. **Change detection**: Verify that workflow configuration has not changed between compilation and execution | ||||||
| 1. **Stale lock detection**: Identify when the compiled lock file is out of sync with the source workflow (e.g. after editing the `.md` file without recompiling) | ||||||
|
||||||
| 1. **Stale lock detection**: Identify when the compiled lock file is out of sync with the source workflow (e.g. after editing the `.md` file without recompiling) | |
| 1. **Stale lock detection**: Identify when the compiled lock file is out of sync with the source workflow (e.g. after editing the workflow frontmatter or imported frontmatter without recompiling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring says it detects cases where “the workflow was edited without recompiling the lock file,” but the comparison is based on the frontmatter hash (not the full markdown workflow content). To avoid implying broader coverage than implemented, consider rephrasing to “frontmatter (and imported frontmatter) was edited without recompiling.”