Skip to content

agents-md-lint.sh extracts cross-reference links one at a time by rebuilding the line (quadratic on link-dense lines) #1408

Closed

Description

@don-petry

The cross-reference checker repeatedly matches and reconstructs the remaining Markdown line to extract one link at a time. A downstream repository can supply a compact line with many links that causes quadratic processing in the shared audit.

Location: scripts/agents-md-lint.sh:284
Severity: low · Rule: CWE-407 · Reachability: external
Subsystem: Organization administration and standards deployment

Evidence

  • Source/control: AGENTS.md content on an audited downstream repository's default branch, fetched through the GitHub contents API.
  • Sink/decision: The repeated regex match, captured-string copies, and line reconstruction in amdl_check_cross_references.
  • Missing mitigation: The parser has no single-pass extraction or work bound for a line. The audit also lacks a separate timeout that would let it abandon one repository and continue.
Reachability call stack
  1. scripts/compliance-audit.sh:3660 — main invokes check_agents_md during serial repository processing.
  2. scripts/compliance-audit.sh:2537 — check_agents_md fetches repository-authored AGENTS.md.
  3. scripts/compliance-audit.sh:2567 — check_agents_md invokes record_agents_md_structural_findings.
  4. scripts/compliance-audit.sh:2521 — structural linting invokes amdl_lint.
  5. scripts/agents-md-lint.sh:373 — amdl_lint dispatches applicable default rules.
  6. scripts/agents-md-lint.sh:344 — the dispatcher invokes amdl_check_cross_references.
  7. scripts/agents-md-lint.sh:284 — the checker repeatedly scans and copies the remaining line.

Filed from a CodeRabbit security scan (scan 2d23b5ee-606a-403f-b407-81ddebdb0115, revision 1ea9ee1fbecc). Finding IDs: 091cbdd3-0e8a-475b-baa0-d7d4c2fc6ee5. CodeRabbit notes that findings relying on its stated assumptions are capped at medium severity; dismiss if an assumption does not hold.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressAn agent is actively working this issuesecuritySecurity-related PRs and issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions