vetgate
Beta. Calibrated on a private 1,200-file .NET codebase and on public repos (eShop, nopCommerce, Bitwarden server, Jellyfin, Ghost, cal.com, Payload, Vercel Commerce, Juice Shop). False-positive reports are very welcome.
A fast, local, low-noise security, quality and accessibility gate for code written or changed by LLM coding agents.
| Stack | Files |
|---|---|
| C# / ASP.NET Core | .cs, Razor .cshtml/.razor, appsettings*.json, web.config |
| Node.js / TypeScript | .js .mjs .cjs .jsx .ts .mts .cts .tsx (Express, Fastify, Koa, Next.js, NestJS, React) |
| Markup | .html .htm .vue .svelte |
What it checks, in every language (same base set, see docs/rules/baseline.md):
-
Security: injection (SQL, NoSQL, command, code, regex, XXE), path traversal, SSRF, open redirect, XSS, insecure deserialization, hardcoded secrets, weak crypto/random, disabled TLS/JWT validation, permissive CORS, insecure cookies, secrets in logs, stack traces returned to clients, endpoints without auth.
-
Billing: paid APIs (Google Maps/Places/Gemini, OpenAI, Anthropic...) called in loops or render effects without a rate limit, cache or cap.
-
Accessibility and loaded scripts: images without
alt, click handlers unusable by keyboard, external scripts without Subresource Integrity. -
Quality and practices: functions over 80 lines / 15 branches, files over 500 lines, self-recursion, empty catch, async without error handling, debug leftovers, duplicated / unused / catch-all helpers.
-
Deterministic and explainable. Every finding says where the data comes from (
source), which control is missing (guard), where it lands (sink) and why that is exploitable (reason). -
Fast. Milliseconds per file, no server, no model download.
--diffscans only what changed. -
Low noise by design. Intra-procedural taint with guard recognition. The default vetgate is calibrated to 0 medium+ findings on a large real-world .NET codebase (1,200+ files).
-
Built for agents. A post-edit hook feeds findings back to the coding agent after every edit, and the
compactformat uses one line per finding.
It is a pre-filter, not a full SAST: data is followed within one file (including its private helpers) but not across files, and there is no business-logic or IDOR analysis. Use it to catch the obvious things cheaply, and keep human or LLM review for what needs reasoning.
Install
pip install vetgate # Python 3.10+; depends only on tree-sitter + tree-sitter-c-sharp
Use
vetgate src/ # security focus, blocks on medium+
vetgate src/ --focus all --format text # security + debug + quality + practices
vetgate . --diff # only files changed vs HEAD (+ untracked)
vetgate . --diff origin/main --format sarif > gate.sarif
git diff --name-only | vetgate --files-from -
| Option | Meaning |
|---|---|
--focus security,debug,quality,practices,all |
which checks to run (default security) |
--min-severity low/medium/high |
default medium for security only, low otherwise |
--format json/text/compact/sarif |
SARIF works with GitHub code scanning |
--disable RULE,... |
skip rules |
--include-tests |
also scan test projects (skipped by default) |
--include-dapper |
C#: also check dynamic Dapper SQL |
--no-fail |
always exit 0 |
Exit code: 0 clean, 1 findings at or above the threshold, 2 error.
Suppress one finding: // vetgate-ignore: RULE -- reason on the line or the line above.
Rules (Node.js / TypeScript, HTML)
security: CMD_INJ, CODE_INJECTION, SQL_INJ, NOSQL_INJ, PATH_TRAVERSAL, SSRF, OPEN_REDIRECT,
XSS_RAW_HTML, PROTOTYPE_POLLUTION, HARDCODED_SECRET, WEAK_CRYPTO, INSECURE_RANDOM, LOG_SENSITIVE_DATA,
CORS_PERMISSIVE, JWT_VALIDATION_DISABLED, EXCEPTION_DETAILS_IN_RESPONSE, CERT_VALIDATION_DISABLED,
INSECURE_COOKIE, PAID_API_UNBOUNDED (billing), SCRIPT_NO_SRI (HTML/JSX/Razor)
debug / quality / practices (low): DEBUG_CONSOLE_OUTPUT, SECURITY_BYPASS_TODO, EMPTY_CATCH_BLOCK,
SELF_RECURSION, SYNC_IO_IN_HANDLER, PROMISE_WITHOUT_CATCH, PROCESS_EXIT_IN_HANDLER,
DEPRECATED_BUFFER_CTOR, ASYNC_PROMISE_EXECUTOR, IMG_NO_ALT, CLICK_NO_KEYBOARD
Details: docs/rules/nodejs.md
Rules (C#)
security (default gate): SQL_INJ, CMD_INJ, PATH_TRAVERSAL, INSECURE_DESERIALIZATION,
HARDCODED_SECRET, ENDPOINT_NO_AUTH, WEAK_CRYPTO, SSRF, OPEN_REDIRECT, XSS_RAW_HTML, XXE,
CERT_VALIDATION_DISABLED, JWT_VALIDATION_DISABLED, INSECURE_RANDOM, CORS_PERMISSIVE, LDAP_INJ,
XPATH_INJ, REGEX_INJECTION, INSECURE_COOKIE, LOG_SENSITIVE_DATA, JWT_HTTPS_METADATA_DISABLED,
EXCEPTION_DETAILS_IN_RESPONSE, PAID_API_UNBOUNDED; quality adds SELF_RECURSION
(ENDPOINT_NO_AUTH is reported as low: many apps expose public endpoints without [AllowAnonymous].)
debug (low): DEBUG_CONSOLE_OUTPUT, SECURITY_BYPASS_TODO, TEST_STUB_LEAK
quality (low): ASYNC_NO_TRY_CATCH, EMPTY_CATCH_BLOCK, OVERLONG_METHOD (80 lines / 15 branches),
OVERLONG_FILE (500 lines), SELF_RECURSION
practices (low): ASYNC_VOID, SYNC_OVER_ASYNC, THREAD_SLEEP_IN_ASYNC, LOG_INTERPOLATION,
HTTPCLIENT_PER_CALL, THROW_EX_RESETS_STACK, STRING_CONCAT_IN_LOOP, DISPOSABLE_NOT_DISPOSED,
COUNT_INSTEAD_OF_ANY, GC_COLLECT, FIRE_AND_FORGET_TASK, DEV_EXCEPTION_PAGE_UNGUARDED, SYNC_IO_IN_HANDLER
Razor views (.cshtml, .razor): XSS_RAW_HTML for Html.Raw / MarkupString, plus IMG_NO_ALT,
CLICK_NO_KEYBOARD, SCRIPT_NO_SRI.
Config files (appsettings*.json, web.config, app.config): HARDCODED_SECRET.
Full reference (what is flagged, what is not, how to fix): docs/rules/csharp.md
Repo-level helper checks
A full scan with --focus quality (any language) also looks across files: DUPLICATE_HELPER (copy-pasted
function bodies), UNUSED_HELPER (helpers nothing calls), HELPER_GRAB_BAG (utils/helpers files with more
than 15 functions) and REINVENTED_STDLIB (hand-written deepClone, IsNullOrEmpty...). They are low and
never run in the hooks or with --diff. Every language implements the same base set:
docs/rules/baseline.md.
Example
$ vetgate Controllers/ToolsController.cs --format text
Controllers/ToolsController.cs:19: [HIGH] CMD_INJ (deterministic, 1.0)
source: request parameter 'tool' ([FromQuery])
guard : no allowlist / argument escaping before process start
sink : process execution (executable: tool)
reason: Request-controlled text becomes part of the executable or its command line; ...
Coding-agent integration
- Post-edit hook (Claude Code): the
vetgate-hookcommand runs as aPostToolUsehook onEdit|Write. It reports medium+ findings anywhere in the edited file and low findings only on lines changed vs gitHEAD, so legacy noise does not flood the context. It says nothing when the file is clean and never blocks the edit.{ "hooks": { "PostToolUse": [ { "matcher": "Edit|Write|MultiEdit", "hooks": [ { "type": "command", "command": "vetgate-hook", "timeout": 30 } ] } ] } }
- git pre-commit hook:
hooks/pre_commit.pychecks the staged files, blocks the commit on medium+ findings and lists low ones without blocking (skip once withgit commit --no-verify). Add to.git/hooks/pre-commit:python /path/to/vetgate/hooks/pre_commit.py || exit 1
- Skill: SKILL.md tells an agent when to run the vetgate and how to act on the results.
Feedback and data
- Report a false positive or a missed issue:
vetgate report Path/File.cs:42(add--kind missed-issue,--opento open the browser). It prints the prefilled issue so you can review or trim the snippet; nothing is sent automatically. - Local case log: the post-edit hook appends each finding it reports to
~/.vetgate/findings.jsonl(local only;VETGATE_NO_LOG=1disables it,VETGATE_HOMEmoves it).vetgate feedbacklabels cases as fixed (likely true positive) or suppressed (likely false positive), andvetgate feedback --export cases.jsonlwrites them as a dataset for training a learned second layer.
Development
python -m unittest discover -s tests # fixtures + core tests
python run_fixtures.py # fixtures + false-positive check on real codebases
Each rule has a fixture in fixtures/<lang>/ with a FIXTURE-RULES: ... header and an EXPECT: RULE marker on
every line that must be flagged. Vulnerable and safe cases sit side by side, and the reported set must match
exactly. Real-codebase false-positive targets come from --fp-target, $VETGATE_FP_TARGETS or a gitignored
vetgate.local.json ({"fp_targets": ["..."]}). They must give 0 medium+ findings.
New rule: fixture first, then the rule, then run_fixtures.py must be all green.
New language: add vetgate/languages/<lang>/ exposing NAME, EXTENSIONS, FOCUSES, is_test_file,
analyze(path, source, focuses, options) and register it in vetgate/languages/__init__.py.
vetvetgate/cli.py, core.py CLI, finding schema, suppressions, diff mode, json/text/compact/sarif
vetvetgate/languages/csharp/ common (parser + taint), security, security_web, debug, quality, practices
fixtures/ regression fixtures per language
hooks/post_edit_gate.py Claude Code post-edit hook
Metadata
Release files for vetgate 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vetgate-0.5.4.tar.gz | 97.3 kB | With provenance | Details for vetgate-0.5.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vetgate-0.5.4-py3-none-any.whl | Python 3 | none | any | Details for vetgate-0.5.4-py3-none-any.whl |
Total release size: 204.1 kB
Release files / vetgate-0.5.4.tar.gz
| Download URL | vetgate-0.5.4.tar.gz |
|---|---|
| Size | 97.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bfe1f868481d8d2426d4a91e3dd3ee5f055448cd3eca59e6512c016585fd48b
|
|
BLAKE2b-256 checksum How to use checksums |
9d96e3bfd50817635cfbb7aff47de63f6a0279d9a7d61e9a46a2b1c9772c8e47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / vetgate-0.5.4-py3-none-any.whl
| Download URL | vetgate-0.5.4-py3-none-any.whl |
|---|---|
| Size | 106.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83310e7b957591377bb15f32c234818e39cc7ffcc544ba7b77e7220312758f37
|
|
BLAKE2b-256 checksum How to use checksums |
4ea58d9e8527639025e3346ba0cc23548e9a8a89eca5fbac9b23b652582ada36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for vetgate 0.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vetgate-0.5.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.