Skip to content

audit: global scans ignore pattern-rule load errors #879

Closed

Description

@salmonumbrella

Found by source inspection at f1faa4b; no repro was executed.

Current behavior

Rules() returns an error when the built-in rules or the global user audit-rules.yaml cannot be read, parsed, or compiled. An invalid regex in a user rule is one example (patterns.go#L186-L210, patterns.go#L373-L382).

The project-mode scanners propagate that error (audit_scan_skill.go#L52-L56). The global path does not. scanSkillImpl ignores the error and leaves the rule set nil (audit_scan_skill.go#L111-L117). The cached markdown split returns empty lists on the same error (markdown_links.go#L19-L28). The single-file scan does the same (audit_scan_skill.go#L615-L620).

ScanSkill and ScanSkillFiltered use this path, and global skillshare audit and global install audits call them (audit.go#L538-L546). A mistake in the global audit-rules.yaml can therefore turn every pattern-rule check off with no warning. Scans then report fewer findings, and install may let through content it would otherwise block.

Request

Have the global scan path return the rules-load error, as the project path already does, so the user sees which file failed and why.

Suggested regression test

Point the global audit-rules path at a temporary file containing an invalid regex. Assert that ScanSkill returns an error that names the file, and does not return a clean result.

Activity

  1. self-assigned this
    on Nov 13, 2026
  2. added
    bug
    on Nov 13, 2026
  3. runkids commented on Nov 13, 2026

    @runkids
    Owner

    Thanks for tracing this through the source so carefully, it made the fix easy to scope. #882 makes the global scan path return the rules-load error just like project mode, and the message now names the failing audit-rules.yaml file. Install also stops instead of continuing unscanned when the audit cannot run, and points you to fix the file or use --skip-audit. It will ship in the next release. If anything still looks off after you upgrade, please reopen or let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions