← Back to Pull requests

securitypolicy: honor LCOW AMD certificate annotation #2962

Closed
unknown closed this pull request without merging on Oct 15, 2026 18:45 UTC
View on GitHub
unknown unknown commented on Oct 12, 2026 13:35 UTC
Author

Problem

SecurityOptions.WriteSecurityContextDir is shared by the LCOW guest and the WCOW GCS sidecar, but currently reads the host AMD certificate only from annotations.WCOWHostAMDCertificate. A certificate supplied under annotations.LCOWHostAMDCertificate is silently omitted from host-amd-cert-base64. If the certificate is the only security-context input, no directory or UVM_SECURITY_CONTEXT_DIR environment variable is created.

Change and compatibility

Read LCOWHostAMDCertificate first and fall back to WCOWHostAMDCertificate when the LCOW value is missing or empty.

This ports the downstream LCOW annotation fix with one deliberate upstream compatibility adjustment: retain the existing WCOW lookup as a fallback rather than removing it. HostAMDCertificate is a deprecated alias of LCOWHostAMDCertificate, not a separate annotation key, so no additional generic-key fallback is needed. When both keys are non-empty, LCOW takes precedence.

The existing policy, UVM reference information, hash-envelope reference information, TCB/platform reference information, directory handling, and environment injection remain unchanged. No caller, annotation definition, dependency, or file-permission changes are included.

Regression coverage

A platform-neutral table-driven test covers LCOW, the deprecated generic alias, WCOW-only inputs, conflicting values, empty LCOW fallback, nil/empty annotations, and empty certificate values. Each case runs both with the certificate alone and alongside the other security-context inputs, checking exact file contents, directory creation/no-op behavior, and environment preservation.

Before the fix, the LCOW, generic-alias, and conflicting-value cases failed on both Windows and Linux. All 16 leaf cases pass after the fix.

Validation

Validated with Go 1.26.8 on Windows/amd64 and Linux/amd64:

  • go test -v ./pkg/securitypolicy -run '^TestWriteSecurityContextDirAMDCertificate$' -count=1

  • go test -tags=rego -timeout=30m ./pkg/securitypolicy/...

  • Windows: go build -tags=rego ./cmd/gcs-sidecar

  • Linux: go build -tags=rego ./cmd/gcs

  • gofmt and git diff --check
  • No live SEV-SNP workload or attestation end-to-end validation was performed for this upstream port. This PR is intentionally opened as a draft for review.

    Diff: 292 lines (+219 / -73) across 3 files Reviewer: jterry75 Review duration: 4629m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 292 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.340
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #2962"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.1% (MEDIUM) · Higher = larger blast radius
    63.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.9% · Safe to merge
    24.9%