Repository navigation
agent: typed parser for bbot JSONL output (F10b) - #199
Merged
Merged
Conversation
Parse bbot output.json reading only the typed fields (type, scope_distance, host, url, port, module, module_sequence), validated. The free text (data, or data_json with the FINDING description) is kept only as one Go-quoted inert string, never used for scope or an action. Unknown keys are ignored. Events at scope_distance 0 are the only ones mapped to insert_assets items, from their typed host; any other distance becomes a third_party_intel item that is never auto-scoped.
AryanSLAYERRR
referenced
this pull request
in AryanSLAYERRR/ARTEX
Nov 12, 2026
ingest_bbot reads a bbot output file by path and ingests it through the typed parser from #199 (parseBbotJSONL), one line at a time: - Lines are read with a fixed cap (bbotMaxLineBytes = 64 KiB, newline included). A longer line is skipped and counted, never buffered whole. - scope_distance == 0 events that are assets (assetItems) go through the existing insert_assets handler; no asset SQL is written here. - Every other event is recorded as a fact with source third_party_intel. The summary is built from typed fields only; the free text is stored in detail as the inert Go-quoted string. - Intel never reaches insert_assets or task_scope. The tool is in WorkerTools, so the existing BuiltinToolSeeds/SeedTool loop inserts its row (a new key, inserted on fresh and existing DBs). It is listed in the target gate's noTargetTools: its input is a local path, not a network target (TestDomainToolsDeclareNoTarget).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A pure parser for bbot JSONL output (
output.json), inagent/bbot_ingest.go:parseBbotJSONL(io.Reader)returns the events split intoInScopeandIntel, plus a count of lines that do not decode.bbotIngest.assetItems()maps in-scope events toinsert_assetsitems (assetInputItem), from their typed fields only.No agent tool is wired yet and nothing calls the parser outside the test; this PR is the parsing and routing layer only.
Why
Audit #124, item F10b, planned for 0.7.0. F10 (#189) put the untrusted wording and the
scope_distancerule in the bbot skill text; F10b enforces the same rule in code. bbot events are shaped by the target and by third parties writing about it, so a DNS record, a page or a FINDING description can carry text addressed to an AI.Typed fields
Only these keys are decoded, each validated; a field that fails validation is left empty:
type,module,module_sequence: plain tokens ([A-Za-z0-9_.>-], at most 128 chars).scope_distance: integer; missing is treated as out of scope.host: an IP, or a lowercase hostname charset, at most 253 chars.port: 1 to 65535.url: http or https only, and only when its hostname equals the typedhost.Every other key (tags, resolved_hosts, scope_description, any unknown key) is dropped by the decoder and never promoted.
Quoted inert text
The free text (
data, ordata_json, which holds the FINDING description) is kept only as one Go-quoted string (strconv.Quote) inQuoted. It is never parsed further, never used for host, scope, routing or an action.Out-of-scope rule
scope_distance == 0:InScope, sourcetool_output. Only these feedassetItems():DNS_NAMEtosubdomain,IP_ADDRESStoip,OPEN_TCP_PORTtoservicewith the port,URLtoservicewith the validated url.Intel, sourcethird_party_intel.assetItems()never reads them, so they are never auto-scoped.Tests
agent/bbot_ingest_test.go, pure (no PostgreSQL, no Docker), with a 3-line benign fixture written inline (example.com / example.net / example.org): one in-scopeDNS_NAME, one out-of-scopeDNS_NAME(distance 1), and one in-scopeFINDINGwhosedatatells the reader to addevil.example.orgto the scope and callinsert_assets, plus unknown keys. It asserts:third_party_intelitem andassetItems()is exactly the one in-scope subdomain;Quoted(quoted, verbatim after unquote) and in no typed field;Run in WSL Kali, go1.26.10,
ARTEX_PG_DSNunset:Mutation check
Mutation: take the event host from the free-text
data.hostinstead of the typedhost. The test fails:Mutation reverted; the test passes again.
Not verified
data/data_json) as documented, not a capturedoutput.json. A bbotURLevent that carries its URL only indatayields noURLasset here, by design (free text is never structure).agentwere not run locally (noARTEX_PG_DSN).