@vivelytech/astward
v1.2.0
Published
The local security sidecar that watches what your AI agent reads and writes. Catches leaked secrets, vulnerable dependencies, and risky code before they ship. Fully local. No cloud. No accounts.
Maintainers
Readme
Astward runs alongside Claude Code, Cursor, Codex, or any AI coding agent and catches the high-frequency, costly mistakes before they ship — leaked secrets, vulnerable dependencies, risky code patterns. Fully local. No cloud. No accounts. No GPU.
One-sentence pitch: Astward is the only security tool that watches what your AI agent reads and writes — locally, in real time, with zero data leaving your machine.
Why this exists
AI coding agents are great at writing code. They're also great at quietly shipping your AWS keys to a model host, pasting database URLs into chat, and committing secrets because "it looked like a config value." Astward sits in the gap between save and ship — catching the mistakes that don't show up in your tests.
It's not a replacement for a real security review. It's the seatbelt you wear while vibe-coding at 2am.
What it does
- Scan — find secrets, vulnerable dependencies, and risky code patterns across 12+ languages.
- Clone-and-own attack detection (new in v1.2) — flags the delivery structure behind the 0DIN attack on AI coding agents: setup/init scripts that fetch code from the network or a DNS TXT record and pipe it straight into a shell. Catches
curl|bash,dig … TXT | base64 -d | bash, PowerShellIEX(DownloadString),evalof fetched content, and process-substitution variants — then tells your agent, inASTWARD-SECRETS.md, not to run them. It flags the dangerous pattern; it does not (and cannot) decode the remote payload — nothing can. - Live watcher — scans each file the moment you save it. Issues surface in your dashboard before you switch windows.
- Commit gate — blocks commits containing secrets. Runs locally; each contributor enables it once with
astward install-hooks. - Pre-emptive leak protection — writes a
ASTWARD-SECRETS.mdwarning file that AI agents read, telling them which files contain real secrets and to refuse to read or transmit them. Plus aquarantinecommand that moves hardcoded secrets into a gitignored.envand replaces them withprocess.env.*/os.environ[...]references. - Shield mode (power-user feature) — local proxy that inspects and auto-redacts secrets in agent traffic it can see in plaintext (explicit-proxy / API-key agents where you control the base URL). For HTTPS tunnels it logs and can block destination hosts — it does not decrypt TLS.
- LLM proxy — for API-key agents, inspects prompts/responses for data leaks and prompt-injection. Auto-detects the provider.
- Dashboard — a bright local web view of all activity (localhost only, token-authenticated by default).
- Reports — export a standalone HTML audit report anytime. SARIF output drops straight into GitHub Advanced Security.
Install
Prerequisites
- Node.js 18 or later
Install (recommended)
npm install -g @vivelytech/astwardThe CLI binary is just astward (no scope prefix):
astward --help
astward scan
astward goInstall from source (if you cloned the repo)
cd astward
npm install -g .That makes the astward command available globally.
Quick start
cd your-project
astward start # friendly setup wizard (asks your run preference)
astward go # start watcher + dashboard together (one command)
astward install-hooks # block commits that contain secrets
astward scan # one-off full scan
astward export # save an HTML audit reportHow it watches your agent
Astward works whether your agent uses encrypted subscription auth or an API key. Different layers fire depending on which kind of agent you use.
For every agent (subscription or API key)
These protections work for all AI coding agents, including Claude Code login, Cursor login, GitHub Copilot subscription, etc.
- Live file watcher — every file you save is scanned. If a secret lands in source, it shows up in your dashboard before your agent even reads it.
- Commit gate —
astward install-hooksblocks any commit containing a secret. The secret never reaches your repo. - Agent warning file — after every scan, Astward writes
ASTWARD-SECRETS.mdlisting files that contain real secrets, with an explicit instruction to AI agents not to read or transmit them. Agents that read your project files (Claude Code, Cursor, etc.) see this and steer clear. - Quarantine —
astward quarantine(dry-run by default) previews hardcoded secrets that can be auto-moved out of source into a gitignored.env, replacing them withos.environ[...]/process.env.*references. Runastward quarantine --applyto write the changes (a diff is shown first, and you confirm before any file is touched). - Clone-and-own attack detection — every scan also flags scripts that
fetch and execute remote code without review (the 0DIN attack chain). When
found,
ASTWARD-SECRETS.mdgains a "DO NOT RUN THESE COMMANDS" section naming the exact file and line, so an agent that reads the repo is told to stop before it "helpfully" runs a poisoned setup step.
This is the root-cause fix: secrets never sit in a plaintext file an agent could read or transmit in the first place.
For API-key-based agents (extra protection)
If you use an API-key-based agent (e.g. claude-code with ANTHROPIC_API_KEY
set, or any agent where you control the base URL), Astward's shield mode
adds an extra layer: it intercepts outbound traffic and auto-redacts secrets
in flight.
astward shield claude-codeThat's it. Astward:
- Starts the transparent proxy on
localhost:8788 - Sets
HTTP_PROXY+HTTPS_PROXYenv vars automatically - Launches your agent with those env vars
- When your agent exits, the proxy stops too
MCP Guard — the firewall for AI tool-use
AI agents increasingly act through MCP servers (filesystem, GitHub, database, etc.). Every tool call — read_file, run_sql, delete_*, send_email — currently runs unguarded. Astward Guard is a local security checkpoint that sits in front of your MCP servers and inspects every call.
astward guard # auto-discovers your MCP servers, asks, then protects them
astward guard --list # just show what was found
astward unguard # restore everything to originalGuard reads the same config files your agents use (Claude Desktop, Claude Code, Cursor, Windsurf, Codex), so it finds your MCP servers automatically — no manual setup. For each one it:
- Redacts secrets in outbound tool-call arguments before the tool sees them (using the same scan engine as
astward scan). - Blocks dangerous calls by policy — access to
~/.ssh,~/.aws,.env, or destructive tools likedelete_*/drop_*. - Scans tool responses for prompt-injection before they re-enter the model's context.
- Logs every call locally and shows it in the dashboard's MCP Activity tab.
It's fully reversible — original configs are backed up and astward unguard restores them exactly. Everything runs on localhost; nothing leaves your machine.
Policy lives in .astwardrc.json:
{
"guard": {
"mode": "block",
"blockPaths": ["~/.ssh", "~/.aws", "**/.env"],
"blockTools": ["delete_", "drop_", "exec"],
"redactSecrets": true,
"scanInjection": true
}
}The clone-and-own attack (and Astward's honest scope on it)
In June 2026, Mozilla's 0DIN team demonstrated an attack where a completely
clean-looking repository takes over a developer's machine through an AI coding
agent — without a single line of malicious code in the repo. The chain: a
package that fails with a helpful error, an init/setup command the agent runs
to "fix" it, and a script that pulls its real payload from a DNS TXT record
and pipes it to bash. Because the payload is fetched at runtime, it's invisible
to static scanners, human review, and the agent itself. The agent never decides
to open a reverse shell — it decides to fix an error. It affects any agentic
tool that follows setup flows: Claude Code, Cursor, Gemini CLI, and others.
What Astward does about it (real): it flags the delivery structure —
network-or-DNS-fetch piped into a shell/interpreter, base64-decode piped to a
shell, eval of fetched content, PowerShell IEX(DownloadString) — in any file
the agent might read or run, and writes an explicit "do not run this" warning in
ASTWARD-SECRETS.md, the channel agents actually respect.
What Astward does NOT claim (honest):
- It cannot decode the remote/DNS payload — that's invisible by design. Anyone claiming to is lying. Astward flags the pattern, not the payload.
- It cannot stop an agent from deciding to run a command. It can only make the danger visible before the command runs.
- A determined attacker can obfuscate past the regexes (split the interpreter name, encode the pipe). This is risk reduction, not a guarantee — the same honest framing as the rest of Astward.
To keep researchers' and security-tooling repos quiet, matches inside string
literals, comments, and prose (in .js, .py, .md, etc.) are down-weighted;
matches in actual scripts (.sh, Dockerfiles, CI YAML) fire at full strength.
Tune or disable any rule via ruleOverrides in .astwardrc.json.
Astward cannot MITM TLS on encrypted, certificate-pinned agent connections. Subscription-based agents (Claude Code login, Cursor login, GitHub Copilot) use their own encrypted connections that bypass system proxies — and Astward is honest about this. For those agents, the file watcher + commit gate + quarantine are your primary protection.
For API-key agents where you control the base URL, shield mode additionally intercepts outbound traffic. Astward addresses the root cause of accidental leaks (secrets in plaintext files) instead of trying to break encrypted traffic — which is the more reliable defense anyway.
All the ways to use shield
# Auto-launch your agent (proxy env vars set automatically)
astward shield claude-code
astward shield cursor .
astward shield -- npx @anthropic-ai/claude-code
# Custom port + agent
astward shield 9999 claude-code
# Proxy only (no agent) — prints export instructions
astward shieldManual setup (if you prefer two terminals)
# Terminal 1 — start the shield
astward shield
# Terminal 2 — set env vars yourself
export HTTP_PROXY=http://localhost:8788
export HTTPS_PROXY=http://localhost:8788
claude-codeWhat shield mode does
- Routes outbound traffic from any process that uses the proxy env vars
- Plain-HTTP and explicit-proxy requests: full content inspection. Outbound prompts are scanned for secrets, API keys, passwords, tokens, database URLs, and private keys; inbound responses are scanned for prompt-injection patterns
- HTTPS (CONNECT) tunnels: hostname visibility only. Astward logs every destination host and can block untrusted ones — it does not decrypt TLS, so tunneled content is not scanned. This is by design: no MITM certificate, nothing to trust
- Auto-detects LLM providers — Anthropic, OpenAI, Google, Mistral, Groq, Cohere, Together, DeepSeek, and more
- In "redact" mode (default): strips secrets from inspectable requests before they leave your machine
- In "block" mode: kills inspectable requests entirely if secrets are found
- Logs everything to the dashboard for review
Where full protection comes from regardless of encryption: the file watcher, commit gate, quarantine, and
ASTWARD-SECRETS.mdagent warning all work at the file layer — before traffic exists at all. That layer covers every agent, subscription or API-key, and is the primary defense.
Proxy modes
| Mode | What happens when a secret is found |
|------|-------------------------------------|
| redact | Secret is replaced with [REDACTED] and the request continues |
| block | Request is killed — 403 returned to the agent |
| warn | Request passes through, but you get a warning |
Set the mode in .astwardrc.json:
{ "proxy": { "mode": "redact" } }One command to run everything: astward go
The setup wizard asks how you want it to run, and astward go remembers it:
- Background — runs quietly with no terminal window to keep open. Stop it
anytime with
astward stop, check it withastward status. - Terminal — runs the watcher + dashboard in one window so you can watch the live output. Press Ctrl+C to stop.
You can still run pieces individually (astward watch, astward dashboard)
if you prefer. Type astward with no command anytime to see the dashboard URL
or how to start it.
Configuration
Edit .astwardrc.json in your project, or use the dashboard's Settings tab.
{
"mode": "warn",
"scanners": {
"secrets": "block",
"vulns": "warn",
"code": "warn",
"minConfidence": 0.3
},
"allow": [
"AKIAIOSFODNN7EXAMPLE",
"example.com",
{ "pattern": "^test-", "flags": "i" }
],
"ruleOverrides": {
"heroku-key": { "enabled": false },
"jwt": { "confidence": 0.4 }
},
"ignore": [
{ "rule": "generic-secret-assignment", "path": "tests/**" }
],
"customRules": [
{
"name": "company-api-key",
"pattern": "COMPANY-KEY-[A-Za-z0-9]{20}",
"description": "Internal Company API key",
"confidence": 0.9,
"severity": "high"
}
],
"dashboard": { "enabled": true, "port": 7070, "auth": "token", "token": "" },
"proxy": { "enabled": false, "port": 8788, "mode": "redact" }
}mode:off|warn|block— global ceilingscanners.{secrets,vulns,code}: per-scanner level (authoritative —secrets: "block"always blocks)scanners.minConfidence: 0–1, findings below this confidence are dropped. Default0.3. UUIDs and other low-confidence patterns score below this; raise to0.5for quieter output, lower to0to see everything.allow: literal strings or{ pattern, flags? }regexes. Any finding whose matched value contains an allow-listed entry is dropped silently. Use for example keys (AKIAIOSFODNN7EXAMPLE), test fixtures, and known-safe values.ruleOverrides: per-rule tuning.{ "rule-name": { enabled, severity, confidence, description } }. Disable noisy built-ins, raise/lower confidence on individual rules, or rename them.ignore: silence a rule, a path, or both.customRules: add your own regex patterns for company-specific secrets. Each rule can takeseverity(critical|high|medium|low) andconfidence(0–1).dashboard.auth:"token"(default, recommended) or"off". Auth is on by default — the dashboard serves redacted snippets + file paths and would otherwise be readable by any local process. Set to"off"only if you understand the risk.dashboard.token: set a token to require auth, leave empty for auto-generated.
Testing your custom rules
Add a custom rule and want to verify it actually fires? Don't test against
real secrets. Use astward test-rules with fixture files instead.
Fixture format
Any text file. Lines starting with # expect: declare which rules SHOULD fire
on the next non-comment line. # no expect declares a line that should NOT
fire any rule.
Example fixture (fixtures/company-keys.txt):
# expect: company-api-key
company_key = "COMPANY-KEY-abcdefghijklmnopqrst"
# expect: aws-access-key
AWS_KEY = "AKIAIOSFODNN7EXAMPLE"
# no expect — clearly safe
const greeting = "hello world"
# no expect — plain number, not a secret shape
const port = 8080Note:
test-rulesignoresallowand forcesminConfidence: 0(see below), so even very low-confidence built-ins (like the UUID-shapedheroku-keyrule) will fire here even though they'd be silenced in a normalastward scan. Keep fixture lines unambiguous — e.g. don't reuse a variable name likeapi_keyfor a custom-rule test, since it will also match the built-ingeneric-secret-assignmentrule and fire twice.
Run it
astward test-rules fixtures/Output:
Astward test-rules — 1 fixture file(s)
Config: 1 custom rule(s), 0 override(s), minConfidence=0.3
fixtures/company-keys.txt
✓ line 2 expected: company-api-key fired: company-api-key
✓ line 5 expected: aws-access-key fired: aws-access-key
✓ line 8 expected: (no findings) fired: —
✓ line 11 expected: (no findings) fired: —
✓ 4/4 expectations passedExit code is 1 if any expectation fails — perfect for CI. test-rules
respects your ruleOverrides (so disabling a rule in config makes the
corresponding # expect: fail), but ignores allow and sets
minConfidence: 0 so you can see everything.
Inline suppression
Add a comment on any line to silence a finding:
api_key = "test-key-123" # astward:ignoreSuppress a specific rule only:
password = "hunter2" # astward:ignore generic-secret-assignmentWorks in any language — Astward just looks for astward:ignore in the line text.
⚠ Limitations of inline suppression
- Does not survive minification or transpilation. If your bundler strips comments (most do — webpack, esbuild, SWC, Vite in production mode, Babel with
comments: false), the suppression disappears and the finding will fire again on the minified output. Astward scans source files only, so this is rarely a problem in practice, but if you scan build output, suppressions won't carry over. - Does not survive compile steps. TypeScript → JavaScript, Python →
.pyc, Sass → CSS: the comment may be dropped during compilation. - Works at the line level only. You can't suppress a whole file or block with one comment — add the comment to each line that fires.
- For build artifacts, use
ignorein config instead.{ "ignore": [{ "path": "dist/**" }] }is more reliable for generated code.
Tool selection
astward setup # list tools and what's enabled
astward enable <tool> # watch / proxy / dashboard / alerts / hooks
astward disable <tool>Optional: deeper scanning
If semgrep (multi-language SAST) and a dependency auditor (npm audit,
pip-audit) are installed on the machine, Astward uses them automatically. If
not, the built-in secret scanner, watcher, commit gate, and dashboard still work
on their own.
CI / CD integration
SARIF — drop straight into GitHub Advanced Security
astward scan --sarif > astward-results.sarif# .github/workflows/astward.yml
name: Astward security scan
on: [push, pull_request]
jobs:
astward:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '18' }
- run: npm install -g @vivelytech/astward
- name: Astward scan
run: astward scan --sarif > astward-results.sarif
continue-on-error: true
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: astward-results.sarifJSON output (any CI)
# Machine-readable JSON (for scripts and CI pipelines)
astward scan --ci
# Only scan changed files (for PR checks)
astward scan --diff
# Strict mode — fail on warnings too, not just blocked secrets
astward scan --strict --ci
# Exit code is 1 if any finding is blocked, 0 otherwise
# — perfect for CI gatesOther CI platforms
Run astward generate-ci for an interactive wizard that produces ready-to-use
config files for GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Bitbucket
Pipelines, Jenkins, or a generic shell script. Supports CI-only or CI+CD modes,
optional Docker/Trivy scanning, and strict-mode gates.
Pre-emptive leak protection
The real defense against accidentally leaking secrets to an AI agent isn't intercepting encrypted traffic — it's making sure secrets never sit in a plaintext file an agent could read. Astward does this locally:
- Agent warning file — after every scan, Astward writes
ASTWARD-SECRETS.mdlisting files that contain real secrets, with an explicit instruction to AI agents not to read or transmit them. Agents that read your project files (Claude Code, Cursor, etc.) see this and steer clear. astward quarantine— previews secrets it can move out of source code into a gitignored.env, replacing them withos.environ[...]/process.env.*references. Dry-run by default. Runastward quarantine --applyto apply — a unified diff is shown first, and you confirm before any file is touched. (Conservative: only rewrites clearNAME = "value"assignments; review the diff and paste real values into.env.)- Commit gate —
astward install-hooksblocks any commit containing a secret, so it can't reach your repo in the first place.
Custom command alias
astward alias aw # now you can type `aw scan`, `aw go`, etc.Honest note on agent traffic
Astward cannot read the encrypted content an AI agent sends to its servers (that would require MITM TLS interception, which breaks certificate-pinned agents and is invasive). It protects you by keeping secrets out of readable files and warning agents away — which addresses the root cause of accidental leaks, not the transmission.
Uninstall
astward uninstall # shows a final report, removes project files
npm uninstall -g @vivelytech/astward # removes the commandRoadmap
Astward is intentionally focused. The roadmap is short on purpose — better to ship two things that work than six that half-work.
v2.0 — Runtime Guard
MCP Guard graduates from inspect-and-warn to enforce: allow/ask/deny policies per tool call, agent pre-tool-use hooks, and a local audit log. The detection layer becomes an enforcement layer — still local, still free.
v2.1 — Cloudflare security pack
Wrangler misconfig scanning, Shadow MCP detection, and a GitHub Action on the Marketplace.
Later — VS Code extension / LSP
Inline findings as you type (VS Code) and real-time diagnostics for any
LSP-speaking editor (Neovim, JetBrains, Zed, Emacs, Sublime), both built on
the existing astward hook <file> command — no new scanner logic, just UI
shells around what's already there.
Explicitly NOT on the roadmap (yet)
These were on the original roadmap but cut for focus:
- MITM TLS interception — invasive, breaks cert-pinned agents, and the file-watcher + quarantine approach addresses the root cause better.
- Team mode — until there's a clear demand signal, teams can share a
.astwardrc.jsonchecked into git and a per-repo SARIF upload. - ML false-positive reduction — the new confidence scoring + allow-list + ruleOverrides system should reduce noise by 80% without ML. Revisit if it doesn't.
- Agent sandboxing — useful but a separate product, not a feature.
- Automatic secret rotation — high-risk automation that belongs in a dedicated secrets manager, not a sidecar CLI.
Honest scope
Astward stops high-frequency, costly mistakes — leaked keys, secrets sent to a model, dangerous commands, known-vulnerable dependencies. It does not replace a security review or catch every logic flaw. The shield mode requires either the agent to respect proxy env vars or the user to configure the base URL. For subscription-based agents, the file watcher + commit gate + quarantine are your primary protection.
License
MIT License — Copyright (c) 2026 Vively Technology Solutions Private Limited. See LICENSE for the full text. Install from source, audit the code, modify freely.
