Skip to main content
IntermediateQuality & SecurityEst. Time: 15-20 min

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

Prerequisites Checklist:
  • Git repository with commit history
  • dev-workflow CLI installed
Tool / CommandTypeRole in Tutorial
auditmcpScan workspace and diffs for secrets and unsafe patterns (category: security)
devwf doctorcliVerify strict security mode in local profile

Example Task Contract

Exact start_task payload representing this workflow in DevWorkflow local-first governance.

AI Tool Call: start_task payload
{
  "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.

1

Verify Security Mode

Ensure DevWorkflow security mode is set to strict to reject unencrypted secret persistence.

Copyable Command
Terminal Command
devwf doctor --json
Expected Terminal Output
{"securityMode": "strict", "status": "healthy"}
2

Run Workspace Security Scan

Trigger security audit tool via MCP or terminal to scan for high-entropy tokens and credentials.

Code / Tool Payload
Execution Payload
// AI Tool Call: audit
{ "category": "security" }
3

Inspect Clean Results

Verify that zero unmasked secrets, private keys, or insecure endpoints are present in the repository.

Copyable Command
Terminal Command
git diff --name-only | grep -E '\.env|secret|key'
Expected Terminal Output
(no output - clean)

Verification Steps

Verify that your work genuinely satisfies the task contract before closing.

Run `git log -p -n 5` to confirm recent commits contain zero unmasked secrets
Verify `DEVWF_SECURITY_MODE=strict` in environment

Limitations & Troubleshooting

Issue: Secret scanner flags test fixtures with mock API keys
Resolution: Use documented mock dummy values (e.g., `sk_test_mock_12345`) or add false-positive ignore rules in configuration.