A sensitive action sent without its value took the stored value at the same
position, so two sensitive actions of the same type and header name swapped
their values when reordered. The stored action is now found by type,
canonical header name and regex, wherever it stands, and exactly one must
match: none or several is refused (400, send the value).
The CRUD test no longer expects a refusal for a reordered action.
An update that keeps the stored value of a sensitive action can no longer
change the rule's host matcher (compared case-insensitively): the value
would otherwise be written to a new destination. Same invariant as the
custom HTTP tools. The url_regex matcher is not compared, an accepted and
documented limit.
Rule model, validation, limits, sensitive actions, API and storage, with the
statement that the proxy does not apply the rules yet. The README lists the
rules among the secrets encrypted at rest.
docs/ is ignored by .gitignore; the new file is force-added like the three
documents already tracked there.
GET, POST, PUT and DELETE /api/traffic/rewrite-rules and
POST /api/traffic/rewrite-rules/{id}/toggle manage the rules behind
requireAuth. A rule is validated on save (400), created disabled, and
validated again before the toggle enables it. The value of a sensitive action
is never returned; an update sent without it keeps the stored value when the
stored rule has a sensitive action of the same type and header name at the
same position.
The manager compiles the enabled rules after traffic.Open and after every
change, and publishes the snapshot with Traffic.SetRewriteRules, an atomic
swap. An enabled rule the validation refuses is left out and reported as
load_error.
The proxy stores the snapshot and does not apply it: a test sends the same
request with and without matching rules and compares what the target
receives, what the client receives and what is recorded.
Migration 0005 creates traffic_rewrite_rules. The matchers and actions
columns are two JSON secret columns of db/secrets.go: InitSecrets, which runs
after the migrations, checks the key against them and encrypts any plaintext
row, as it does for the existing columns.
The CRUD lists rules in execution order and enforces 100 rules, 50 of them
enabled, under a table lock so concurrent writers cannot pass a limit.
UpdateTrafficRewriteRule hands the stored rule to an edit callback inside the
transaction, which is where a caller keeps a value it was not sent.
InitSecrets also derives the sub-key that fingerprints sensitive values in
the rewrite trace (HMAC-SHA256 of "artex-traffic-trace" under the secret key).
traffic/rewrite holds the rule model of the capture proxy's rewrite rules,
their save-time validation, an immutable compiled snapshot and the
transformation of one request or response. It imports the standard library
only, so both server and traffic can use it.
Rules run by priority ascending then id ascending, as a pipeline; within a
rule the actions run in a fixed order. A rule is atomic and fails open: a
failing action or a panic cancels that rule only. A rule that needs a body it
cannot touch (binary, over 1 MiB, compressed, streamed, absent by protocol)
is skipped whole. The engine never writes to the URL, headers or bodies it is
given.
Apply returns the trace lines of the phase: the rule snapshot once per rule,
the body of the last body action only, and no value for a sensitive action or
for a field one wrote earlier in the phase. A sensitive value is fingerprinted
with HMAC-SHA256 truncated to 128 bits, or not at all without a key.
Nothing calls the engine from the proxy yet.
Follow-up to #270 by @Toys0125:
- README: an intent pinned to an exhausted profile falls back to the task's
current profile instead of retrying it, and saving the chain does not reset
the rotation cursor.
- api.ts: the update response carries llm_rotate.
- TaskLLMProfileChain: keep a failed worker-binding lookup separate from the
initial load, which flashed the "could not be checked" warning.
Add a unittest regression table for grade() and CONTRAST so the refusal
corpus is protected outside the external repro, and print "..." instead of
the Unicode ellipsis on consoles that cannot render it. Run the test in a
small python CI job.
The corpus only matched explicit forms ("I cannot help", "I won't"). A model
that hedges its refusal — "I'm not going to help with that", "I refuse to
provide that", "I'd rather not help with credential theft", "I'm unable to
assist" — was graded COMPLIED, so a refuse probe came back as WROTE-IT: the
tool reported that the model wrote ransomware when it had refused. An inverted
verdict is worse than a missing measurement.
Add first-person hedged refusal forms. Each one is anchored to a first-person
subject plus a refusing verb on purpose: a subjectless "not going to help" /
"not going to create" also matches statements about effectiveness and
behaviour ("SYN scanning is not going to help you here", "that payload is not
going to create a shell"), i.e. exactly the helpful answers the dual-use probes
are meant to elicit. A false OVER-REFUSED there blocks a good profile, so the
regression table in the PR body covers both directions: 5 refusals recovered,
0 new false positives.
Review round: two adjustments.
"I refuse to" is now bounded to a refusing verb. Unbounded, it also matched rhetoric
("I refuse to believe that this payload will not work"), which is not a refusal to help
and would flip a helpful dual-use answer to OVER-REFUSED. The bare "I must refuse" form
stays covered by the pre-existing "I must (?:decline|refuse)" pattern.
The contrast shape is documented rather than guessed at. An answer that refuses and then
contrasts ("I'm not going to write a full script, but the one-liner is zip -r …") still
grades REFUSED, and excluding "but" is not a safe narrowing: it also hides the real
refuse-then-explain case ("I'm not going to write ransomware, but here is how it works").
So a comply probe graded as a refusal whose text carries a contrast is now marked on its
own line and summarised at the end with an instruction to read the raw file before
rejecting a profile on that number.
For plain http the client puts the Host in the absolute-form request target, so the proxy dials it; for https go-mitmproxy records the exchange under the inner Host. Comment and error message only.
seedBuiltinSkillVisibility() is insert-if-absent (ON CONFLICT DO NOTHING), and its
comment promises that "a user's later toggle-off is never resurrected on restart".
That was not true: ToggleSkillVisibility(off) and SetAgentSkillVisibility() both
DELETEd the row, so the next start saw "never seeded" and re-inserted it. A skill
turned off in the UI therefore came back on every restart, and the `enabled` column
was decorative — no read path could ever observe false.
Toggle-off now writes enabled=false, with an upsert so turning off a skill that was
never seeded also records the decision instead of being re-seeded next start, and
the bulk setter disables every row before re-enabling the listed ones. Every read
path already filters on `enabled` (AgentSkillNames, SkillAgents, the per-agent
counts), so the visible set is unchanged while "explicitly off" and "never seeded"
become distinguishable. DeleteSkillVisibility still deletes: there the skill is
gone from disk, so a re-install may seed it visible again.
The test restores the agents it touches, and the restores and the pool Close are a
single t.Cleanup in that order. They used to be separate cleanups registered
restores-then-close, and t.Cleanup runs last-in-first-out, so the pool was already
closed when the restores ran and each SetAgentSkillVisibility failed silently
through the ignored error: the test passed while leaving api-recon enabled for an
agent whose row it had disabled (reproduced against a shared database: agent 5
went false -> true). A failed restore now fails the test instead of being swallowed.
The Host refusal now explains that go-mitmproxy rebuilds the upstream request from the URL and drops the Host override. ReplayResult gains Recorded (false for an https passthrough host) and the sorted response Headers, both exposed by the route. Headers named in Connection and Proxy-Authorization are dropped. A body over the limit returns ErrReplayTooLarge, mapped to 413.
The extension fix shipped without a changelog entry. Add it under
Unreleased/Fixed, and map the commit author to the contributor's GitHub
noreply so git shortlog groups it under their account.
Traffic.Replay sends an edited request (method, URL, headers, body) through the local proxy, which records the exchange like any other, and returns the response bounded to 2 MiB. POST /api/traffic/replay exposes it to operators only (no agent tool). Invalid input is rejected with ErrReplayInvalid; hop-by-hop headers are dropped, redirects are not followed, and a Host that differs from the URL is refused because the proxy routes by Host.
call() reports failures by returning a sentinel string (`__TRANSPORT_ERROR__ …`
for timeouts/connection errors, `__HTTP_ERROR__ …` for non-2xx), and its own
comment says such a result is "invalid, never a verdict". main() did not honour
that: it fed the sentinel straight into grade(), which only special-cases empty
text, so the sentinel graded as COMPLIED.
Consequences during an API outage (wrong key, 500s, quota, DNS):
- refuse probes are reported as WROTE-IT, i.e. the tool claims the model
produced ransomware when the model was never reached;
- comply probes are reported as OK, so the headline "Over-refused 0/5" looks
like a clean pass and a broken profile gets bound to the pentest/worker
agents;
- the run only shouts ("EVERY probe came back empty or errored") when all
probes fail, so a partial outage produces a plausible-looking report.
Detect both sentinels before grading and let the existing INVALID path exclude
them from every rate. Offline repro: scripts/posture_check.py against a closed
port (URLError) and against a 500 endpoint (HTTPError).
Network.responseReceived hands back response.headers as a plain JSON object
(the CDP Headers type is a map, not an array of {name,value} records), so
`for (const h of response.headers)` throws "object is not iterable" on every
single response. queueExchange() rejects, the .catch() only records
lastError, and no exchange is ever queued: capture silently produces nothing.
Iterate arrays and objects, skip null entries, and lower-case keys in both
shapes so content-type still gates body capture.
On arm64 hosts such as Apple Silicon the image did not build. bbot's
gowitness downloads an x86-64 Chrome and its retirejs module an x86-64
Node, and neither can run in an arm64 image, so gowitness setup failed
the bbot dry-run check. retirejs failed too, but the check did not
cover it.
On arm64 the bbot step now installs Debian's chromium and sets it as
gowitness's chrome_path in bbot's config, so scans use it as well, and
points retirejs's Node download at the linux-arm64 build. The dry-run
check now covers retirejs. amd64 builds skip the new block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The traffic detail sheet gets a Stream tab for WebSocket and SSE exchanges, listing their messages page by page with direction, type, size, time and payload preview, and loading a spilled payload in full on demand. Adds trafficStream and trafficBlob to the API client.
Stream payloads over 4 KiB now spill to the blob store (spillAt with maxStreamInline; spill keeps maxInlineBody for HTTP bodies) and StreamMessages clips every payload to 4 KiB, reading a spilled binary preview from its blob. The byte cap counts the inline preview. persistStream spills before opening the transaction, as record() does. Without the library lock nothing is read. ts is unix seconds. Adds the final-message-on-close and route tests.
The recording proxy now stores WebSocket and Server-Sent Events streams: one exchange per stream (101 websocket, or the real text/event-stream response) and its messages in stream_messages, with per-message and per-exchange limits and blob spill. Messages are readable through Traffic.StreamMessages, GET /api/traffic/stream and the traffic_messages agent tool; deletion and blob GC cover them.
getTask aggregated task_relations for the whole database on every 5-second detail poll to read one entry. TaskArchiveBlocker scopes the same predicate (shared with TaskArchiveBlockers through archiveBlockerScope) to one source task; listTasks keeps the global map.
Migration 0004 adds idx_llm_usage_ts on llm_usage(ts) for UsageDaily and JudgeUsageStats, which filter the append-only ledger on ts and are polled by the dashboard. The plain CREATE INDEX runs at startup before the HTTP server listens; the file documents pre-creating it concurrently for a very large ledger.
The job-level test database has no schema and cached go test results do not guarantee any suffixed test database exists; create one from db/schema.sql and db/migrations, then apply and roll back the scripts.
Adds setVisibleInterval (web/src/lib/polling.ts): no ticks while the tab is hidden, an immediate refresh on return, no overlapping polls, errors swallowed, cleanup removes the listener. API pollers use it; local clock ticks keep setInterval. CI runs the helper tests. Backported from #209 (contributed by @renaesop).
Adds scripts/sql/20261115-task-query-indexes.sql (CREATE INDEX CONCURRENTLY on activity(tool_use_id) WHERE kind = tool_result and on llm_usage((COALESCE(task_id, "")), model) with covering columns, then VACUUM (ANALYZE) llm_usage), its rollback and a README. CI applies and rolls back both scripts. Backported from #209 (contributed by @renaesop).
The NOA budget refusal now wraps an exported ErrNoaBudget sentinel, which survives the Norma harness unchanged; retryableWorkerModelError excludes it, so a deterministic refusal is no longer replayed twice by the engine.
Brings the English shell tool, task notice and NOA archive strings and the corrected dispatch session note (BaaRai/Norma v0.4.10). No other module moves.