2026-11-27 16:21 UTC

Deterministic security checks for AI-assisted code released as CLI, MCP server and CI tooling

state: expiredheat: mediumuncertainty: mediumrelevance: mediumai-code-security deterministic-checksAnkush1982

What is this?

Secure & Private by Design is an Apache-2.0 project by GitHub user Ankush1982. Its repository identifies v0.2.0 as the current release: a deterministic security and privacy checking engine available as a CLI, MCP server, Git hooks and GitHub Actions integration, with editable code scaffolds. It maps checks and scaffolds to selected frameworks including NIST SSDF, ISO 27001, India’s DPDP Act and, optionally, the AI Security Wiki. The supplied repository text reports fixture-based tests, but says the project is pending real-world validation and its DPDP scaffolds have not had legal review. Evidence is primarily the project’s own repository and a Hacker News submission; independent validation or adoption is not established.

Why it matters

This project explores a useful shift in AI-assisted development: put some security checks in deterministic code and CI rather than relying on an AI assistant to remember instructions. If adopted, the same checks could apply across coding assistants and human-written changes, while local execution and editable scaffolds give teams a starting point for controls. Its practical reach and effectiveness remain uncertain: the repository documents limited language support, pattern-based detection with known blind spots, and no real-world validation.

Current assessment

Newly surfaced project, not an independently verified security product. The repository says v0.2.0 is available now, supports Node.js 20+, and offers a CLI, MCP server, hooks and GitHub Action; Python/FastAPI and TypeScript/Express are the listed supported stacks, while other stacks are planned. Its checks cover selected secrets, personal-data patterns, schema fields, logging, required scaffolds and some AI-specific risks when the optional AI Security Wiki regime is enabled. Findings are deterministic rule-based outputs; assistants may explain or suggest fixes but do not determine findings. The project says it runs locally without telemetry and that its MCP server is read-only, with HTTP bound to loopback by default. Important limits: pattern checks cannot prove sensitive data is absent; several data types and production data are not covered; platform integrations are not all tested; hooks can be bypassed or weakened, so the project recommends required CI; and it is not compliance certification. Maintainer claims about availability and tests are supported by the supplied repository text, not by independent evaluation. Potential significance is as accessible, cross-assistant guardrails for AI-written code, especially for small teams; efficacy, adoption and compliance value need follow-up evidence.

Measured heat

no measured readings yet β€” the hourly heat pass fills this in

How the heat travelled

06-10 14:00⭐ origin echo-reconstructedThe repository is the origin, not a repost of a linked blog, tweet, or paper. Its README describes β€œa deterministic engine, plus editable sc
Ankush Jain (GitHub account ankush1982) on github (echo) Β· attributed from hn.story.50367537
β€”
11-04 16:03first on hacker news Β· published Β· +3530.1hDeterministic security and privacy checks for code from AI assistants
ankush82
β€”
11-04 16:03amplified on hacker news πŸ‘‘hn.story.50367537
ankush82
peak 1 Β· 0 comments Β· 104% of case engagement
11-04 16:22our radar first saw it Β· +3530.4hdiscovery anchor: hn.story.50367537β€”

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnDeterministic security and privacy checks for code from AI assistants
Retrieved article excerpt

Open article Β· Retrieved 2026-11-04T16:25:32.464505+00:00

