Skip to content

feat(compliance): add optional Href field to Control for linking control IDs to documentation #508

@unclesp1d3r

Description

@unclesp1d3r

Summary

Add an optional Href field to compliance.Control and common.ComplianceControl so that control IDs in reports can link to their relevant documentation (STIG viewer, SANS checklist, NIST references, etc.).

Problem

Control IDs like V-206694, SANS-FW-012, and FIREWALL-029 appear in audit reports but provide no direct path to the authoritative documentation. Auditors must manually search for the control definition.

Proposed Solution

Add Href string to both:

internal/compliance/interfaces.goControl struct:

type Control struct {
    ID          string
    Href        string            `json:"href,omitempty"` // Link to control documentation
    Title       string
    // ... existing fields
}

pkg/model/enrichment.goComplianceControl export model:

type ComplianceControl struct {
    ID     string `json:"id,omitempty" yaml:"id,omitempty"`
    Href   string `json:"href,omitempty" yaml:"href,omitempty"`
    Status string `json:"status" yaml:"status"`
    // ... existing fields
}

Markdown rendering

In writePluginControlsTable, render the Control ID as a markdown link when Href is set:

controlID := ctrl.ID
if ctrl.Href != "" {
    controlID = fmt.Sprintf("[%s](%s)", ctrl.ID, ctrl.Href)
}

Plugin population

Each plugin sets Href on its controls:

Plugin Example Href
STIG https://stigviewer.com/stig/firewall_security_requirements_guide/finding/V-206694
SANS https://www.sans.org/media/score/checklists/FirewallChecklist.pdf
Firewall docs/firewall-security-controls-reference.md (local docs link)

Mapping

mapControls in cmd/audit_handler.go copies Href from compliance.Control to common.ComplianceControl during conversion.

Acceptance Criteria

  • Href field added to compliance.Control and common.ComplianceControl
  • mapControls copies Href during mapping
  • Markdown report renders Control ID as [ID](href) when Href is set
  • JSON/YAML exports include href field when set
  • All three plugins populate Href on their controls
  • model-reference.md regenerated

Related

Metadata

Metadata

Assignees

Labels

audit-modeRelated to audit and compliance functionalitycomplianceCompliance scanning and audit featuresenhancementNew feature or requestgoPull requests that update go codepriority:normalNormal priority issuesp:2Story Points: 2 (small)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions