Security Audit & Secret Scanning
Detect hardcoded credentials, evaluate dependency vulnerabilities, and enforce least-privilege security modes.
The Problem
Accidental credential commits (`.env` files, API keys, private tokens) cause severe security breaches. Coding agents often paste sample credentials into code without realizing.
Who It Is For
DevSecOps engineers, security auditors, and developers preparing repositories for open-source or production release.
Prerequisites & Tools
- Git repository with commit history
- dev-workflow CLI installed
| Tool / Command | Type | Role in Tutorial |
|---|---|---|
| audit | mcp | Scan workspace and diffs for secrets and unsafe patterns (category: security) |
| devwf doctor | cli | Verify strict security mode in local profile |
Example Task Contract
Exact start_task payload representing this workflow in DevWorkflow local-first governance.
{
"description": "Perform comprehensive security audit and credential leak scan before public npm publication",
"type": "other",
"plan": [
"Scan working tree for hardcoded API keys and bearer tokens",
"Verify .gitignore excludes .env, local credentials, and SQLite databases",
"Verify strict security mode active in runtime configuration"
],
"definitionOfDone": [
"Zero secrets or sensitive environment variables committed to git",
".gitignore properly fences ~/.devworkflow and credential files",
"audit (category: security) reports 0 critical or high findings"
]
}Step-by-Step Tutorial Workflow
Follow these sequential actions with validated copyable commands and expected outputs.
Verify Security Mode
Ensure DevWorkflow security mode is set to strict to reject unencrypted secret persistence.
devwf doctor --json{"securityMode": "strict", "status": "healthy"}Run Workspace Security Scan
Trigger security audit tool via MCP or terminal to scan for high-entropy tokens and credentials.
// AI Tool Call: audit
{ "category": "security" }Inspect Clean Results
Verify that zero unmasked secrets, private keys, or insecure endpoints are present in the repository.
git diff --name-only | grep -E '\.env|secret|key'(no output - clean)Verification Steps
Verify that your work genuinely satisfies the task contract before closing.