[Secure & Private by Design](https://github.com/ankush1982/ai-secure-by-design)

**The same security and privacy checks, whichever AI wrote the code.**  
A deterministic engine, plus editable scaffolds for consent, audit logs, data rights and AI oversight.

[CI](https://github.com/ankush1982/ai-secure-by-design/actions/workflows/ci.yml)
[License: Apache-2.0](https://github.com/ankush1982/ai-secure-by-design/blob/main/LICENSE)
[Node.js 20+](https://camo.githubusercontent.com/1635f30b21ebe41c1c0b0cf3257f757fd254402853a68a2d79ba222950da1f21/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d32302532422d304541353846)
[Latest release](https://github.com/ankush1982/ai-secure-by-design/releases/latest)

[Quick start](https://github.com/ankush1982/ai-secure-by-design#quick-start) Β·
[What it covers](https://github.com/ankush1982/ai-secure-by-design#what-it-covers) Β·
[What it detects](https://github.com/ankush1982/ai-secure-by-design#what-it-detects) Β·
[How it works](https://github.com/ankush1982/ai-secure-by-design#how-it-works-v02) Β·
[Platforms](https://github.com/ankush1982/ai-secure-by-design#platform-support) Β·
[What this is not](https://github.com/ankush1982/ai-secure-by-design#what-this-is-not) Β·
[Roadmap](https://github.com/ankush1982/ai-secure-by-design/blob/main/ROADMAP.md) Β·
[Contributing](https://github.com/ankush1982/ai-secure-by-design/blob/main/CONTRIBUTING.md)

AI coding tools write code quickly and forget rules quietly. Secure & Private by Design moves the rules out of the prompt and into an engine that gives the same answer every time, then runs that engine in your editor, your git hooks and your CI.

Tell it what your product does and which regimes you target. It profiles your codebase, asks you to classify your data, and deploys dev-loop controls (hooks, skills, slash commands, subagents, an MCP server) and product-code scaffolds tailored to your stack.

## Why use it

- **Secrets and personal data get blocked.** Hardcoded keys, Aadhaar numbers, PAN, mobile numbers and emails are stopped in Claude Code, at commit and in CI, and reports never repeat the value.
- **Checks are code, not prompts.** Claude, GPT, Gemini and a human running the CLI all see the same findings, each with a stable rule ID, a severity and a location.
- **Your manifest is the source of truth.** One YAML file records your data categories, regimes, retention and consent. Only the regimes you list are enforced, and the tool never classifies a field for you.
- **You own the scaffolds.** Consent, data rights, audit logging, RBAC, PHI redaction and AI decision logs land in your repo as ordinary code you can edit or delete.
- **Everything runs locally.** No telemetry and no hosted service.

## See it run

`sbd check` on the sample app in `mcp-server/test/fixtures/clinic-app` (trimmed):

```
Manifest: privacy-security-manifest.yaml (schemaVersion 0.2)
Regimes:  nist-ssdf-1.1, iso-27001-2022, dpdp-2023

  1. [CRITICAL] SBD-SCAF-001 Missing src/privacy/consent.<ext> (Consent scaffold).
       β†’ Copy templates/typescript-express/consent.ts to src/privacy/consent.ts, or run `sbd deploy`.
 10. [HIGH] SBD-FIELD-001 prisma/schema.prisma:5 β€” Field dateOfBirth looks personal or sensitive but no dataCategory lists it.
 12. [HIGH] SBD-CODE-002 src/routes/patients.ts:19 β€” Log call references a field the manifest classifies as personal or sensitive.
       console.log('loaded patient', patient.email);
       β†’ Route the value through the redacting logger in src/security/audit_log.
 13. [HIGH] SBD-CODE-003 src/services/triage.ts:6 β€” Model inference call with no decision-log call within 15 lines.
 16. [MEDIUM] SBD-CODE-001 src/routes/patients.ts:12 β€” Handler mutates data without an auditLog() call within 40 lines.

17 finding(s): 2 critical, 11 high, 3 medium, 1 low, 0 info.
This report lists control gaps. It is not a compliance determination.
```

## What it covers

| Regime | Scope |
| --- | --- |
| **NIST SSDF 1.1** | Secure SDLC baseline β€” applies to every project |
| **ISO 27001:2022** | Annex A controls relevant to the dev/SDLC slice (A.5.15, A.5.34, A.8.5, A.8.10–.12, A.8.15, A.8.24–.32) |
| **DPDP Act 2023 (India)** | Notice, consent, data principal rights, retention, breach notification, children's data gate, Significant Data Fiduciary flagging |
| **AI Security Wiki** (optional) | The community [AI Security Wiki](https://nachi065.github.io/AI-Security-Wiki/) control library (46 AI controls) plus AI-specific checks on model output, model loading, MCP servers and agent permissions. A practitioner reference, not a law. See [AI Security Wiki integration](https://github.com/ankush1982/ai-secure-by-design#ai-security-wiki-integration) |



| Stack | Status |
| --- | --- |
| TypeScript + Express | v0.1 βœ… (templates in `templates/typescript-express/`) |
| TypeScript + Next.js | Planned (v0.2+). No templates yet. |
| Python + FastAPI | v0.2 βœ… (templates in `templates/python-fastapi/`; needs Python 3.10+ and `fastapi`). `sbd check` also reads Python code and models. |
| Go, Rust, Java, .NET | Later |

## What it detects

`sbd check` looks for three kinds of sensitive data. Rules are patterns over your code and data files, so a clean report does not prove the data is absent.

| Data | Found | Not found |
| --- | --- | --- |
| **Secrets** | AWS, GitHub, Slack, Google and OpenAI-style keys, private keys and credential assignments, with the value masked in reports | Secrets with no known format or assignment |
| **PII** | Aadhaar numbers (with checksum), PAN, Indian mobile numbers and email addresses written into source and data files, with the value hidden in reports. Unclassified personal-looking schema fields. Classified fields, and whole request or user objects, passed to log calls | Names and postal addresses. Personal data in production databases or logs |
| **PHI** | Clinical and health-identifier schema fields such as `diagnosis`, `mrn`, `bloodGroup`, `allergies` and `abhaNumber`, plus any field you classify | Clinical free text in code, such as a sample patient note. Use [`phi_redaction`](https://github.com/ankush1982/ai-secure-by-design#what-gets-deployed) to redact it at runtime |

Any secret or literal PII blocks. Every rule above is `HIGH` or `CRITICAL`, so each one fails at the default `--fail-on high`:

| Where | Blocks on |
| --- | --- |
| Claude Code editor hook | Secrets and literal PII in a proposed edit, before it is written |
| `sbd-secrets` pre-commit hook (`sbd scan --staged`) | Secrets and literal PII on staged lines, with or without a manifest |
| `sbd-check` pre-commit hook (`sbd check --staged`) | The above, plus schema fields and log calls on staged lines. Needs a manifest |
| GitHub Action (`sbd check`) | All of the above, across the repository or a diff |

Placeholder values such as `@example.com` addresses are skipped, and the secret rules skip lockfiles, snapshots and `fixtures/` folders. To accept reviewed sample data, add `sbd: ignore SBD-PII-001` to the line and record why; it shows up in the diff for review, and secret rules cannot be ignored this way. Setting `--fail-on critical` or `none`, or running `git commit --no-verify`, turns local blocking off, so keep the GitHub Action as a required check. Without Node.js, the fallback hook scripts cover secrets only.

## How it works (v0.2)

The checks that must give the same answer every time are code, not prompts. One engine, thin adapters per platform:

```
 schemas/ + regimes/ + rules/   data, schema-validated
            β”‚
   sbd engine (mcp-server/src/core)   check Β· scan Β· validate Β· plan Β· explain
   output: text, JSON, SARIF 2.1.0; exit codes 0 / 1 / 2
            β”‚
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 MCP server  git hooks      CI action       instruction packs
 stdio+HTTP  (pre-commit)   (action.yml)    CLAUDE.md, AGENTS.md, GEMINI.md,
                                            Copilot, Cursor (one source)
```

An AI assistant explains findings and proposes fixes. It does not decide what the findings are, so Claude, GPT, Gemini or a human running the CLI all see the same list, and CI enforces it whichever of them wrote the code.

## Quick start

### Any platform: the CLI

```
git clone https://github.com/ankush1982/ai-secure-by-design
cd /path/to/your/repo
node /path/to/ai-secure-by-design/dist/sbd.mjs check
```

Or add it to a Node project as a dev dependency (`npm i -D github:ankush1982/ai-secure-by-design#v0.2.0`) and run `npx sbd check`. It is not published to the npm registry yet.

To set up a project without an AI assistant, choose your regimes and run:

```
sbd init --non-interactive --regime nist-ssdf-1.1,iso-27001-2022   # writes a draft manifest
sbd validate
sbd deploy --dry-run                                               # shows what would change
sbd deploy                                                         # copies the scaffolds
sbd plan                                                           # every scaffold now shows as present
```

The draft never decides for you. It leaves `dataCategories` empty and lists the personal-looking fields as `TODO(user):` comments, because classification is yours. Without `--regime` it leaves `regimes` empty, and `validate`, `plan` and `deploy` stop with a schema error until you add one. Scaffolds that depend on your data, such as consent and DSR handling, are required only once you declare personal data in the manifest.

| Command | What it does |
| --- | --- |
| `sbd init --non-interactive [--regime ID]... [--stack STACK] [--dry-run]` | Detects the stack and writes a draft `privacy-security-manifest.yaml` with `TODO(user):` markers. Never classifies a field, lists only the regimes you pass, and never overwrites an existing manifest. |
| `sbd deploy [--stack STACK] [--dry-run] [--force]` | Copies the scaffolds the manifest requires, each with its template checksum in the generator header. Safe to re-run: it updates scaffolds you have not touched and leaves edited or user-authored files alone unless you pass `--force`. Exits `1` if a required scaffold could not be deployed, for example because the stack has no template. |
| `sbd check [--diff RANGE | --staged] [--format text|json|sarif] [--output FILE] [--fail-on LEVEL]` | All checks: manifest schema and semantics, secrets, literal personal data, unclassified personal-looking fields, required scaffolds, audit-log coverage, personal data in logs, AI decision logging |
| `sbd scan --staged | --stdin | FILE...` | Scans for secrets and literal personal data, with no manifest needed (used by hooks) |
| `sbd validate` | Manifest only |
| `sbd plan [--stack STACK]` | Which scaffolds the manifest needs, where they go, and whether they exist. Writes nothing. The stack comes from `--stack`, then `product.stack`, then detection. |
| `sbd controls [--regime ID]`, `sbd explain REGIME CONTROL` | Query the regime catalogues |
| `sbd evidence [--tier baseline|advanced] [--format text|json|markdown|csv] [--output FILE]` | Plans audit evidence, showing each control as `gap`, `checked` or `manual` |
| `sbd provenance MSGFILE` | Commit-message provenance check |

Exit codes: `0` no findings at or above `--fail-on` (default `high`), `1` findings, `2` usage or runtime error.

With `--staged` or `--diff`, `sbd check` gates the change: it reports findings on added lines, and manifest findings only if the change touches the manifest. Project-wide gaps such as missing scaffolds appear in a full `sbd check`, which the CI template runs on pushes to the main branch.

Each finding has a stable rule ID (`SBD-SECRET-001`, `SBD-PII-001`, `SBD-CODE-002`, `SBD-SCAF-004`, …), a severity, a location and the regime controls it maps to. Rules live in `rules/*.yaml`; add a rule there and every adapter picks it up.

### Git hooks (any editor, any AI)

Add to your repo's `.pre-commit-config.yaml` ([pre-commit](https://pre-commit.com)):

```
repos:
  - repo: https://github.com/ankush1982/ai-secure-by-design
    rev
ankush8210
🟧 echo.github ⭐The repository is the origin, not a repost of a linked blog, tweet, or paper. Its README describes β€œa deterministic engine, plus editable scAnkush Jain (GitHub account ankush1982)β€”β€”

Interpretation history

Decision trace