Skip to content

Test the remaining #486 edges: report inputs and zone sources as Names - #492

Open
nova-loop wants to merge 1 commit into
TMHSDigital:mainfrom
nova-loop:test/report-and-zone-source-edges
Open

nova-loop wants to merge 1 commit into
TMHSDigital:mainfrom
nova-loop:test/report-and-zone-source-edges

Conversation

@nova-loop

Copy link
Copy Markdown

Description

Adds the tests still open in #486 after b4fda54. Tests only; no production code changes.

  • internal/cli/runreport_test.go
    • TestReportResultsJSONArray: the degraded fixture's results written as one JSON array (summary as the last element) gives exactly degraded/want.md, the same report as the JSONL file.
    • TestReportErrors: two new cases: a -results file containing {bad exits 1 with "reading -results file", and a -stats file containing {} exits 1 with "not a subenum -stats report". Nothing goes to stdout in either case.
  • pkg/subenum/zone_test.go
    • TestZoneSourceNames: ZoneTransfer(opts).Names returns [admin-legacy www] from the local zone server. A refused transfer gives no names and no error, and a bad resolver is an error. NSECWalk(opts).Names returns [admin-legacy ns1 secret] from the plain-NSEC lab zone without sending AXFR, and a negative Rate is an error.

go tool cover now shows zoneSource.Names and walkSource.Names in pkg/subenum/zone.go at 100%.

Related Issue

Closes #486

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvements
  • Test updates

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project
  • I have added/updated appropriate comments to the code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (go test -race -shuffle=on -count=1 ./...)
  • I have updated the documentation accordingly (if applicable): not applicable, tests only

Ethical Considerations

  • This change maintains or improves the security controls in the tool
  • This change follows the educational/legitimate security testing focus of the project
  • I have considered potential misuse cases and taken appropriate steps to prevent them (tests only, against local test servers)

Additional Information

Also ran gofmt, go vet, and golangci-lint v2.15.0 on ./internal/cli/... and ./pkg/subenum/... (0 issues).

This change was prepared with AI assistance; I reviewed the diff and ran the checks above.

…ces as Names

subenum report: -results as one JSON array (with the summary as its last
element) gives the same report as the JSONL file, a '{bad' -results file
fails with 'reading -results file', and a '{}' -stats file fails with
'not a subenum -stats report'.

pkg/subenum: ZoneTransfer(opts).Names and NSECWalk(opts).Names called
directly return the zone's names against the local test server; a refused
transfer gives no names and no error, and bad options are errors.

Refs TMHSDigital#486

This branch has not been deployed

No deployments
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.

Small untested branches: validTarget length, library sources, SARIF and report edges

1 participant