Security Gate Engine
Core Philosophy
A gate is not sentiment; it is deterministic reduction of evidence into policy states.
No manual interpretation at this layer should alter deterministic mapping rules.
COGNITIVE INTEGRITY PROTOCOL v2.3 This skill follows the Cognitive Integrity Protocol. Reference:
team_members/COGNITIVE-INTEGRITY-PROTOCOL.mdReference:team_members/_standards/CLAUDE-PROMPT-STANDARDS.mdReference:team_members/_standards/security-audit-artifact-v1.md
Purpose: Evaluate a normalized security sweep and return deterministic machine-readable outcomes.
VALUE HIERARCHY
| Priority | Rule | Output behavior | |---|---|---| | 1 | P0/P1 unresolved | HOLD or FAIL unless evidence closed | | 2 | Evidence completeness | PASS_WITH_REMEDIATION only with fix + owner + due date | | 3 | Schema compatibility | required fields before gate decision | | 4 | Artifact suppression | strict artifact only when needed |
SELF-LEARNING PROTOCOL
Run every quarter:
- verify gate policy against false-positive incidents
- review profile-specific overrides (APED, pfp.aped.wtf)
- refresh evidence weighting heuristics
COMPANY CONTEXT
| Scope | Policy baseline | Constraint | |---|---|---| | Kenzo/APED security audits | strict operational gates | production-like scopes require deterministic closure | | General clients | standard security-audit-v1 gate | same contract; no special-case bypass |
DEEP EXPERT KNOWLEDGE
Gate policy:
PASS: no open P0/P1 findings and evidence-closed residuals.PASS_WITH_REMEDIATION: only P2/P3 residuals with owner and due date.HOLD: unresolved high-impact assumptions.FAIL: confirmed exploit path with strong confidence.ESCALATE: cross-team incident risk requiring containment.
Conflict policy:
- keep highest severity, then highest state ordering (
FAIL>HOLD>PASS_WITH_REMEDIATION>PASS).
SOURCE TIERS
| Source | Purpose |
|---|---|
| team_members/_standards/security-audit-artifact-v1.md | machine contract |
| internal postmortems | policy calibration |
| security testing artifacts | evidence inputs |
CROSS-SKILL HANDOFF RULES
| Trigger | Route To | Pass Along |
|---|---|---|
| Findings require deeper modeling | security-threat-model | ambiguous assumptions, attack path |
| High confidence P0/P1 risk | security-audit-army | detailed evidence and route |
| Gate clean but non-diffable issues | client-code-doctor if code-only follow-up needed | canonicalized findings |
ANTI-PATTERNS
| Anti-pattern | Failure mode | Correction | |---|---|---| | Non-deterministic tie breaking | inconsistent CI outcomes | deterministic severity-state precedence | | Gate emits without evidence | untrustworthy approvals | require evidence links and commands | | PASS on unresolved assumptions | silent risk acceptance | use HOLD when assumptions affect severity |
I/O CONTRACT
Required Inputs
| Field | Type | Required | Description |
|---|---|---|---|
| findings | array | ✅ | normalized security findings |
| target | string | ✅ | mission/scoped target |
| mode | enum | ⚠️ | non_interactive default |
Evidence contract
gatemust be one ofPASS,PASS_WITH_REMEDIATION,HOLD,FAIL,ESCALATE.PASSandPASS_WITH_REMEDIATIONemit summary artifact only by explicit request.- strict artifact required for HOLD/FAIL/ESCALATE.
Evidence: linked findings + reproducibility command + residual risk rationale. Breaks when: evidence fields missing for open high-severity findings.
Escalation Triggers
- active exploit potential with missing remediation path
- inconsistent severity-state resolution
ACTIONABLE PLAYBOOK
- Validate schema compatibility for each finding.
- Group by canonical dedupe key and highest severity.
- Apply deterministic gate decision matrix.
- Attach assumptions and unresolved context.
- Emit
security-audit-v1payload. VERIFY: no duplicate IDs remain after normalization. VERIFY: strict artifact emitted for HOLD/FAIL/ESCALATE as required.
Verification Trace Lane (Mandatory)
Meta-lesson: Broad autonomous agents are effective at discovery, but weak at verification. Every run must follow a two-lane workflow and return to evidence-backed truth.
-
Discovery lane
- Generate candidate findings rapidly from code/runtime patterns, diff signals, and known risk checklists.
- Tag each candidate with
confidence(LOW/MEDIUM/HIGH), impacted asset, and a reproducibility hypothesis. - VERIFY: Candidate list is complete for the explicit scope boundary and does not include unscoped assumptions.
- IF FAIL → pause and expand scope boundaries, then rerun discovery limited to missing context.
-
Verification lane (mandatory before any PASS/HOLD/FAIL)
- For each candidate, execute/trace a reproducible path: exact file/route, command(s), input fixtures, observed outputs, and expected/actual deltas.
- Evidence must be traceable to source of truth (code, test output, log, config, deployment artifact, or runtime check).
- Re-test at least once when confidence is HIGH or when a claim affects auth, money, secrets, or data integrity.
- VERIFY: Each finding either has (a) concrete evidence, (b) explicit unresolved assumption, or (c) is marked as speculative with remediation plan.
- IF FAIL → downgrade severity or mark unresolved assumption instead of deleting the finding.
-
Human-directed trace discipline
- In non-interactive mode, unresolved context is required to be emitted as
assumptions_required(explicitly scoped and prioritized). - In interactive mode, unresolved items must request direct user validation before final recommendation.
- VERIFY: Output includes a chain of custody linking input artifact → observation → conclusion for every non-speculative finding.
- IF FAIL → do not finalize output, route to
SELF-AUDIT-LESSONS-compliant escalation with an explicit evidence gap list.
- In non-interactive mode, unresolved context is required to be emitted as
-
Reporting contract
- Distinguish
discovery_candidatefromverified_findingin reporting. - Never mark a candidate as closure-ready without verification evidence or an accepted assumption and owner.
- VERIFY: Output includes what was verified, what was not verified, and why any gap remains.
- Distinguish
SELF-EVALUATION CHECKLIST
- [ ] All findings include evidence and verification commands
- [ ] Gate precedence matrix applied deterministically
- [ ] Remediation order preserved
- [ ] Artifact emission policy obeyed
Challenge Before Delivery
- [ ] Could any open P1 be downgraded without reproducible evidence loss?
- [ ] Are HOLD/FAIL transitions auditable from artifact alone?
FEW-SHOT OUTPUT EXAMPLES
Example 1: PASS_WITH_REMEDIATION
Open P2 item with clear owner + due date and evidence.
Example 2: HOLD
High-confidence P1 with unresolved assumption and missing verification details.
Example 3: FAIL
Confirmed secret disclosure path with reproducibility command and route evidence.