T09 · Insecure Skill Coding Practices
- Location
scripts/audit_scan.sh:62- Finding
Potential secrets are disclosed verbatim in audit output
- Content
View full analysis
Vulnerability Details
File Location:
scripts/audit_scan.sh, lines 62-63
Vulnerability Type: Sensitive information exposure through diagnostic output
Risk Level: MediumVulnerable Code
bash echo "--- Potential hardcoded secrets/keys ---" grep -rniE --include="*.dart" '(api[_-]?key|secret|token|password)\s*=\s*['"'"'"][A-Za-z0-9_\-]{12,}['"'"'"]' lib/ 2>/dev/null || echo "(none found)"Technical Analysis
The scan searches Dart files for assignments resembling API keys, secrets, tokens, or passwords. Because
grepprints the entire matching source line, any detected credential value is emitted verbatim to standard output.The Skill describes this output as a plain-text audit report. Consequently, a secret already present in source code can be duplicated into terminal scrollback, CI logs, captured Agent context, build artifacts, or stored reports. This increases its exposure beyond users and systems that have direct repository access.
The issue does not independently grant system privileges or execute attacker-controlled code. Exploitation requires a matching sensitive value to exist in a Dart file and the audit script to be run.
Attack Path
- A Dart file under
lib/contains a credential assignment matching the regular expression, such as:dart const apiKey = 'ExampleSecretValue123'; - A developer, CI job, or AI Agent runs:
bash bash scripts/audit_scan.sh /path/to/flutter/project grepmatches the assignment and prints the complete source line.- The credential is retained in one or more secondary locations, such as CI logs, terminal history, Agent transcripts, or an audit report.
- Anyone with access to those secondary locations may recover and misuse the exposed credential according to its existing permissions.
Impact Assessment
The maximum obtainable access is determined by the privileges of the disclosed credential. Depending on that credential, an unauthorized party co ...[truncated 325 chars]
- A Dart file under
- Remediation
View remediation
Remediation Suggestions
Do not include matching source content in scan output. Report only the file path and line number, or redact the credential value before displaying the result.
A safer file-and-line-only implementation is:
bash grep -rnlE --include="*.dart" \ '(api[_-]?key|secret|token|password)\s*=\s*['"'"'"][A-Za-z0-9_\-]{12,}['"'"'"]' \ lib/ 2>/dev/null || echo "(none found)"For line-level reporting without source disclosure, process matching files separately and output only normalized metadata. Additional hardening should include:
- Treat audit output as potentially sensitive and restrict its retention and access.
- Mask credential-like values before writing CI logs or reports.
- Avoid uploading raw scan output as a public or broadly accessible artifact.
- If a real credential is detected, revoke or rotate it immediately and inspect version-control history and prior logs for exposure.
- Move sensitive server-side credentials out of client applications rather than relying solely on obfuscation or build-time injection.
