Skip to content

feat(launcher): reuse the asset inventory in the scope wizard - #1193

Merged
PurpleCHOIms merged 2 commits into
mainfrom
feat/inventory-wiring
Nov 13, 2026
Merged

PurpleCHOIms merged 2 commits into
mainfrom
feat/inventory-wiring

Conversation

@PurpleCHOIms

Copy link
Copy Markdown
Member

What

Wires the postgres asset inventory (#1192) into the engagement scope wizard so the launcher reuses prior passive-discovery lookups across engagements instead of re-querying every time — the CTEM behavior you asked for.

How

The picker opens the stack-postgres inventory best-effort (nil when the stack isn't up — common on a first run, since scope entry precedes compose up) and threads it through Select → promptNewEngagement / promptEditDraftScope → collectScope. In collectScope, for the seed zone:

  • Lookup(zone) — reuse remembered assets from prior engagements (an info line tells the operator how many).
  • DiscoverScope — still run the live passive query.
  • Record(zone, finds) — remember this run's results for next time.
  • mergeRecommendations — union(remembered, live), deduped, remembered first, shown in the suggestion multiselect.

start.go builds the DSN from POSTGRES_PORT/POSTGRES_PASSWORD. Every inventory call is nil-safe, so a missing inventory degrades cleanly to live-only discovery.

Verified

go build / go vet / go test (engagement + cmd + inventory) green on sec-dev. mergeRecommendations unit-tested (order + dedupe); the inventory storage layer was live-verified against real postgres in #1192.

Follow-up

  • Passive-discovery depth (seed expansion: IP/CIDR/ASN/org, reverse-DNS/WHOIS).

mschoi added 2 commits November 13, 2026 16:43
Wire internal/inventory into engagement scope entry (create + draft-edit). The
picker opens the stack-postgres inventory best-effort (nil when the stack isn't
up yet — common on a first run) and threads it into collectScope, which:
  - Lookup(zone): reuses remembered assets from prior engagements,
  - DiscoverScope: still runs the live passive query,
  - Record(zone, finds): remembers this run's results for next time,
  - mergeRecommendations: unions remembered ∪ live (deduped, remembered first)
    as the suggestion list.
start.go builds the DSN from POSTGRES_PORT/PASSWORD and passes it to Select.
Every inventory call is nil-safe, so a missing inventory degrades to live-only.

Verified on sec-dev: go build / vet / test (engagement + cmd + inventory) green;
mergeRecommendations unit-tested; inventory storage live-verified in #1192.
@PurpleCHOIms
PurpleCHOIms merged commit 1b1c245 into main Nov 13, 2026
24 checks passed
@PurpleCHOIms
PurpleCHOIms deleted the feat/inventory-wiring branch November 13, 2026 07:47
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