Repository navigation
feat(analysis): add github_workflow component and CI-001..005 predicates (rule schema 30, provisional) - #264
ivanpaghubasan wants to merge 6 commits into
Conversation
…mponent Walk the repo-root .github/workflows, add the github_workflow component and CIWorkflowFacts, and wire DiscoverCIWorkflows into the scan.
Five repo_ci_agent_* predicates, the ci category, the github_actions applies_to token and one finding per agent job.
|
@ivanpaghubasan heads-up on the rule schema number before this merges. main is now at schema 25 in both the analyzer and the rules pack: AGCFG-008 (Codex hooks) took 24 and AGCFG-009 (AGENTS.md hidden text) took 25. This PR still sets 24 (it was 23), and the companion rules PR #189 sets 24 too. Merged as is, the engine constant would go backwards while the pack says 25, and an older engine would skip the CI rules without telling anyone. Before merging:
|
Hi @sairenchristianbuerano , thanks for the heads-up. I'll update the schema version accordingly. |
Summary
Adds support for scanning GitHub Actions workflows (
.github/workflows/*.ymlat the repo root) and the predicates behind the new CI-001..005 rules (AGS-07: coding agents running on events any GitHub user can cause). The rules themselves ship in the rules repo PR with the same branch name: #189.What changed
github_workflowcomponent kind andCIWorkflowFactsin the repo inventory. Workflow files are kept out ofYAMLFiles, so existing consumers are unchanged.internal/analysis/ci_workflows.go: parses workflows with the yaml.v3 Node API (anchors and merge keys resolved with a depth and node budget; unparseable files are listed inci_workflows.unparsedand skipped), recognises agent steps, and computes the facts for the five predicates.repo_ci_agent_*), a newcicategory and thegithub_actionsapplies_to token. One finding per agent step that runs an offending agent (CI-003: per actions/checkout step in an offending agent job).Behaviour decisions
anthropics/claude-code-action,anthropics/claude-code-base-action,google-github-actions/run-gemini-cli,openai/codex-action, and theclaude,gemini,codex,clineandaiderCLIs. The report's.*cline.*,.*aider.*and.*copilot.*patterns were dropped: no official action was found for them, and the patterns match unrelated names.*(or an expression). This follows the actions' own documentation.permissions:block anywhere is not flagged, because the default is not visible to the scan.workflow_runis left out (follow-up).actions/cachesub-condition for CI-002 was dropped. GitHub's dependency-caching documentation says events outside a short write list, includingpull_request_target,issue_commentandworkflow_run, get read-only access to the default branch's cache scope. Adnan Khan's Clinejection post describes cache poisoning from an issue-triggered job. The two are not reconciled. The documentation also describes an opt-out (cache-mode: write), which may be the better signal to detect in a follow-up.Known limits
Expressions are never evaluated and the boolean structure of
if:is not modelled (soA || allow-listcounts as gated). Remote reusable workflows, composite actions and matrix expansion are not followed. Each rule's explanation in the rules PR states its own limits.Disagreements with the report
on: issueswith claude-code-action and no bypass input) does not fire, because the action gates on write access by default. The fixtures useallowed_non_write_users: "*"instead.allowed_toolsinput (it usesclaude_args --allowedTools). Codex--yolois unverified and left out;approval_policy=neveris not a shell grant forcodex exec.Verification
go test ./...passes.trustabl rules validate: 348 rules valid under rule schema version 30, on both the fixture and the rules branch.check-rules-sync.shreports no drift.allowed_non_write_users: "*").Evidence notes
Fixtures are synthetic; the public GitInject workflows could not be obtained. GitInject's "every provider vulnerable" claim is unverified. CVE-2026-54316 exists but is a Claude Code WebFetch pre-approved-domain issue, not CI-specific.
Merge order
Engine (this PR), then rules #189, then the rationale docs in the rulebook repo. The rules PR should not be merged until the docs PR is ready, otherwise the rulebook gate goes red.