Skip to content

fix: comprehensive tech debt cleanup — security, CI, docs, tests, refactors - #535

Merged
mergify[bot] merged 19 commits into
mainfrom
tech_debt_cleanup
Apr 3, 2026
Merged

mergify[bot] merged 19 commits into
mainfrom
tech_debt_cleanup

Conversation

@unclesp1d3r

@unclesp1d3r unclesp1d3r commented Apr 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Resolves 35 tech debt items identified during PR #521 review and a full codebase audit. Two items deferred as won't-fix (shared converter extraction: cost > benefit; slog migration: sloglint constraint).

Impact: 79 files changed (+5,764 / -6,474) — net reduction of 710 lines
Categories: 27 source, 21 test, 17 docs, 7 CI/config
Review rounds: 3 (internal agents, Copilot, fixes applied)


Changes by Area

Security Hardening

Change Files Risk
Sanitizer XXE prevention — empty entity map, 100MB size limit, DTD directive stripping sanitizer.go Low
Replace custom ASCII toLower/containsIgnoreCase with strings.ToLower/strings.Contains rules.go Low
Path traversal — replace naive dotDotCount with abs resolution + CWD containment via EvalSymlinks file.go Medium
Symlink containment — run checks for all relative paths with separators, not just .. paths file.go Medium
action.yml — move inputs to env: block, add set -euo pipefail, command/format allowlists, path validation action.yml Low
Attestation verification — fix || echo that swallowed failures in release workflow release.yml Low
Fix currentPath corruption when XML elements contain literal dots — use pathStack sanitizer.go Low
Scope ldap_* patterns to authserver. prefix to prevent cross-rule false matches rules.go Low

CI/Release

  • Wire test-race into just ci-check + add CI race detector job (continue-on-error: true)
  • Add CodeQL SAST workflow for Go (weekly + PR/push triggers)
  • Create codecov.yml with 70% project / 60% patch thresholds; enable fail_ci_if_error
  • Pin cyclonedx-gomod (v1.10.0), goreleaser (2.15.2)
  • Use disable template on ghcr-stable for prerelease builds (replaces empty-tag approach)
  • Skip Docker on snapshot builds (--skip=docker) + add workflow summary warning

Performance

  • Pre-lowercase sanitizer field patterns at construction time (0 B/op on hot path benchmarks)
  • Replace strings.Join(elementStack) with running currentPath + pathStack

Documentation

  • README: remove STIG (enterprise-only), fix dead rule examples, remove --validate flag
  • GOTCHAS.md: add §2.5 (plugin trust), §8.4 (red mode stubs), §19.1 (rule ordering contract)
  • SECURITY.md: update support policy (90 days full / 6 months best-effort)
  • audit.md: document --failures-only, add red mode experimental warning
  • convert.md: fix pfSense "third-party plugin" mislabel
  • CONTRIBUTING.md: sync ReportComposer interface (add SetFailuresOnly)
  • plugin-development.md: document dynamic plugin security model

Test Coverage

Area Before After
cmd/ package 48.5% 82.9%
DHCP diff comparison 18.2% 100%
cmd/diff.go 0% 83%+

New tests: sanitizer XXE/size/directive, path traversal symlink, resolveWithMissingTail, benchmarks

Refactors

File Before After New files
builder.go 1,378 lines 285 lines 5 domain files
analyzer.go 1,011 lines 12 lines 7 domain files
internal/markdown/ 6 source + 4 test + 4 testdata deleted RenderMarkdown/ValidateMarkdown → converter/html.go

Won't Fix

  • shared converter extraction: 12 identical functions (~350 LOC) across OPNsense/pfSense converters, but extraction requires a new package + interface design + careful handling of pfSense behavioral divergences. Cost exceeds benefit.
  • slog migration for sanitizer: sloglint forbids global slog and the function has no struct receiver. Keeping log.Printf for unreachable error path.

Review Feedback Addressed

Reviewer Finding Resolution
Copilot checkPathTraversal skips symlink checks without .. Run containment for all relative paths with separators
Copilot resolveWithMissingTail writes to stderr Changed to return (string, error)
Copilot Missing LF() after PlainTextf() in builder_system.go Added 9 missing LF() calls + updated golden files
Copilot t.Parallel() range variable capture Not applicable — Go 1.26 per-iteration scoping
Internal agents currentPath desync on dot-containing elements Added pathStack approach
Internal agents Vacuous context cancellation test Added NotPanics + assertions
Internal agents Weak Contains("{") JSON assertion Replaced with json.Valid()
Internal agents t.Skip for required testdata Changed to t.Fatal

Test plan

  • just ci-check passes (lint, modernize, test, race detector, pre-commit)
  • just release-check passes (goreleaser config validation)
  • Three-agent PR review (code-reviewer, silent-failure-hunter, pr-test-analyzer)
  • Copilot review — all 4 threads resolved
  • CI passes on GitHub (Build, Lint, Test x3 platforms, Coverage, Integration)
  • CodeQL workflow triggers successfully
  • Codecov thresholds met (70% project / 60% patch)

Used Claude Code to perform code review with compound-engineering agents; identified issues were resolved manually by @unclesp1d3r, who mostly understands his own code.

…injection, attestation verify

Batch 1 of tech debt cleanup — P1 security fixes:

- Sanitizer: add XXE prevention (empty entity map), input size limit
  (100MB), and DTD directive stripping (#65)
- Sanitizer: replace custom ASCII-only toLower/containsIgnoreCase with
  strings.ToLower/strings.Contains for consistency (#66)
- Export: replace naive dotDotCount path traversal check with proper
  absolute path resolution + CWD containment check (#67)
- action.yml: move all inputs to env block to prevent shell injection,
  add set -euo pipefail and input validation (#89)
- release.yml: fix attestation verification silently swallowing failures
  via || echo pattern — now fails the step on verification errors (#94)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…eleaser safety

Batch 2 of tech debt cleanup — P1 quality + CI fixes:

- Sort map keys in formatMapValue for deterministic markdown output,
  fixing GOTCHAS.md §3.1 violation (#68)
- Fix README: remove STIG mentions (enterprise-only), replace dead rule
  detection example with implemented capabilities, remove nonexistent
  --validate flag (#69)
- Wire test-race into ci-check and add CI race detector job with
  continue-on-error for GitHub runner compatibility (#70)
- GoReleaser: use skip_push template instead of conditional tags that
  produce empty strings on prerelease builds (#90)
- Release workflow: skip docker on snapshot builds to prevent accidental
  latest/v0 pushes from workflow_dispatch (#91)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…on, snapshot warning

Batch 3 of tech debt cleanup:

- Scope bare ldap_* FieldPatterns to authserver ancestor path to prevent
  over-matching on unrelated XML elements (#59)
- Pre-lowercase field patterns at rule engine construction time,
  eliminating per-comparison allocations on the hot path (#77)
- Add format/command allowlists and explicit docker pull with actionable
  errors to action.yml (#92)
- Add workflow summary warning for snapshot builds so maintainers see
  that no artifacts were published (#95)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Batch 4 of tech debt cleanup:

- Add CodeQL workflow for Go with weekly scheduled scan and PR/push
  triggers (#71)
- Create codecov.yml with 70% project / 60% patch thresholds and enable
  fail_ci_if_error (#72)
- Pin cyclonedx-gomod to v1.10.0 and goreleaser to 2.15.2 in release
  workflow and mise.toml (#79)
- Revert slog migration for sanitizer escapeXMLText — sloglint forbids
  global slog and the function has no struct receiver; keeping log.Printf
  for this unreachable error path (#84 — won't fix as designed)
- Remove custom compliance profiles from README (enterprise-only feature)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…Y.md versions

Batch 5 of tech debt cleanup — documentation fixes:

- Document sanitizer rule ordering contract (authserver_config must
  precede password) in rules.go and GOTCHAS.md §19 (#61)
- Fix stale "Credential-only" label in sanitize CLI help to match
  updated scope including authserver values (#62)
- Move all-contributors badge to top badge group in README (#63)
- Update SECURITY.md supported versions: 1.3.x supported, 1.2.x
  end-of-life (#64)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…e sync

Batch 6 of tech debt cleanup — documentation fixes:

- Emit CLI warning when --mode red selected and add experimental
  admonition in audit.md; document stubs in GOTCHAS.md §8.4 (#75)
- Document --failures-only flag in audit.md flags table with usage
  example (#85)
- Fix pfSense incorrectly labeled as "third-party plugin" in
  convert.md — it's a built-in parser (#86)
- Add missing SetFailuresOnly method to ReportComposer interface
  listing in CONTRIBUTING.md (#87)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…n docs

Batch 7 of tech debt cleanup:

- Document plugin loading trust model in plugin-development.md and
  GOTCHAS.md §2.5 — no verification on .so loading (#88)
- Add t.Run() subtests to TestRedact_AuthServerConfig for per-case
  isolation (#60)
- Replace strings.Join with running currentPath in sanitizer for
  reduced allocations on hot path (#78)
- Fix action.yml/README docs: add pfSense mentions, list all formats
  and subcommands, clarify @main vs @v1, document args whitespace
  splitting (#93)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Batch 8 of tech debt cleanup — test coverage:

- Add comprehensive cmd/diff tests: validateDiffFlags, parseConfigFile,
  outputDiffResult, PreRunE validation, completions (83%+ coverage for
  diff.go) (#76)
- Add 26 DHCP diff comparison tests covering CompareDHCP section guards,
  per-interface comparison, compareStaticMappings, and edge cases
  (18.2% -> 100% coverage) (#81)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Batch 9 of tech debt cleanup — cmd/ coverage target:

Add 10 test files covering DetermineExitCode, helper functions,
config show/validate, shared XML flag completions, root setup,
sanitize output path, audit integration (runAudit, generateAuditOutput,
emitAuditResult), and validate updateMaxExitCode.

cmd/ package coverage: 48.5% -> 82.9% (#80)

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…ckage

Batch 10 of tech debt cleanup — large refactors:

- Split builder.go (1,378 → 285 lines) into builder_system.go,
  builder_network.go, builder_security.go, builder_nat.go,
  builder_audit.go following existing builder_vpn.go pattern (#73)
- Split analyzer.go (1,011 → 12 lines) into 7 domain files:
  analyzer_system.go, analyzer_firewall.go, analyzer_nat.go,
  analyzer_network.go, analyzer_services.go, analyzer_users.go,
  analyzer_routing.go (#74)
- Remove internal/markdown deprecated wrapper package — moved
  RenderMarkdown/ValidateMarkdown to internal/converter/html.go,
  updated 3 callers (#82)
- Evaluated shared converter extraction (#83) — 12 identical functions
  (~350 LOC) but extraction requires new package, interface design, and
  careful handling of pfSense-specific divergences; cost exceeds benefit.
  Keeping as tracked low-priority item.

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
…ardening

Fix issues identified by code-reviewer, silent-failure-hunter, and
pr-test-analyzer agents:

Critical:
- action.yml: remove completion/config/man from command allowlist —
  pointless in CI and mismatched with error message
- sanitizer: fix currentPath desync on XML elements containing dots —
  use pathStack instead of strings.LastIndex to prevent field name dots
  from corrupting the running path

Important:
- export: add warning log when resolveWithMissingTail falls back to
  unresolved path (symlink protection degraded)
- sanitizer: document LDAP pattern scope assumption for non-OPNsense
  device types in rules.go comment
- export: add symlink + dotdot path traversal test and direct
  resolveWithMissingTail unit tests
- cmd/diff: fix vacuous context cancellation test — add NotPanics
  wrapper and assert device nil on error

Medium:
- action.yml: add config-file and output path traversal validation
  (reject absolute paths and ".." segments)
- action.yml: warn when args input contains quotes that won't be
  preserved by whitespace splitting
- audit_integration_test: use json.Valid() instead of Contains("{")
- audit_integration_test: use t.Fatal instead of t.Skip for required
  testdata fixtures

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Copilot AI review requested due to automatic review settings April 3, 2026 03:43
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Apr 3, 2026
@coderabbitai

coderabbitai Bot commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f4b78b6d-974d-4495-9b67-7508c38c159e

📥 Commits

Reviewing files that changed from the base of the PR and between 7b79ca9 and 09f2b40.

⛔ Files ignored due to path filters (1)
  • mise.lock is excluded by !**/*.lock
📒 Files selected for processing (76)
  • .github/copilot-instructions.md
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • .goreleaser.yaml
  • CONTRIBUTING.md
  • CONTRIBUTORS.md
  • GOTCHAS.md
  • README.md
  • SECURITY.md
  • action.yml
  • cmd/audit.go
  • cmd/audit_integration_test.go
  • cmd/config_show_coverage_test.go
  • cmd/config_validate_coverage_test.go
  • cmd/diff_test.go
  • cmd/exitcodes_test.go
  • cmd/help_test.go
  • cmd/root_coverage_test.go
  • cmd/sanitize.go
  • cmd/sanitize_coverage_test.go
  • cmd/shared_flags_xml_test.go
  • cmd/validate_coverage_test.go
  • codecov.yml
  • docs/development/architecture.md
  • docs/development/plugin-development.md
  • docs/user-guide/commands/audit.md
  • docs/user-guide/commands/convert.md
  • internal/converter/builder/builder.go
  • internal/converter/builder/builder_audit.go
  • internal/converter/builder/builder_nat.go
  • internal/converter/builder/builder_network.go
  • internal/converter/builder/builder_security.go
  • internal/converter/builder/builder_system.go
  • internal/converter/builder/writer_test.go
  • internal/converter/html.go
  • internal/converter/testdata/golden/complete_comprehensive.golden.md
  • internal/converter/testdata/golden/complete_standard.golden.md
  • internal/converter/testdata/golden/edge_cases_comprehensive.golden.md
  • internal/converter/testdata/golden/edge_cases_standard.golden.md
  • internal/converter/testdata/golden/minimal_comprehensive.golden.md
  • internal/converter/testdata/golden/minimal_standard.golden.md
  • internal/diff/analyzer.go
  • internal/diff/analyzer_dhcp_test.go
  • internal/diff/analyzer_firewall.go
  • internal/diff/analyzer_nat.go
  • internal/diff/analyzer_network.go
  • internal/diff/analyzer_routing.go
  • internal/diff/analyzer_services.go
  • internal/diff/analyzer_system.go
  • internal/diff/analyzer_test.go
  • internal/diff/analyzer_users.go
  • internal/diff/formatters/html.go
  • internal/export/file.go
  • internal/export/file_additional_test.go
  • internal/export/file_test.go
  • internal/markdown/README.md
  • internal/markdown/adapter.go
  • internal/markdown/errors.go
  • internal/markdown/formatters.go
  • internal/markdown/formatters_test.go
  • internal/markdown/generator.go
  • internal/markdown/generator_test.go
  • internal/markdown/hybrid_generator.go
  • internal/markdown/hybrid_generator_test.go
  • internal/markdown/integration_test.go
  • internal/markdown/options.go
  • internal/markdown/testdata/config.xml
  • internal/markdown/testdata/sample.config.1.xml
  • internal/markdown/testdata/sample.config.2.xml
  • internal/markdown/testdata/sample.config.3.xml
  • internal/sanitizer/rules.go
  • internal/sanitizer/rules_test.go
  • internal/sanitizer/sanitizer.go
  • internal/sanitizer/sanitizer_test.go
  • justfile
  • mise.toml

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added --failures-only for blue audits and experimental warning for red mode; built-in support for pfSense; richer Markdown rendering (emoji, footnotes, extended formats).
  • Security & Reliability

    • Hardened XML sanitizer (XXE/DTD protection, size limit) and stricter output path checks; CI now fails on Codecov upload errors; snapshot builds omit Docker and tool versions pinned; tighter attestation verification.
  • Documentation

    • Revised architecture, plugin security guidance, CLI docs, README, contributing, and security policy.
  • Tests

    • Large expansion of unit/integration tests across CLI, diff, sanitizer, export, rendering, and packaging.

Walkthrough

Replaces the legacy internal/markdown facade with a domain-split internal/converter builder (system, network, security, NAT, audit), reimplements the diff Analyzer as focused Compare* modules, hardens sanitizer and export path handling, tightens CI/release/tooling, and adds many CLI tests and docs. No public Go API signatures intentionally changed.

Changes

Cohort / File(s) Summary
Docs & Guides
README.md, CONTRIBUTING.md, SECURITY.md, GOTCHAS.md, .github/copilot-instructions.md, CONTRIBUTORS.md, docs/...
Documentation updates: removed internal/markdown from architecture, added plugin security guidance, documented --failures-only, updated badges/examples/support policy and other user docs.
CI / Release / Tooling
.github/workflows/ci.yml, .github/workflows/release.yml, .goreleaser.yaml, mise.toml, codecov.yml, justfile
CI/release changes: make Codecov failures fatal, pin tooling versions, change prerelease Docker tagging/skip behavior, tighten attestation verification, and add race tests to ci-check.
Action Runtime
action.yml
Composite action: expose INPUT_* env vars, add strict bash flags and input validation/allowlists, enforce path traversal checks, docker pull/explicit IMAGE usage, and change args whitespace semantics.
Markdown Facade Removal
internal/markdown/*
Removed internal/markdown package (adapter, generator, formatters, options, tests, and testdata) and callers migrated to internal/converter.
Converter / Builder Split
internal/converter/html.go, internal/converter/testdata/golden/*, internal/converter/builder/...
New converter helpers (RenderMarkdown, ValidateMarkdown) and domain-specific builder files added; golden fixtures updated (timestamps/whitespace).
Builder: Sections & Table Helpers
internal/converter/builder/builder_system.go, .../builder_network.go, .../builder_security.go, .../builder_nat.go, .../builder_audit.go, internal/converter/builder/builder.go
Split large builder into per-domain files; added BuildSection methods and Write/Build*TableSet helpers; removed monolithic markdown builders in favor of structured builders.
Diff Engine Rework
internal/diff/...
Reworked Analyzer: removed monolithic methods and added focused Compare* implementations (system, firewall, nat, interfaces, vlans, routing, dhcp, users); deterministic ordering and permissive-rule impact detection; HTML formatting now uses internal/converter.
Sanitizer Hardening
internal/sanitizer/sanitizer.go, internal/sanitizer/rules.go, internal/sanitizer/*_test.go
Added 100MB input limit, disabled XML entity expansion, strip DTD directives, pre-lowercase builtin rule patterns, simplified matching logic, and updated authserver patterns/tests/benchmarks.
Export Path Validation
internal/export/file.go, internal/export/*_test.go
Symlink-aware containment checks via resolveWithMissingTail, added ErrNoResolvableAncestor, and extended traversal/symlink tests.
CLI & Tests
cmd/audit.go, cmd/*.go (new tests files)
audit PreRunE now warns on --mode red; large battery of new unit/integration tests added across cmd (audit, diff, validate, help, exitcodes, sanitize, completions, root/context); many tests updated to use internal/converter.
Tests & Golden Updates
many internal/converter/..._test.go, internal/export/*_test.go, internal/converter/testdata/golden/*
Numerous tests added/modified; markdown validation calls switched from internal/markdown to internal/converter; golden markdown timestamps/whitespace updated.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/CLI
    participant Cmd as cmd/audit
    participant Builder as internal/converter/builder
    participant Analyzer as internal/diff/Analyzer
    participant Converter as internal/converter
    participant Export as internal/export

    User->>Cmd: invoke audit (config, --mode, --failures-only)
    Cmd->>Cmd: PreRunE validate flags (warn on red)
    Cmd->>Builder: runAudit(ctx, cfg, mode, failuresOnly)
    Builder->>Analyzer: Compare*() (system, firewall, nat, interfaces, dhcp, users, routes)
    Analyzer-->>Builder: []Change
    Builder->>Builder: BuildSystem/Network/Security/Audit sections (tables)
    Builder->>Converter: ValidateMarkdown(content) / RenderMarkdown(content)
    Converter-->>Builder: validated/HTML result
    Builder->>Export: ExportFile(content, path)
    Export->>Export: checkPathTraversal(path) -> resolveWithMissingTail (symlink-aware)
    Export-->>User: file written or error
Loading
sequenceDiagram
    participant Builder as Converter/Builder
    participant Sys as builder_system.go
    participant Net as builder_network.go
    participant Sec as builder_security.go
    participant Nat as builder_nat.go
    participant Audit as builder_audit.go

    Note over Builder: BuildComprehensiveReport(device, failuresOnly)
    Builder->>Sys: BuildSystemSection(device)
    Sys-->>Builder: system markdown
    Builder->>Net: BuildNetworkSection(device)
    Net-->>Builder: network markdown
    Builder->>Sec: BuildSecuritySection(device)
    Sec-->>Builder: security markdown + firewall/NAT tables
    Sec->>Nat: WriteInboundNATTable / WriteOutboundNATTable
    Nat-->>Sec: nat tables
    Builder->>Audit: BuildAuditSection(device)
    Audit-->>Builder: audit markdown (plugin tables, summary, metadata)
    Builder-->>Builder: concat -> final document
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested labels

documentation, ci, testing

"Builders split and converters bright,
Sanitizers guard the XML night,
Diffs align in ordered rows,
Exports check where symlink goes,
Docs and tests now take the light."

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tech_debt_cleanup

@mergify

mergify Bot commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Require conventional commit format per https://www.conventionalcommits.org/en/v1.0.0/. Skipped for dependabot and dosubot.

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?!?:

🟢 Full CI must pass

Wonderful, this rule succeeded.

All CI checks must pass. Activates for non-bot authors, or dependabot when files exist outside .github/workflows/.

  • check-success = Build
  • check-success = Coverage
  • check-success = Integration Tests
  • check-success = Lint
  • check-success = Test (macos-latest)
  • check-success = Test (ubuntu-latest)
  • check-success = Test (windows-latest)

🟢 Do not merge outdated PRs

Wonderful, this rule succeeded.

Make sure PRs are within 10 commits of the base branch before merging

  • #commits-behind <= 10

@dosubot dosubot Bot added ci Continuous Integration related issues documentation Improvements or additions to documentation performance Performance optimization and improvements refactor Code refactoring and restructuring security Security-related features and issues technical-debt Technical debt that needs to be addressed testing Test infrastructure and test-related issues labels Apr 3, 2026
@dosubot

dosubot Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Related Documentation

2 document(s) may need updating based on files changed in this PR:

opnDossier

architecture /opnDossier/blob/main/docs/development/architecture.md — ⏳ Awaiting Merge
copilot-instructions /opnDossier/blob/main/.github/copilot-instructions.md — ⏳ Awaiting Merge

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tech-debt cleanup focused on hardening XML sanitization and export path handling, tightening CI/release security checks, updating docs, and removing deprecated markdown wrapper code while expanding test coverage.

Changes:

  • Hardened sanitizer and export pipeline (XXE/DTD handling, input size limits, safer path traversal checks, updated markdown render/validate location).
  • CI/release improvements (race detection wiring, CodeQL workflow, Codecov thresholds, pinned tool versions, stricter attestation verification).
  • Refactors and documentation updates (removed internal/markdown wrapper package, updated user/dev docs and contribution contracts).

Reviewed changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
SECURITY.md Updates supported versions table and support policy wording.
README.md Updates feature/docs text and GitHub Action usage examples/inputs.
mise.toml Pins goreleaser tool version.
mise.lock Updates locked tool versions/checksums (including goreleaser).
justfile Adds test-race to ci-check group.
internal/sanitizer/sanitizer.go Adds input size cap, disables entity expansion, fixes path tracking, strips DTD directives.
internal/sanitizer/sanitizer_test.go Adds XXE/size/directive tests and a benchmark.
internal/sanitizer/rules.go Pre-lowercases patterns, removes custom ASCII helpers, documents rule ordering contract, scopes authserver ldap patterns.
internal/sanitizer/rules_test.go Updates authserver field paths, refactors tests/benchmarks for new matching behavior.
internal/markdown/testdata/sample.config.3.xml Removes markdown package test fixture (package removal).
internal/markdown/testdata/sample.config.1.xml Removes markdown package test fixture (package removal).
internal/markdown/testdata/config.xml Removes markdown package test fixture (package removal).
internal/markdown/README.md Removes deprecated wrapper package docs.
internal/markdown/options.go Removes wrapper re-exports to converter options/types.
internal/markdown/hybrid_generator.go Removes wrapper hybrid generator shim.
internal/markdown/hybrid_generator_test.go Removes wrapper tests.
internal/markdown/generator.go Removes wrapper generator shim.
internal/markdown/generator_test.go Removes wrapper tests.
internal/markdown/errors.go Removes wrapper error re-exports.
internal/markdown/adapter.go Removes wrapper adapter.
internal/export/file.go Replaces naive traversal detection with abs+symlink resolution helper.
internal/export/file_test.go Switches markdown validation/rendering calls to internal/converter.
internal/export/file_additional_test.go Expands traversal tests (dotdot + symlink scenarios) and adds resolve helper tests.
internal/diff/formatters/html.go Moves markdown→HTML rendering to internal/converter.
internal/diff/analyzer_users.go Adds user comparison analyzer.
internal/diff/analyzer_test.go Removes DHCP tests moved into dedicated file.
internal/diff/analyzer_system.go Adds system comparison analyzer.
internal/diff/analyzer_services.go Adds DHCP comparison analyzer and static mapping diff logic.
internal/diff/analyzer_routing.go Adds routing comparison analyzer.
internal/diff/analyzer_network.go Adds interfaces + VLAN comparison analyzers.
internal/diff/analyzer_nat.go Adds NAT comparison analyzer.
internal/diff/analyzer_firewall.go Adds firewall rule comparison analyzer (UUID + fallback by position).
internal/converter/html.go Adds rich markdown renderer + RenderMarkdown/ValidateMarkdown in converter package.
internal/converter/builder/writer_test.go Updates validation calls to converter.ValidateMarkdown.
internal/converter/builder/builder_system.go New system section builder + user/group/sysctl table builders.
internal/converter/builder/builder_security.go New security section builder (NAT + firewall + IDS).
internal/converter/builder/builder_network.go New network section builder + interface/VLAN/static route tables.
internal/converter/builder/builder_nat.go Adds inbound/outbound NAT table builders.
internal/converter/builder/builder_audit.go Updates audit section rendering (controls table, failures-only behavior, summaries/metadata).
GOTCHAS.md Documents plugin trust model, red mode stubs, sanitizer rule ordering contract.
docs/user-guide/commands/convert.md Updates device type docs (OPNsense + pfSense built-in) and plugin wording.
docs/user-guide/commands/audit.md Documents --failures-only and adds red mode “experimental” warning.
docs/development/plugin-development.md Adds explicit dynamic plugin security model and recommendations.
CONTRIBUTING.md Updates ReportComposer contract (SetFailuresOnly).
codecov.yml Adds project/patch coverage thresholds and comment layout settings.
cmd/validate_coverage_test.go Adds targeted unit tests to increase coverage for validate internals.
cmd/shared_flags_xml_test.go Adds tests for XML file shell completion helper.
cmd/sanitize.go Updates sanitize help text for minimal mode behavior.
cmd/sanitize_coverage_test.go Adds tests for sanitize output path selection/overwrite prompts.
cmd/root_coverage_test.go Adds tests for root build metadata accessors and lightweight context setup.
cmd/help_test.go Adds tests for fuzzy suggestions, flag grouping, and example formatting.
cmd/exitcodes_test.go Adds tests for exit code mapping and JSON error output helpers.
cmd/config_validate_coverage_test.go Adds tests for plain context output and unknown key warnings.
cmd/config_show_coverage_test.go Adds tests for plain config output grouping/formatting.
cmd/audit.go Adds stderr warning when red mode is selected.
cmd/audit_integration_test.go Adds integration-style tests for audit pipeline (JSON capture, file output, multifile).
action.yml Hardens action runner step (env inputs, allowlists, traversal validation, safer bash settings).
.goreleaser.yaml Disables stable docker tags for prereleases; simplifies stable tag list.
.github/workflows/release.yml Pins cyclonedx tool, skips docker on snapshot, fixes attestation failure handling, adds snapshot warnings.
.github/workflows/codeql.yml Adds CodeQL SAST workflow for Go (PR/push + weekly).
.github/workflows/ci.yml Makes Codecov upload fail CI on error; adds race detector job.
.github/copilot-instructions.md Updates architecture notes to remove internal/markdown from data flow.

Comment thread internal/export/file.go Resolved
Comment thread internal/export/file.go Resolved
Comment thread internal/sanitizer/rules_test.go Resolved
@unclesp1d3r unclesp1d3r self-assigned this Apr 3, 2026
@coderabbitai coderabbitai Bot added go Pull requests that update go code audit Phase 4.3 tasks - Audit Report Generation priority:normal Normal priority issue documentation Improvements or additions to documentation type:bug Bug or defect that needs fixing ci Continuous Integration related issues testing Test infrastructure and test-related issues and removed documentation Improvements or additions to documentation ci Continuous Integration related issues testing Test infrastructure and test-related issues go Pull requests that update go code audit Phase 4.3 tasks - Audit Report Generation priority:normal Normal priority issue type:bug Bug or defect that needs fixing labels Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration related issues documentation Improvements or additions to documentation refactor Code refactoring and restructuring security Security-related features and issues size:XXL This PR changes 1000+ lines, ignoring generated files. technical-debt Technical debt that needs to be addressed testing Test infrastructure and test-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants