Skip to content

Commit fa4fb54

Browse files
authored
release: v0.3.1 — Gate G (dependency CVEs), polyglot scan, anchored allowlist (#3)
Added - Gate G — dependency CVE scan. scripts/bash/dep-audit.sh resolves osv-scanner → pnpm audit → npm audit → yarn npm audit. Threshold via dep_audit.fail_on (low|moderate|high|critical, default high); opt-out via dep_audit.enabled: false. Registered as the new speckit.tekimax-security.dep-audit command. Runs automatically as part of gate-check and logs to .tekimax-security/dep-audit-log.jsonl. - Polyglot file coverage in audit.sh and Gate F — TS/JS/Py plus Go, Rust, Ruby, Java, Kotlin, Swift, PHP, shell, YAML, JSON, TOML, Terraform, Markdown. Defaults live in lib/defaults.sh:DEFAULT_INCLUDE_EXTS. Secrets and inline prompts frequently land in CI YAML and Terraform, not only application code. - audit.include_globs and audit.exclude_paths config keys to extend the polyglot scan without replacing defaults. - audit.direct_sdk_patterns config key. Built-in SDK list expanded to include cohere-ai, @mistralai/mistralai, @aws-sdk/client-bedrock-runtime, replicate, together-ai alongside @google/genai, @anthropic-ai/sdk, openai. - --staged-only flag on audit.sh and gate-check.sh. Scans only files in the git index. Pre-commit-hook-friendly. - --json flag on audit.sh, gate-check.sh, and dep-audit.sh. Emits machine-readable findings for CI and dashboards in addition to (or in place of) the human-readable table. - build_exclude_regex and scan_staged_files helpers in lib/defaults.sh to support polyglot and staged-file scans. - Three regression tests: anchored-allowlist-rejects-prefix-bypass, polyglot-go-secret, env-in-subdirectory. Suite is 18/18. Changed - Gateway allowlist uses anchored matching. _is_gateway_allowed in lib/defaults.sh now matches only at the exact path, as a directory prefix with a '/' boundary, or with a file-extension append (src/ai/gateway, src/ai/gateway/*, src/ai/gateway.ts). An entry src/ai/gateway no longer silently matches src/ai/gateway-bypass.ts. Teams that relied on the substring match must list full file paths or the containing directory. - .env detection is recursive. apps/*/.env, packages/*/.env.local, and other nested env files are detected; previously only the repo root was checked. .env.example, .env.sample, and .env.template remain allowed.
1 parent 1d232b6 commit fa4fb54

17 files changed

Lines changed: 1082 additions & 162 deletions

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,59 @@
33
All notable changes to `tekimax-security` will be documented here.
44
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) · SemVer.
55

6+
## [0.3.1] — 2026-04-16
7+
8+
### Added
9+
10+
- **Gate G — Dependency CVEs.** New `scripts/bash/dep-audit.sh` and
11+
`speckit.tekimax-security.dep-audit` command. Resolution order:
12+
`osv-scanner` (polyglot, preferred) → `pnpm audit``npm audit`
13+
`yarn npm audit`. Skips cleanly when no scanner is available.
14+
Threshold configurable via `dep_audit.fail_on`
15+
(`low` | `moderate` | `high` | `critical`, default `high`).
16+
Opt-out via `dep_audit.enabled: false`. Gate G runs automatically
17+
as part of `gate-check` and logs to
18+
`.tekimax-security/dep-audit-log.jsonl`.
19+
- **Polyglot file coverage.** Gate F and the audit now scan Go,
20+
Rust, Ruby, Java, Kotlin, Swift, PHP, shell, YAML, JSON, TOML,
21+
Terraform, and Markdown by default — secrets and inline prompts
22+
commonly live outside TS/Py. Defaults live in
23+
`lib/defaults.sh:DEFAULT_INCLUDE_EXTS`.
24+
- **`audit.include_globs` and `audit.exclude_paths` config keys**
25+
to extend the polyglot scan without replacing defaults.
26+
- **`audit.direct_sdk_patterns` config key.** Extend the default
27+
SDK list (`@google/genai`, `@anthropic-ai/sdk`, `openai`,
28+
`cohere-ai`, `@mistralai/mistralai`,
29+
`@aws-sdk/client-bedrock-runtime`, `replicate`, `together-ai`)
30+
with any provider your stack adopts.
31+
- **`--staged-only` flag** on `audit.sh` and `gate-check.sh`.
32+
Scans only files in the git index. Pre-commit-hook-friendly: a
33+
typical change touches <5 files, not the whole tree.
34+
- **`--json` flag** on `audit.sh`, `gate-check.sh`, and
35+
`dep-audit.sh`. Emits machine-readable findings alongside (or in
36+
place of) the human table so CI jobs and dashboards don't have
37+
to re-parse the log file.
38+
- **`build_exclude_regex` and `scan_staged_files`** helpers in
39+
`lib/defaults.sh` to support polyglot and staged-file scans.
40+
- **Three regression tests:**
41+
`anchored-allowlist-rejects-prefix-bypass.sh`,
42+
`polyglot-go-secret.sh`, `env-in-subdirectory.sh`. Suite is 18/18.
43+
44+
### Changed
45+
46+
- **Gateway allowlist uses anchored matching.**
47+
`_is_gateway_allowed` in `lib/defaults.sh` now matches only at
48+
the exact path, as a directory prefix with a '/' boundary, or
49+
with a file-extension append. An entry `src/ai/gateway` no
50+
longer silently matches `src/ai/gateway-bypass.ts`. Teams that
51+
relied on the substring match must list full file paths or the
52+
containing directory.
53+
- **`.env` detection is recursive.** `apps/*/.env`,
54+
`packages/*/.env.local`, and similar nested env files are now
55+
detected; previously only the repo root was checked.
56+
`.env.example`, `.env.sample`, and `.env.template` remain
57+
allowed.
58+
659
## [0.3.0] — 2026-04-16
760

861
### Added

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
[![Spec Kit Extension](https://img.shields.io/badge/spec--kit-extension-7c3aed)](https://github.com/github/spec-kit)
2222
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
23-
[![Version](https://img.shields.io/badge/version-0.3.0-green)](CHANGELOG.md)
23+
[![Version](https://img.shields.io/badge/version-0.3.1-green)](CHANGELOG.md)
2424
[![Status](https://img.shields.io/badge/status-alpha-orange)]()
2525
[![Docs](https://img.shields.io/badge/docs-speckit.tekimax.com-7c3aed)](https://speckit.tekimax.com)
2626
[![Ask AI](https://img.shields.io/badge/ask%20AI-chat-10b981)](https://speckit.tekimax.com/chat)
@@ -62,6 +62,7 @@ follows automatically via Spec Kit hooks.
6262
| `/speckit.tekimax-security.gate-check` | `before_implement` | Blocks implementation until all security sections pass |
6363
| `/speckit.tekimax-security.audit` | `after_implement` | Inline prompts, committed secrets, direct SDK imports, guardrail drift |
6464
| `/speckit.tekimax-security.red-team` | `before_analyze` | Adversarial testing — prompt injection, jailbreak, extraction, auth bypass |
65+
| `/speckit.tekimax-security.dep-audit` | part of `gate-check` | Dependency CVEs (Gate G) via osv-scanner / pnpm / npm / yarn |
6566
| `/speckit.tekimax-security.install-rules` | manual | Installs a `DEVELOPMENT-RULES.md` into your project — commit hygiene, file structure, DRY, naming, inline docs, unit test rules |
6667

6768
---
@@ -137,7 +138,7 @@ agent (Claude Code, Copilot, Gemini CLI). The typical flow:
137138

138139
---
139140

140-
## The Six Security Gates
141+
## The Seven Security Gates
141142

142143
| Gate | Phase | Enforces |
143144
|---|---|---|
@@ -146,7 +147,8 @@ agent (Claude Code, Copilot, Gemini CLI). The typical flow:
146147
| **C — Model Governance** | DESIGN | Version pinning, eval baselines, rollback plan |
147148
| **D — Guardrails** | SPECIFY/DESIGN | Input/output filters, numeric rate limits, numeric cost ceilings |
148149
| **E — Red Team** | VERIFY | Adversarial scenarios, no succeeded High/Critical attacks |
149-
| **F — Inline Content Scan** | IMPLEMENT | No inline prompts, no secrets, no `.env` committed |
150+
| **F — Inline Content Scan** | IMPLEMENT | No inline prompts, no secrets, no `.env` committed — **polyglot** (TS/JS/Py/Go/Rs/Java/Kt/Swift/Rb/Sh/YAML/TF/Toml/MD), recursive `.env` detection |
151+
| **G — Dependency CVEs** | IMPLEMENT | `osv-scanner` (preferred) or `pnpm` / `npm` / `yarn audit`, threshold-gated |
150152

151153
Each gate produces an append-only JSONL entry in
152154
`.tekimax-security/gate-log.jsonl` for compliance audit trails.

commands/dep-audit.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
description: "Scan project dependencies for known CVEs via osv-scanner / pnpm / npm / yarn (Gate G)"
3+
scripts:
4+
sh: ../../scripts/bash/dep-audit.sh
5+
---
6+
7+
# Dependency CVE Scan (Gate G)
8+
9+
Scan the project's locked dependencies for known vulnerabilities
10+
published to the OSV database or the relevant package manager's
11+
advisory feed.
12+
13+
## User Input
14+
15+
$ARGUMENTS
16+
17+
## Context
18+
19+
Spec Kit writes application code; it never touches `package.json`,
20+
`Cargo.toml`, `go.mod`, or any other manifest. Vulnerable
21+
dependencies therefore slip past every other gate in this
22+
extension. Gate G closes that loop by scanning the committed
23+
lockfile and failing when findings meet or exceed the configured
24+
severity threshold.
25+
26+
## Steps
27+
28+
1. **Run the dependency audit**:
29+
30+
```bash
31+
bash {SCRIPT}
32+
```
33+
34+
Add `--json` for machine-readable output (CI, dashboards):
35+
36+
```bash
37+
bash {SCRIPT} --json
38+
```
39+
40+
2. **Scanner resolution** (first available wins):
41+
42+
- `osv-scanner` on `PATH` — preferred. Polyglot (npm, pypi,
43+
cargo, go, maven, gem), no account needed, queries OSV.dev.
44+
- `pnpm audit` — if `pnpm-lock.yaml` is present.
45+
- `npm audit` — if `package-lock.json` is present.
46+
- `yarn npm audit` — if `yarn.lock` is present (Yarn 2+).
47+
- None available → skip with a clear message (exit 0).
48+
49+
3. **Severity threshold** — read from
50+
`tekimax-security-config.yml`:
51+
52+
```yaml
53+
dep_audit:
54+
enabled: true
55+
fail_on: high # low | moderate | high | critical
56+
```
57+
58+
`fail_on: high` blocks on any high or critical finding. Set
59+
`enabled: false` to skip Gate G entirely (useful for repos with
60+
no runtime dependencies).
61+
62+
4. **Report** — human table by default:
63+
64+
```
65+
┌─────────────────────────────────────────────────┐
66+
│ Dependency CVE Scan (Gate G) │
67+
├─────────────────────────────────────────────────┤
68+
│ tool: osv-scanner │
69+
│ threshold: high │
70+
│ critical=0 high=2 moderate=5 low=1 │
71+
└─────────────────────────────────────────────────┘
72+
VERDICT: BLOCK (total=8)
73+
```
74+
75+
5. **Log** the verdict to
76+
`.tekimax-security/dep-audit-log.jsonl` (append-only).
77+
78+
## Rules
79+
80+
- Never print the actual SBOM or full advisory payload in the
81+
console — only counts and verdict. Use `--json` when a machine
82+
consumer needs detail.
83+
- Gate G does **not** auto-fix. Remediation is a separate
84+
workflow (bump the direct dep, run `pnpm update`, etc.).
85+
- `osv-scanner` is strictly preferred. Install it once per machine
86+
and every repo benefits:
87+
88+
```bash
89+
brew install osv-scanner # macOS
90+
go install github.com/google/osv-scanner/cmd/osv-scanner@v1
91+
```

config/tekimax-security-config.template.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ stack:
2020
storage: <your-storage>
2121

2222
audit:
23+
# User entries extend the built-in defaults from lib/defaults.sh.
24+
# The defaults are polyglot — TS/JS/Py/Go/Rs/Ruby/Java/Kt/Swift/
25+
# PHP/Sh/YAML/JSON/Toml/TF/MD — so most teams only add
26+
# project-specific markers here.
2327
inline_prompt_patterns:
2428
- "you\\s+are\\s+a"
2529
- "as\\s+an\\s+ai"
@@ -35,16 +39,43 @@ audit:
3539
- "ghp_[0-9a-zA-Z]{36}"
3640
- "AKIA[0-9A-Z]{16}"
3741
- "AIza[0-9A-Za-z-_]{35}"
38-
file_scope:
39-
- "src/**/*.ts"
40-
- "src/**/*.tsx"
41-
- "src/**/*.js"
42-
- "src/**/*.jsx"
43-
- "src/**/*.py"
42+
43+
# Extra file extensions to scan beyond the polyglot defaults.
44+
# Format: glob patterns matching filenames (not paths).
45+
include_globs:
46+
- "*.vue"
47+
- "*.svelte"
48+
49+
# Path fragments skipped during recursive scans. Extends the
50+
# default exclude list (node_modules, .git, dist, build, target,
51+
# .next, out, .venv, venv, coverage, etc.).
52+
exclude_paths:
53+
- "fixtures/"
54+
- "examples/"
55+
56+
# Direct-SDK import detection. Extends the built-in list
57+
# (@google/genai, @anthropic-ai/sdk, openai, cohere-ai,
58+
# @mistralai/mistralai, @aws-sdk/client-bedrock-runtime, replicate,
59+
# together-ai). Add packages specific to your stack.
60+
direct_sdk_patterns:
61+
- "fireworks-ai"
62+
- "@groq/groq-sdk"
63+
4464
allowlist:
45-
# Files allowed to import model SDKs directly (gateway internals only)
65+
# Files allowed to import model SDKs directly (gateway internals
66+
# only). Anchored match — `src/ai/gateway-bypass.ts` will NOT
67+
# inherit an `src/ai/gateway` entry. Use a directory entry or
68+
# list the full file path.
4669
stack_direct_sdk:
47-
- "src/ai/gateway.ts"
70+
- "src/ai/gateway"
71+
- "workers/ai"
72+
73+
# Gate G — Dependency CVE scan. Uses osv-scanner when available
74+
# (polyglot, no account, no network auth), else pnpm / npm / yarn
75+
# audit against the project's lockfile.
76+
dep_audit:
77+
enabled: true # set to false to skip Gate G entirely
78+
fail_on: high # low | moderate | high | critical
4879

4980
red_team:
5081
staging_url: "${SPECKIT_TEKIMAX_SECURITY_STAGING_URL}"

docs-site/content/docs/commands.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Commands
3-
description: The eight slash commands speckit-security adds to Spec Kit.
3+
description: The nine slash commands speckit-security adds to Spec Kit.
44
---
55

6-
`speckit-security` adds **eight slash commands** to whichever AI agent
6+
`speckit-security` adds **nine slash commands** to whichever AI agent
77
you're using. Every command is an agent-neutral Markdown file under
88
`commands/` in the extension repo, Spec Kit translates each one into
99
the active agent's native format on install.
@@ -14,8 +14,9 @@ the active agent's native format on install.
1414
| `threat-model` | Generate a STRIDE threat model for the active spec |
1515
| `model-governance` | Pin model version, define eval baselines, write rollback plan |
1616
| `guardrails` | Generate versioned system prompt + guardrail YAML for AI features |
17-
| `gate-check` | Run all six gates against the active spec, emit verdict |
18-
| `audit` | Post-implementation scan, inline prompts, secrets, direct SDKs |
17+
| `gate-check` | Run all seven gates against the active spec, emit verdict |
18+
| `audit` | Post-implementation scan — inline prompts, secrets, direct SDKs (polyglot) |
19+
| `dep-audit` | Dependency CVE scan (Gate G) via osv-scanner / pnpm / npm / yarn |
1920
| `red-team` | Generate adversarial scenarios; `--run` hits staging automatically |
2021
| `install-rules` | Install dev rules into docs, constitution, and agent context file |
2122

docs-site/content/docs/customization.mdx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,38 @@ description: Config file, template overrides, hook toggling, allowlists, and env
66
`speckit-security` is designed to be vendor-agnostic. You can adapt
77
it to your team's conventions, tools, and policies without forking
88
the repo. This page walks through every supported customization
9-
point in v0.2.5.
9+
point in v0.3.1.
1010

1111
<Callout type="info">
1212
**What the scripts actually read from the config:**
1313

1414
-`red_team.staging_url`
15-
-`red_team.max_rps` (new in v0.2.5)
16-
-`audit.secret_patterns` (extends built-ins; new in v0.2.5)
17-
-`audit.inline_prompt_patterns` (extends built-ins; new in v0.2.5)
18-
-`audit.allowlist.stack_direct_sdk` (extends built-ins; new in v0.2.5)
15+
-`red_team.max_rps`
16+
-`red_team.never_run_against`
17+
-`audit.secret_patterns` (extends built-ins)
18+
-`audit.inline_prompt_patterns` (extends built-ins)
19+
-`audit.allowlist.stack_direct_sdk` (extends built-ins, **anchored** in v0.3.1)
20+
-`audit.include_globs` (extends polyglot defaults — **new in v0.3.1**)
21+
-`audit.exclude_paths` (extends the default exclude list — **new in v0.3.1**)
22+
-`audit.direct_sdk_patterns` (extends built-ins — **new in v0.3.1**)
23+
-`dep_audit.enabled`, `dep_audit.fail_on` (Gate G — **new in v0.3.1**)
1924
-`required_sections` — still hardcoded (Gate A/B header text)
20-
-`audit.file_scope` — still hardcoded
21-
-`red_team.never_run_against` — hardcoded on purpose (defense in depth)
2225
- 🛈 `enforcement`, `stack.*` — informational, read by humans
2326
and by Spec Kit's hook runtime (not the individual scripts)
2427

25-
User-supplied patterns and allowlist entries are **additive**:
26-
they extend the built-in defaults rather than replacing them. A
27-
missing config file means full built-in coverage, so adoption is
28-
safe by default.
28+
User-supplied patterns, paths, and allowlist entries are
29+
**additive**: they extend the built-in defaults rather than
30+
replacing them. A missing config file means full built-in
31+
coverage, so adoption is safe by default.
32+
</Callout>
33+
34+
<Callout type="warn">
35+
**v0.3.1 allowlist is anchored.** `src/ai/gateway` now matches
36+
the exact path, a directory prefix with a `/` boundary, or a
37+
file-extension append — it does **not** silently allowlist
38+
`src/ai/gateway-bypass.ts`. If your project relied on the
39+
looser substring match, list full file paths or use directory
40+
entries like `workers/ai`.
2941
</Callout>
3042

3143
<Callout type="info">

0 commit comments

Comments
 (0)