English | 简体中文
dsh-secops
DevSecOps compliance auditor, secret/supply-chain/CI-workflow scanner, SQLite drift tracker, and pre-push guardrail plugin for DeepSeek Harness (dsh-plugin) and standalone CI.
dsh-secops protects code repositories and CI pipelines from accidental credential leaks, insecure dependency specs, exploitable GitHub Actions triggers, and workstation path exposure. It ships as both a zero-dependency DeepSeek Harness bundle (dsh.bundle) with a tools/pre-execute push gate and a standalone CLI outputting terminal tables, Markdown PR summaries, and GitHub Code Scanning SARIF 2.1.0.
Architecture
flowchart LR
Agent["DeepSeek Harness Agent / CLI"] --> Tools["4 Registered DSH Tools\nsecops_audit | secops_check_staged\nsecops_history | secops_remediate"]
Agent -->|"git push / publish"| Hook["tools/pre-execute Gate\nenforce | ask | advisory"]
Tools --> Engine["Multi-Pillar Scanner Engine"]
Hook --> Engine
Engine --> P1["Secrets & Path Hygiene\nTokens, PEM keys, URIs, entropy"]
Engine --> P2["Supply-Chain SCA\nLockfiles, wildcards, http URLs, scripts"]
Engine --> P3["CI/CD Workflows\npull_request_target, script injection, SHAs"]
Engine --> P4["Repo Governance\nLICENSE, SECURITY.md, .gitignore rules"]
P1 & P2 & P3 & P4 --> Redactor["Redactor + SHA-256 Fingerprints"]
Redactor --> DB[("node:sqlite Ledger\naudit_runs / findings / policy_events")]
Redactor --> Out["SARIF 2.1.0 / Markdown / JSON\n+ Baseline Remediation Planner"]
Why dsh-secops
- Zero external runtime dependencies: Built purely on Node.js built-ins (
node:sqlite,node:crypto,node:fs,node:child_process,node:test). Installs directly from GitHub (dsh plugin add github:forgemorrow/dsh-secops) with no build script orallowBuildsstep required. - Pre-push guardrail hook (
tools/pre-execute): Interceptsgit push,gh repo create,gh release create,npm publish, andpnpm publishcalls inside DeepSeek Harness to verify staged changes and unresolved SQLite audit findings before secrets or vulnerable workflows leave your machine. - SQLite compliance ledger & drift tracking: Persists redacted SHA-256 finding fingerprints in
.dsh-secops/audit.sqliteand computes score deltas plus+new/-resolved/persistingfinding drift between commits. - Standardized DevSecOps outputs: Emits redacted terminal summaries, GitHub PR Markdown checklists, safe
.gitignore/SECURITY.mdremediation scaffolds, and SARIF 2.1.0 for GitHub Code Scanning.
30-Second QuickStart
1. Install as a DeepSeek Harness Plugin (dsh-plugin)
dsh plugin --profile dev add github:forgemorrow/dsh-secops
Verify the composed plugin layer:
dsh --profile dev --dump-config
Once loaded, dsh-secops registers four model-callable tools (secops_audit, secops_check_staged, secops_history, secops_remediate) and enables the tools/pre-execute release guardrail defined in cordis.patch.yml.
2. Run as a Standalone CLI
Requirement: Node.js >= 22.19.0 (tested on Node 24.x).
# Clone & audit the included clean and vulnerable demo workspaces
git clone https://github.com/forgemorrow/dsh-secops.git
cd dsh-secops
# Clean repository fixture -> 100/100 PASS (exit 0)
node ./bin/dsh-secops.js audit ./fixtures/clean-repo --no-history
# Vulnerable repository fixture -> 0/100 FAIL (exit 1)
node ./bin/dsh-secops.js audit ./fixtures/vulnerable-repo --no-history
# Export SARIF 2.1.0 report
node ./bin/dsh-secops.js audit ./fixtures/vulnerable-repo --sarif --out report.sarif.json
# Preview non-destructive hygiene fixes (.gitignore / SECURITY.md)
node ./bin/dsh-secops.js remediate ./fixtures/vulnerable-repo
# Audit only staged git changes before committing
node ./bin/dsh-secops.js staged .
Observed Demo & Evaluation Output
Demo Fixture Scan (./fixtures/vulnerable-repo)
Running node ./bin/dsh-secops.js audit ./fixtures/vulnerable-repo --no-history:
[dsh-secops] scope=workspace status=FAIL score=0/100 files=4 duration=9ms
critical=6 high=3 medium=4 low=2 (fail-on=high)
[CRITICAL] CI-PULL-REQUEST-TARGET .github/workflows/pr.yml:15
pull_request_target workflow checks out untrusted PR head commit/ref
[CRITICAL] CI-SCRIPT-INJECTION .github/workflows/pr.yml:18
Untrusted context expression "${{ github.event.pull_request.title }}" interpolated directly inside shell run command
[CRITICAL] DEP-INSECURE-URL package.json:7
Dependency "internal-helper" resolves from insecure or unpinned remote URL "http://packages.insecure.example/helper.tgz"
[CRITICAL] DEP-RISKY-INSTALL-SCRIPT package.json:10
Lifecycle script "postinstall" executes suspicious download/eval payload
[CRITICAL] SEC-CONNECTION-URI src/config.js:4
Database or message-broker URI contains an embedded password (Pass****re99)
[CRITICAL] SEC-PROVIDER-TOKEN src/config.js:9
LLM provider API key literal detected (sk-p****4f8h)
[HIGH ] CI-BROAD-PERMISSIONS .github/workflows/pr.yml:7
Workflow grants broad `permissions: write-all` token scope
[HIGH ] DEP-UNPINNED-VERSION package.json:6
Dependency "lodash" in dependencies uses unbounded version "*"
[HIGH ] SEC-HIGH-ENTROPY-ASSIGNMENT src/config.js:8
High-entropy credential assigned to JWT_SIGNING_SECRET (H=4.94, a9F$****bY1q)
[MEDIUM ] CI-UNPINNED-ACTION .github/workflows/pr.yml:16
Action "community-demo/pr-labeler" uses mutable ref "@main" instead of a 40-char commit SHA
[MEDIUM ] HYG-GITIGNORE-ENV .gitignore:1
.gitignore is missing ignore patterns for .env and *.sqlite/*.db
[MEDIUM ] DEP-LOCKFILE-MISSING package.json:1
Package declares 2 runtime dependencies without a committed lockfile
[MEDIUM ] SEC-LOCAL-MACHINE-PATH src/config.js:5
Workstation-specific absolute user home path exposed in repository file
[LOW ] HYG-MISSING-LICENSE LICENSE:1
Repository root is missing an OSI LICENSE file
[LOW ] HYG-MISSING-SECURITY-POLICY SECURITY.md:1
Repository is missing a SECURITY.md vulnerability disclosure policy
Offline Ground-Truth Benchmark (npm run benchmark)
Measured locally across 16 labeled test repositories (8 injected DevSecOps failure scenarios + 8 realistic benign decoys including .env.example templates, AWS documentation placeholder AKIAIOSFODNN7EXAMPLE, secops-ignore directives, SHA-pinned third-party Actions, and safe step env: bindings):
[dsh-secops benchmark] cases=16 TP=8 TN=8 FP=0 FN=0 duration=592ms
Precision=100% Recall=100% F1=100% FPR=0%
fixtures/vulnerable-repo: score=0/100 status=FAIL findings=15
- Unit & integration tests:
15/15passing vianpm test(node --test). - Self-audit:
npm run self-auditpasses on production source & workflows (100/100 PASS).
Configuration (cordis.patch.yml & Standard Schema Config)
Customize behavior in your DeepSeek Harness profile cordis.patch.yml or via environment variables:
| Key | Default | Description |
|---|---|---|
mode |
'enforce' |
Guardrail behavior on tools/pre-execute: 'enforce' (deny), 'ask' (prompt approval), or 'advisory' (log only) |
failOnSeverity |
'high' |
Minimum severity (critical, high, medium, low, info) that triggers FAIL status or release blocking |
guardToolCalls |
true |
Enables tools/pre-execute protection on git push, release, and package publish commands |
dbPath |
'.dsh-secops/audit.sqlite' |
Local SQLite database path for run history and finding drift tracking |
recordHistory |
true |
Persists redacted audit summaries and fingerprints to SQLite |
scanLocalPaths |
true |
Flags leaked workstation home directory paths in source/config files |
excludePaths |
[] |
Array of relative path prefixes/globs to exclude (also honors .secopsignore) |
maxFileBytes |
524288 |
Maximum single-file read limit in bytes (512 KiB) |
Inline Rule Suppression
Add secops-ignore on the offending line or the line immediately above it when intentionally keeping an inert test string:
const mockToken = 'your-safe-test-literal'; // secops-ignore: SEC-HIGH-ENTROPY-ASSIGNMENT
Rule Coverage Summary
| Pillar | Rule IDs |
|---|---|
| Secrets & Local Paths | SEC-PROVIDER-TOKEN, SEC-PRIVATE-KEY, SEC-CONNECTION-URI, SEC-HIGH-ENTROPY-ASSIGNMENT, SEC-SENSITIVE-FILE, SEC-LOCAL-MACHINE-PATH |
| Supply Chain (npm / Python) | DEP-LOCKFILE-MISSING, DEP-UNPINNED-VERSION, DEP-INSECURE-URL, DEP-RISKY-INSTALL-SCRIPT, DEP-NPMRC-TOKEN |
| CI/CD Workflows | CI-PULL-REQUEST-TARGET, CI-SCRIPT-INJECTION, CI-BROAD-PERMISSIONS, CI-UNPINNED-ACTION, CI-SECRET-EXPOSURE |
| Repository Hygiene | HYG-GITIGNORE-ENV, HYG-MISSING-SECURITY-POLICY, HYG-MISSING-LICENSE |
Verification & Development
npm run check # Syntax & DSH bundle manifest verification across 19 JS modules
npm test # Run all 15 unit & integration tests
npm run benchmark # Run 16-case Precision/Recall/FPR evaluation harness
npm run self-audit # Dogfood scan on production code & CI workflows
Security & License
- Strictly defensive local static analyzer and policy guardrail; raw matched secret strings are redacted (
prefix****suffix) prior to stdout, Markdown, SARIF, or SQLite serialization. SeeSECURITY.md. - Licensed under the MIT License.
No comments yet. Be the first to write one.