@shomra/agent 0.2.12 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -4
- package/package.json +2 -2
- package/shomra.mjs +394 -166
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @shomra/agent
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
agent and CI and blocks dangerous tool-calls, shell commands and
|
|
5
|
-
exfiltration *before they run* — on your machine, even offline.
|
|
3
|
+
**Adversarial assurance for AI agents**, as a local-first CLI. It sits inside
|
|
4
|
+
your coding agent and CI and blocks dangerous tool-calls, shell commands and
|
|
5
|
+
data exfiltration *before they run* — on your machine, even offline. Enrolled,
|
|
6
|
+
it also attacks your org’s own guardrails (`shomra admin redteam`) and turns
|
|
7
|
+
each breach into a false-positive-gated control (`shomra harden`). It also vets AI
|
|
6
8
|
artifacts (MCP configs, Skills, slash commands, hooks, rules files) before they
|
|
7
9
|
install. Start with a free on-machine scan — no signup.
|
|
8
10
|
|
|
@@ -74,7 +76,14 @@ install-lure prose) runs on-machine, so you get a genuine verdict even if the
|
|
|
74
76
|
backend is unreachable. When enrolled + reachable, your **org policy** is layered
|
|
75
77
|
on top.
|
|
76
78
|
|
|
77
|
-
**Exit codes
|
|
79
|
+
**Exit codes** (one convention across every command):
|
|
80
|
+
|
|
81
|
+
| Code | Meaning |
|
|
82
|
+
|------|---------|
|
|
83
|
+
| `0` | clean / pass |
|
|
84
|
+
| `1` | hard fail — BLOCK, vulnerable model, secret found, FAIL verdict, below `--min`, regression (also `--strict` + backend outage) |
|
|
85
|
+
| `2` | soft fail — FLAG under `--strict` (REVIEW when strict) |
|
|
86
|
+
| `3` | usage / config error — not configured, bad flags, unknown command |
|
|
78
87
|
|
|
79
88
|
**Backend outage:** by default it falls back to the on-machine verdict (org
|
|
80
89
|
policy not applied). `--strict` fails closed (exit 1) because org policy can't be
|
|
@@ -153,6 +162,9 @@ runs local-first; with a key, your **org policy** (below) drives the verdict.
|
|
|
153
162
|
with: { sarif_file: shomra.sarif }
|
|
154
163
|
```
|
|
155
164
|
|
|
165
|
+
`shomra pr` accepts it too: bare `--sarif` writes SARIF to stdout,
|
|
166
|
+
`--sarif=shomra.sarif` writes a file alongside the normal check-run output.
|
|
167
|
+
|
|
156
168
|
### Org policy + triage on top of CI
|
|
157
169
|
|
|
158
170
|
When enrolled, the same **org policy** that governs the dashboard decides the CI
|
|
@@ -206,6 +218,36 @@ backend, behind a short timeout + circuit breaker — so a slow or down backend
|
|
|
206
218
|
never freezes the agent. Fail-open by default; `SHOMRA_GUARD_STRICT=1` fails
|
|
207
219
|
closed on the server tier.
|
|
208
220
|
|
|
221
|
+
## Adopting Shomra on an existing repo
|
|
222
|
+
|
|
223
|
+
A brand-new gate on a repo with history will flag things. Three layers make
|
|
224
|
+
adoption friction-free — all of them re-grade the artifact, so a fully
|
|
225
|
+
suppressed file drops to ALLOW and never fails the build:
|
|
226
|
+
|
|
227
|
+
- **`shomra baseline`** records every current finding (line-independent
|
|
228
|
+
fingerprints) in `.shomra/baseline.json` — commit it so the whole team shares
|
|
229
|
+
it. From then on only findings introduced *after* the baseline fail; re-run it
|
|
230
|
+
to refresh after cleanups. Skip it per-run with `--no-baseline`.
|
|
231
|
+
- **`.shomraignore`** — a repo file of `path/glob` lines (skip the file) or
|
|
232
|
+
`path/glob :: title-substring` lines (skip one finding class in those files).
|
|
233
|
+
The runtime firewall honors it too, so test fixtures and detection source
|
|
234
|
+
aren't withheld. Silence a single finding inline with `// shomra-ignore` (or
|
|
235
|
+
`# shomra-ignore`) on the finding's line or the line above, or opt a whole
|
|
236
|
+
file out with `shomra-ignore-file` in its first lines (works in JSON as a
|
|
237
|
+
`"_shomra": "shomra-ignore-file"` key). `--no-suppress` ignores all of this.
|
|
238
|
+
- **`.shomra/policy.yml`** — policy-as-code, reviewed in PRs like any code:
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
block: high # min severity that BLOCKS (critical|high|medium|low|none)
|
|
242
|
+
flag: medium # min severity that FLAGS
|
|
243
|
+
allow: # finding-title substrings to always downgrade away
|
|
244
|
+
- "IPv4 address"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
For a local verdict the repo policy fully re-grades; when the backend
|
|
248
|
+
returned an org decision it can only make it *stricter* (worst-wins) — repo
|
|
249
|
+
config never loosens org enforcement. `--no-policy` skips it.
|
|
250
|
+
|
|
209
251
|
## Environment variables
|
|
210
252
|
|
|
211
253
|
| Var | Purpose |
|
|
@@ -214,9 +256,17 @@ closed on the server tier.
|
|
|
214
256
|
| `SHOMRA_URL` | Backend URL (overrides config) |
|
|
215
257
|
| `SHOMRA_API_TIMEOUT_MS` | Per-request backend timeout (default 30000) |
|
|
216
258
|
| `SHOMRA_AGENT` | Agent-identity handle presented to `llm-proxy` + firewall |
|
|
259
|
+
| `SHOMRA_GATE_CONCURRENCY` | Parallel backend calls in batch gate / model lookups (default 8, 1–32) |
|
|
260
|
+
| `SHOMRA_GH_TOKEN` | GitHub token for `shomra pr` (falls back to `GITHUB_TOKEN`) |
|
|
217
261
|
| `SHOMRA_GUARD_STRICT` | `1` = firewall fails closed on the server tier |
|
|
218
262
|
| `SHOMRA_GUARD_LOCAL` | `0` = disable the on-machine Tier-0 guard |
|
|
263
|
+
| `SHOMRA_GUARD_IGNORE` | Comma-separated file globs the runtime guard treats as known-safe (adds to `.shomraignore`) |
|
|
264
|
+
| `SHOMRA_GUARD_ALWAYS_ESCALATE` | `1` = send every call to the server (full telemetry, higher overhead) |
|
|
219
265
|
| `SHOMRA_GUARD_TIMEOUT_MS` | Firewall per-call server timeout (default 2000) |
|
|
220
266
|
| `SHOMRA_GUARD_BREAKER_MS` | Skip the server this long after a failure (default 30000; `0` disables) |
|
|
267
|
+
| `SHOMRA_LLM_PROXY_BASE` | Proxy base URL `install-hook` writes for Aider (default `http://127.0.0.1:4141/openai/v1`) |
|
|
268
|
+
| `SHOMRA_MODEL_GUARD` | `0` = disable the model-load screen in the PreToolUse hook |
|
|
269
|
+
| `SHOMRA_MODEL_CACHE` | `0` = disable the on-machine model-index verdict cache |
|
|
270
|
+
| `SHOMRA_MODEL_CACHE_TTL_MS` | Model-cache freshness window (default 7 days) |
|
|
221
271
|
|
|
222
272
|
Run `shomra help` for the full command reference.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shomra/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shomra — a local-first
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Shomra — adversarial assurance for AI agents, as a local-first CLI. Blocks dangerous tool-calls before they run, attacks your own guardrails to prove they hold, and gates AI artifacts in your editor and CI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"shomra": "./shomra.mjs"
|