Repository navigation
fix(audit): report audit-rules load errors and block installs whose audit cannot run - #882
Merged
Merged
Conversation
The global scan entry points (ScanSkill, ScanSkillWithFollow, ScanSkillFiltered, ScanFile) dropped the error from Rules() and scanned with no pattern rules. One bad regex in the global audit-rules.yaml turned every pattern check off with no warning, so audits reported fewer findings than they should have (#879). Project mode already returned the error. Return the error from the global path as well, and name the failing file in it: parse errors from loadUserRules and compile errors from Rules() and RulesWithProject now carry the path. When a project scan fails to compile, the global file is blamed only if it fails on its own, so a project file that disables a broken global rule still loads. The cached markdown split now takes the rules its caller already loaded instead of loading them again and dropping the error.
Once global scans return rule-load errors, install treated the error as a warning and installed the skill with no audit at all. update already fails closed on a scan error, and --force there accepts findings, not an install nobody could check. A scan error now blocks skill, agent and tracked-repo installs and removes what was installed. --force does not override it; --skip-audit still bypasses scanning. The error wraps the new install.ErrAuditScanFailed rather than audit.ErrBlocked, so install output and the dashboard do not offer a --force retry that cannot help. upgrade reinstalls the built-in skill with --force, which deleted the old copy before the audit ran. A typo in audit-rules.yaml would have left users without the skill, so upgrade now stages the download through the update path and keeps the installed copy when the audit fails. update --all counted the new error as a silent skip. It is now listed under "Blocked by security audit" with its reason and makes the run exit non-zero. The install warning summary that counted "audit scan error" warnings is removed, since nothing emits them any more. Fixes #879
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 13, 2026
5 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
proposals/only — see CONTRIBUTING.md)approvedlabel)Linked Issue
Closes #879
What changed
Audit (commit 1). Global scans (
ScanSkill,ScanSkillWithFollow,ScanSkillFiltered,ScanFile) now return the error when audit rules fail to load, as project scans already did. Before, a single bad regex in the globalaudit-rules.yamlturned off every pattern check without warning. Errors now name the file, for read, parse and compile failures alike:auditreports a scan error for each skill and exits2. A project file that setsenabled: falseon a broken global rule still loads. When it does not, the error points at the global file.Install (commit 2). Once the error is returned, install used to log it as a warning and install the skill with no audit at all. Install now matches the update gate:
--forcedoes not override this.--skip-auditstill skips the scan.install.ErrAuditScanFailed, notaudit.ErrBlocked, so neither the CLI nor the dashboard offers a--forceretry.upgrade --skillreinstalls with--force, which deleted the old skill before the audit ran. It now goes through the staged update path, so the installed skill is kept when the audit fails.update --allused to count the error as a silent skip. It now lists it under "Blocked by security audit" with the reason and exits non-zero.--force, they now say it overrides blocks from findings, not a failed scan.Checks run
All in a devcontainer-image container:
make check(docs-check, fmt-check, lint, test, test-herdr): passedgo test ./tests/integration: passedTestGlobalScans_ReturnRulesLoadErrorTestRulesWithProject_InvalidProjectRuleNamesFileTestRulesWithProject_BadGlobalRuleTestAudit_ScanErrorBlocksAndCleansUpTestInstall_ForceUpdateScanErrorKeepsExistingSkillTestCompactBlockedUpdateMessage_ShowsScanFailureTestRulesWithProject_BadGlobalRulefailed against the version that loaded global rules first.TestInstall_ForceUpdateScanErrorKeepsExistingSkillfailed withoutUpdate.audit-rules.yaml. Each command was run against the real binary:auditandaudit --jsoninstall,install --force,install --json,install --track --forceandinstall --skip-auditupgrade --skill --force(skill kept),update --allandupdate <name>Not run: website build, dashboard click-through. The dashboard handles the new message through the existing error branch, because
isAuditBlockandisForceRetryabledo not match it.Not covered (follow-ups)
audit --jsonand the dashboard Audit page report only the count of scan errors, not their reason.audit ruleslists rules without compiling them, so a bad regex looks fine in that list.hub build --auditdrops risk scores for entries whose scan failed, and does not say so.skillshare audit >/dev/nullexits2even on a clean audit. This is reproducible onmain.Checklist
make check) — for code changes