Skip to content

refactor: credit ares techniques from token_coverage instead of redis - #29

Closed
l50 wants to merge 1 commit into
mainfrom
feat/credit-techniques-from-token-coverage
Closed

refactor: credit ares techniques from token_coverage instead of redis#29
l50 wants to merge 1 commit into
mainfrom
feat/credit-techniques-from-token-coverage

Conversation

@l50

@l50 l50 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Key Changes:

  • Replaced the second Redis round-trip (SDIFF exploited superseded) with ares's own token_coverage map, so technique credit is derived from a single loot payload
  • Eliminated the hand-maintained vuln_id prefix table that mirrored ares's category mapping, removing a persistent source of drift between the two sides
  • Ensured synthesized JSONL is byte-stable across polls by walking categories in sorted order

Added:

  • aresTokenCoverage struct and TokenCoverage field to model ares's token_coverage JSON, keyed by scoreboard category with proven-only Exploited counts - transport_ares.go
  • aresCategoryToTechniqueID to handle the small residual translation between ares category keys and answer-key technique IDs, explicitly refusing check-only categories (zerologon), the catch-all (other), and the per-domain golden_ticket (credited via domain_compromise[] instead)
  • writeTokenCoverageEntries to credit one technique per category with a proven exploit, respecting the shared emitted map and sorted iteration
  • Comprehensive test coverage for the new path including exploited-only crediting, deterministic ordering, nil-coverage safety, shared-emitted dedup, and per-domain golden-ticket handling - transport_ares_test.go

Changed:

  • FetchReport now includes token_coverage in its jq filter and no longer performs a second SSM/Redis call for exploited techniques - transport_ares.go
  • synthesizeJSONL signature dropped its exploited []string parameter, with all call sites updated across transport_ares.go and verify_test.go
  • Rewrote TestAresExploitedToTechniqueIDs into TestAresCategoryToTechniqueID and updated the answer-key existence guard to enumerate ares category keys rather than raw vuln_id shapes - transport_ares_test.go

Removed:

  • fetchExploited and its ares:op:<id>:exploited/:superseded Redis SDIFF logic, now superseded by ares's own proven-only counting - transport_ares.go
  • aresExploitedToTechniqueIDs prefix-matching table and its reflect-based test, both obsoleted by ares normalising categories to scoreboard names upstream - transport_ares.go, transport_ares_test.go

… exploited set

**Added:**

- `aresTokenCoverage` struct and `TokenCoverage` map field on `aresLoot` to parse ares's `token_coverage` JSON, which is keyed by scoreboard category and reports proven-only exploit counts - `transport_ares.go`
- `aresCategoryToTechniqueID` translating residual category-to-technique-ID disagreements (`forest_trust`→`cross_forest_trust`) and refusing categories the scoreboard must not credit (`zerologon`, `golden_ticket`, `other`) - `transport_ares.go`
- `writeTokenCoverageEntries` crediting one objective per category with a proven exploit, walking categories in sorted order for byte-stable output across polls - `transport_ares.go`
- Test coverage for the new path: `TestAresCategoryToTechniqueID`, `TestWriteTokenCoverageEntries` and its determinism/nil/emitted-map variants, `TestSynthesizeJSONL_GoldenTicketStillPerDomain`, and `TestAresCategoriesExistInAnswerKey` - `transport_ares_test.go`

**Changed:**

- `FetchReport` now sources technique credit from `token_coverage` via the `jqFilter`, dropping the second Redis round-trip; ares owns the category mapping and superseded subtraction so the two sides can no longer drift on naming - `transport_ares.go`
- `synthesizeJSONL` signature drops the `exploited []string` parameter, updating all call sites in tests - `transport_ares.go`, `verify_test.go`
- Answer-key guard test reworked to validate categories through `aresCategoryToTechniqueID` rather than raw `vuln_id` prefixes - `transport_ares_test.go`

**Removed:**

- `fetchExploited` and its `ares:op:<id>:exploited`/`superseded` Redis SDIFF round-trip, now handled by ares's own superseded subtraction - `transport_ares.go`
- `aresExploitedToTechniqueIDs` hand-maintained prefix table and its `TestAresExploitedToTechniqueIDs`/`TestAresExploitedTechniquesExistInAnswerKey` tests, which duplicated ares's category mapping - `transport_ares.go`, `transport_ares_test.go`
@l50

l50 commented Jul 30, 2026

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #28, which implements the same token_coverage adoption and handles it better.

I checked both of the cases I was going to raise and #28 already covers them: the forest_trustcross_forest_trust rename is in its category table, and zerologon and golden_ticket are both in its uncreditable set.

It also gets one case right that this PR got wrong: #28 refuses printnightmare because ares mints that id from banner text rather than a confirmed exploit, whereas this PR passed it through as creditable and would have produced a false credit.

@l50 l50 closed this Jul 30, 2026
@l50
l50 deleted the feat/credit-techniques-from-token-coverage branch July 30, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant