Skip to content

Takeover, internal and found counts leave out -permute and -ptr hits #458

Done

Description

@TMHSDigital

Summary

The run summary counts takeover candidates, internal addresses and found names from the main pass only. Hits from the -permute and -ptr passes are in the results file but missing from -stats, subenum report, and the Action's takeovers, internal and found outputs. Under -permute-only, takeover_candidates is always 0.

Where

  • internal/report/report.go:126, :128 (Target: t.Takeover = st.Takeover, t.Internal = st.Internal)
  • internal/report/permutation.go:30 (Permutation: adds queries and verdict, not Stats.Takeover/Internal)
  • internal/cli/summary.go:69 (ptrSummary: same)
  • internal/cli/session.go:882 (-permute-only: the main pass is a synthetic EventDone)
  • internal/cli/runreport.go:141-157 (Found column and takeover section)
  • action.yml:290, :294-295 (found, takeovers, internal outputs)

Details

Each pass counts its own takeover hints and non-public addresses (internal/scan/runner.go:853-864), but only the main pass's counts reach TargetSummary. PermutationSummary has no takeover field. docs/output.md:101 and docs/schemas/stats.v1.json:56 define takeover_candidates as "Results with a takeover hint", meaning all results. Downstream, markdownReport prints the takeover list only if takeovers > 0, and the Action sums .targets[].takeover_candidates.

The same drift affects found: the Action computes (.found // 0) + (.permutation.found // 0) and markdownReport adds t.Permutation.Found, and neither was updated for ptr_found when -ptr landed (#436).

Impact

A dangling CNAME found only by the permutation or PTR pass is in -o and -sarif, but -stats reports 0, the Action's takeovers output is 0, and the job summary leaves out the "Takeover candidates" section. Workflows that gate or alert on takeovers stay silent. found and the report's Found column undercount by the PTR hits.

Steps to reproduce

  1. Lab zone where only a permutation such as dev-api (from seed api) has a CNAME to an unclaimed provider host.
  2. subenum -permute-only -seeds seeds.jsonl -type A,CNAME -stats run.json -o jsonl:r.jsonl ...
  3. r.jsonl has a takeover_candidate; run.json has none; subenum report -stats run.json -results r.jsonl prints no takeover section.

Suggested fix

In report.Permutation, under p.Final != nil, add final.Stats.Takeover and final.Stats.Internal to t (and add the fields to PermutationSummary). Do the same in ptrSummary under p.pass.done. For found, compute a per-target results total once in Go and have both action.yml and markdownReport read it instead of summing pass fields by hand; short term, add ptr_found to both formulas.

Acceptance criteria

  • A takeover found only by the permutation pass is counted in takeover_candidates, subenum report and the Action output.
  • Same for a -ptr pass hit and for -permute-only.
  • found in the Action and the report's Found column include ptr_found.
  • docs/schemas/stats.v1.json and docs/output.md match.

Getting started

  • Relevant files: internal/report/permutation.go, internal/cli/summary.go, internal/cli/runreport.go, action.yml
  • How to run tests: go test ./... (tests must be hermetic: -simulate or the built-in lab server)

Filed by repo-audit/full-audit at a45b999. Severity: medium. Effort: S. audit-key: bug|internal/report/report.go|Target

Activity

  1. added
    bug
    help wanted
    area: output
    severity: medium
    on Nov 29, 2026
  2. TMHSDigital commented on Nov 29, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in dc71593: report.Permutation and ptrSummary now add each pass's Stats.Takeover and Stats.Internal to the target's takeover_candidates and internal_addresses (the TUI shares report.Permutation), and the report's Found column and the Action's found output include ptr_found. The schema and output.md already define takeover_candidates as all results, so they did not change. New TestTargetSummaryCountsEveryPass (fails without the fix: 1/1 instead of 7/9, Found 3 instead of 6). Gate (gofmt, vet, golangci-lint v2.15.0, full suite) passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: outputbughelp wantedseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions