Skip to content

feat: policy subcommand + documentation overhaul + USECASES#30

Merged
had-nu merged 5 commits intodevfrom
docs/policy-integration-and-usecases
Apr 3, 2026
Merged

feat: policy subcommand + documentation overhaul + USECASES#30
had-nu merged 5 commits intodevfrom
docs/policy-integration-and-usecases

Conversation

@had-nu
Copy link
Copy Markdown
Owner

@had-nu had-nu commented Mar 30, 2026

Summary

This PR delivers three related improvements that together make Wardex significantly more approachable and production-ready:


1. Documentation Alignment (fix(docs))

Resolved long-standing mismatches between the README instructions and the actual codebase:

  • All 4 READMEs (PT/EN/ES/FR): Replace go build -o wardex .make build so the binary lands in bin/wardex as the usage examples expect
  • README.md (PT): Remove non-existent --profile=minha-equipa flag from the 'Como Usar' example (caused RBAC error on first run)
  • CONTRIBUTING.md: Fix broken clone URL (github.com/github.com/...github.com/...)
  • RELEASES.md: Align release checklist and asset upload path with make build output

2. wardex policy Subcommand (feat)

New governance-as-code capability for managing compliance control state in versioned YAML files:

internal/policy/
  schema.go    # DomainFile -> Control -> Exception, O(1) status validation
  loader.go    # LoadDomain + LoadFramework (glob), schema-only validation

cmd/policy/
  policy.go    # PolicyCmd (exported), wired into rootCmd in main.go

frameworks/
  iso27001/
    technological_controls.yml   # A.8 template — 4 controls with full schema

Subcommands:

Command Purpose
wardex policy validate <dir> CI gate — fails fast if any YAML breaks schema
wardex policy list <dir> Tabwriter output: ID / title / status / owner / date
wardex policy add --file --id --title --status Upsert by ID, creates file if needed

Verified: make build && ./bin/wardex policy validate frameworks/iso27001/ && ./bin/wardex policy list frameworks/iso27001/ exits 0.


3. doc/USECASES.md — 10 Didactic Scenarios (docs)

Complete executable use cases documenting every major Wardex capability:

  1. Gap Analysis baseline (no --gate)
  2. Release Gate BLOCK (CVSS 9.1 + EPSS 0.84 → risk 2.8 > appetite 2.0)
  3. Release Gate ALLOW with compensating controls (WAF + segmentation + runtime)
  4. EPSS fail-close → wardex enrich epss HITL workflow
  5. Formal risk acceptance with expiry via wardex accept request/verify
  6. Multi-framework reports: ISO 27001 / NIS 2 / DORA / SOC 2 from same controls
  7. Log4Shell across 4 org profiles (14.2 bank vs 0.3 dev sandbox)
  8. wardex policy validate/list/add with pre-commit suggestion
  9. Snapshot delta: maturity evolution evidence between audits
  10. Full Grype → convert → enrich → gate GitHub Actions pipeline

Each scenario includes copy-paste inputs, step-by-step risk calculation, expected output, exit codes, and a 'What to learn' rationale.


Testing

make build
./bin/wardex --config=test/testdata/wardex-config.yaml \
             --gate=test/testdata/vulnerabilities.yaml \
             test/testdata/dummy_controls.yaml
./bin/wardex policy validate frameworks/iso27001/
./bin/wardex policy list frameworks/iso27001/

All exit 0.

had-nu added 5 commits March 30, 2026 23:55
…BUTING and RELEASES

- Fix duplicate domain in clone URL: github.com/github.com -> github.com
- Replace bare 'go build -o wardex .' with 'make build' for consistency
- Update release checklist to use 'make build' instead of 'go build'
- Align upload path with Makefile output: ./bin/wardex
- internal/policy/schema.go: DomainFile -> Control -> Exception structs
  Status type with O(1) validation via map[Status]bool (compliant | partial |
  non_compliant | not_applicable)
- internal/policy/loader.go: LoadDomain (single file) and LoadFramework (glob)
  with schema-only validation separated from business logic
  Errors always include the offending file path for debuggability
Three subcommands wired as cmd/policy/policy.go (package policy, PolicyCmd exported):
  - wardex policy validate <dir>: CI gate — fails if any YAML breaks schema
  - wardex policy list <dir>: tabwriter table with ID/title/status/owner/date
  - wardex policy add --file --id --title --status [--owner] [--note]:
    upsert by ID, creates file if it does not exist, writes with 0o600 perms

Flags --file, --id, --title are required; status defaults to non_compliant.
Example domain file for ISO 27001 Annex A.8 (Technological Controls).
Demonstrates the full schema: status vocabulary, evidence_refs, exceptions
with expiry and approved_by. Serves as a template for the 3 remaining
ISO 27001 domains (organizational A.5, people A.6, physical A.7).
Complete, executable use cases for all major Wardex capabilities:
  1. Compliance Gap Analysis baseline (wardex without --gate)
  2. Release Gate BLOCK — CVSS 9.1 + EPSS 0.84 => risk 2.8 > appetite 2.0
  3. Release Gate ALLOW — same CVE, WAF+segmentation+runtime => risk 0.9
  4. Missing EPSS fail-close flow and wardex enrich epss HITL workflow
  5. Formal risk acceptance with wardex accept request/verify
  6. Multi-framework reporting: ISO 27001 / NIS 2 / DORA / SOC 2
  7. Same CVE Log4Shell across 4 org profiles (14.2 bank vs 0.3 dev sandbox)
  8. wardex policy validate/list/add workflow with pre-commit guidance
  9. Snapshot delta: maturity evidence between audits (Jan->Mar)
 10. Full Grype -> convert -> enrich -> gate CI/CD pipeline in GitHub Actions

Each scenario includes: copy-paste inputs, internal risk calculation, expected
output, exit codes, and a 'What to learn' paragraph explaining the design intent.
@had-nu had-nu merged commit 8031f54 into dev Apr 3, 2026
1 check passed
@had-nu had-nu deleted the docs/policy-integration-and-usecases branch April 3, 2026 07:27
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