Summary
Add a Dagger AI agent to the linting module that uses dag.LLM() to intelligently analyze and fix secret findings by adding pragma: allowlist secret comments.
Motivation
Secret scanning tools (detect-secrets via pre-commit) flag lines containing keywords like password, secret, token as potential secrets. The codebase already uses // pragma: allowlist secret comments extensively (20+ files) to suppress false positives. Automating this with an AI agent saves manual effort and ensures consistency.
Proposed Changes
New functions in the linting module
ScanSecrets — Runs detect-secrets scan and returns a structured JSON report
AutoFixSecrets — AI agent using dag.LLM() that reads the findings and adds appropriate pragma comments per file type
Implementation Details
- Upgrade linting module engine to
v0.19.7 (required for dag.LLM())
- Create
secrets.go with both functions
- Uses
dag.Env() with container input/output for the AI agent
- Comment style adapted per file type:
// for Go, # for YAML/Python/Shell/Terraform
- Skips
.json files (no comment syntax) and lines already containing the pragma
CLI Usage
# Scan for secrets
dagger call -m linting scan-secrets --src . export --path=/tmp/findings.json
# AI-powered auto-fix
dagger call -m linting auto-fix-secrets --src . export --path=/tmp/fixed/
Acceptance Criteria
Summary
Add a Dagger AI agent to the linting module that uses
dag.LLM()to intelligently analyze and fix secret findings by addingpragma: allowlist secretcomments.Motivation
Secret scanning tools (detect-secrets via pre-commit) flag lines containing keywords like
password,secret,tokenas potential secrets. The codebase already uses// pragma: allowlist secretcomments extensively (20+ files) to suppress false positives. Automating this with an AI agent saves manual effort and ensures consistency.Proposed Changes
New functions in the linting module
ScanSecrets— Runsdetect-secrets scanand returns a structured JSON reportAutoFixSecrets— AI agent usingdag.LLM()that reads the findings and adds appropriate pragma comments per file typeImplementation Details
v0.19.7(required fordag.LLM())secrets.gowith both functionsdag.Env()with container input/output for the AI agent//for Go,#for YAML/Python/Shell/Terraform.jsonfiles (no comment syntax) and lines already containing the pragmaCLI Usage
Acceptance Criteria
ScanSecretsreturns valid JSON findings from detect-secretsAutoFixSecretscorrectly adds pragma comments to flagged lines