Skip to main content

Press ESC to close

How to Verify Security Fixes with Codex, Deployment Checks, and Synthetic Alerts

Penetration Testing & AppSec9 minute readEvidence-led guidance

Executive Overview

A passing pull request check proves what the candidate satisfied. It takes a separate observation to confirm what actually deployed and a separate receipt to confirm where an alert went. This lab gives you all three records for one invoice-worker fix. Use run INV-042-R1 to see a valid plan pass, a deployed binding trigger a hold, and a corrected binding pass while the alert route delivers exactly one synthetic denial.

Download the invoice-worker lab and companion fixtures (ZIP). The invoice lab reads files and runs Conftest locally, then checks two fabricated deployment snapshots and routes two fabricated events in memory. It needs Python 3 and the Conftest release. The lab uses no cluster, SIEM credentials, tokens, or customer records. NIST’s Secure Software Development Framework recommends integrating security practices throughout development and addressing root causes to prevent recurrence.

1. Reproduce the Invoice-Worker Hold and Retest

Unzip the download and run this from its root. Use --conftest /path/to/conftest if the binary is outside your PATH.

python invoice/run.py --conftest conftest

The finding says the worker in invoice-fixture should run as invoice-reader-test. The rendered manifest in invoice/plans/intended.yaml selects that service account. The negative manifest selects shared-worker-test. Both point to the same synthetic image digest so the policy test isolates the identity field. The Rego rule INV-IDENTITY-001 scopes its assertion to the invoice-worker deployment and checks the pod template’s serviceAccountName. Test both manifests with Conftest before trusting the gate. The local run returned 0 for the intended plan and 1 with the expected rule ID for the broader plan.

Next compare the expected binding with the two sanitized deployment snapshots under invoice/data/. The first snapshot has revision 41, resource version 101, and the broader identity. The harness confirms the run ID, namespace, workload, and image digest before it compares the binding. The candidate can pass and promotion still goes on hold. In revision 42, resource version 102, the approved identity is observed for the same image and the deployment step passes. Resource version is recorded as an opaque identifier. The harness requires a fresh version and a newer fixture deployment revision.

Both the plan test and the snapshot comparison verify configured identity. An effective-permissions check needs its own evidence from the environment’s authorization mechanism and its own expected allow and deny outcomes against test resources. For a staging run, record the environment, workload, resource version and deployed image digest used by the operator. An identity field on the wrong workload or an old digest makes the observation inconclusive. See the security misconfiguration checklist for documenting intended state and drift.

See also  Software Supply Chain Security and SBOM Buyer Guide

Review what the negative fixture proves. Its policy ID tells you the intended rule caught the broadened binding. A syntax error, an unreadable input, or a different rule failure should stop the check with its actual error. A good fixture suite checks the result code and the policy ID together. If the application has several workloads, write fixture cases for the scope of each rule. A rule that applies only to the invoice worker should leave unrelated deployments to their own checks.

Invoice worker control test. The plan passes, deployment promotion is held for the wrong identity, then the binding and synthetic alert are retested.
The rendered identity policy passes, the deployed binding triggers a hold, and the fix and test alert are verified before promotion.

2. Follow the Same Test Run into the Alert Queue

The two events in invoice/data/events.json carry INV-042-R1, finding INV-042, and the observed deployment revision. The simulated collector accepts only records marked as fixtures that match the case’s scope. It verifies that the event’s revision, resource version and identity agree with the associated snapshot. Both events must be ingested before absence of an alert can count as a negative result.

Fixture Ingested Rule match Queue receipt
INV-042-E01 · identity policy denied Yes invoice-binding-denied-v1 ALERT-INV-042-E01 in appsec-fixture-inbox
INV-042-E02 · corrected binding Yes Quiet None expected

The printed receipt identifies the positive event at each step and preserves the quiet event’s ingestion record. The local queue is a list produced by the harness, so this proves how the fixture behaves. For an authorized staging check, use a dedicated test destination with paging and containment disabled for the fixture stream. Capture each result from the system that owns it: collector acknowledgement, evaluated rule and version, then receipt in the intended queue. A match with no receipt belongs to the routing owner. Missing ingestion belongs to the collector owner. Keep the clock and timeout you used with the test record. OWASP logging guidance covers what to exclude from event records.

Give repeated runs unique run IDs and record the observation window on each staging receipt. A delayed alert from an earlier run can otherwise look like proof that the latest route works. Carry the stable event ID into the queue record and compare it with the submitted event. Confirm that the quiet record reached the same collector and remained quiet through the same window. If the test ends before that window closes, report the result as pending.

3. Give Codex Three Bounded Jobs

Codex Security can bring forward repository findings and proposed patches for review. Give Codex the reviewed finding, the local fixture files, and the acceptance criteria. The automation below uses those inputs and produces artifacts a reviewer can check. Each job has a direct way to verify its result.

  1. Generate and check fixture changes. Give Codex the two plan files, the allowed service account, and the expected policy ID. Ask it to propose only the policy assertions and fixture changes for this case. Require a report with the file paths, expected exit codes, and actual Conftest results. Review the negative fixture first and rerun the command after approving its expected outcome.
  2. Compare plan and deployment evidence. Give Codex candidate.json and one sanitized snapshot. Ask for a field-by-field report of the run, namespace, workload, digest, resource version and observed identity. Have it flag a stale or out-of-scope record as inconclusive. The harness checks the scope and identity comparison, and the operator independently verifies where the snapshot came from.
  3. Assemble the release record. Feed Codex the candidate, deployment and routing receipts. Ask it to cite the source field for each row, retain the hold, and flag absent checks. Have CI attach its own machine-generated output. The release reviewer checks the link between observations and records the decision. GitHub Actions artifact documentation shows how to retain workflow output.
See also  How Do I Secure My Website From Cross-site Scripting (XSS) Attacks?

A useful prompt for the comparison job is Read only the supplied receipt JSON files. Report expected and observed identity, the scope fields that agree, and any field that is missing or different. Cite the input filename and JSON field for each fact. Return inconclusive if an observation cannot be tied to the intended deployment. Keep the three receipts verbatim beside the summary so a reviewer can reproduce the decision without relying on the model interpretation.

4. Record the Hold, Then Close It with the Retest

The same candidate record applies to both observations. It contains finding INV-042, merge commit 4e8ad7087beacac899d8d0e144bd66069a9066c3, policy INV-IDENTITY-001, and image digest sha256:9d6bf8d75d0b4ef41a2e78b6dc7daec7d484b402183a50fc6cf5463e61a5a41e. The digest identifies the artifact under review. The deployment revision and resource version identify the two observations. The event and alert IDs establish the routing result.

Attempt Observed evidence Decision and owner
Initial · revision 41 / resource 101 Candidate policy passed. Deployment reports shared-worker-test. Synthetic denial INV-042-E01 reaches the test queue as ALERT-INV-042-E01. Hold. Deployment owner corrects the binding and returns a fresh observation for the same image digest.
Retest · revision 42 / resource 102 Deployment reports invoice-reader-test for the same digest. INV-042-E02 is ingested and remains quiet. Pass for the exercise. Release reviewer closes this finding after checking both observations, the positive receipt, and the quiet control.

Save the initial hold and the retest together. If an artifact digest, scope field or observed result is missing, record inconclusive and name the owner who can produce the missing evidence. If the queue record never arrives after the collector and rule succeed, attach those two records to the routing investigation and repeat the positive case after the fix. Broader release criteria belong to the service’s existing change process.

Review the retest scope whenever a change touches more than the binding. The fixture keeps the same image digest because the correction changes configuration only. If a real fix rebuilds the worker, capture the new digest and repeat the candidate checks and deployment read-back for that build. If the rule or queue configuration changes, repeat the routing test and record the new version. The change ticket can retain the older evidence as history alongside the new decision.

See also  Security Misconfiguration Detection and Remediation Checklist

5. Extend the Checks with Gitleaks, Semgrep, Sigma and KQL

The download includes a companion/ directory with the full GitHub Actions workflow, both scanner configurations, the Sigma correlation rule, and the KQL query and their fixture runner. Use the companion to qualify detection or expand the pre-staging checks. For the broader testing workflow, see agentic self-testing. For more on collector and alert testing, see validating AppSec alerts with synthetic events.

In the Gitleaks exercise, a marker added and removed in separate commits fails the Git history check while the exported tree passes. In the Semgrep exercise, the intentional debug marker triggers the local rule. The Sigma example groups distinct rejected route families. The KQL example reconciles duplicate verifier events by service and event ID, rejects event conflicts, and evaluates fixed five-minute buckets. These are separate synthetic exercises that you can use after completing the invoice-worker case.

Three synthetic KQL cases. The exact duplicate case matches, the conflicting event stays quiet, and the fixed bucket boundary stays quiet.
Expected KQL fixture outcomes after deduplication, conflict rejection, and five-minute bucketing.

6. Match Each Claim to Its Verification Result

Check Verified result What to verify in your environment
Invoice policy and routing lab Conftest 0.71.1 returned 0 and 1 for the intended and broader manifests. Local fixture runner reported hold, pass, and one queue receipt. In staging, capture the effective deployment observation and the actual queue receipt.
Gitleaks and Semgrep Local Gitleaks 8.30.1 returned 0 for the clean range, 1 for the removed marker in history, and 0 for the exported clean tree. Local Semgrep 1.187.0 returned 0 for clean and 1 for the marker. Run the two jobs in a disposable repository. Confirm the clean PR passes, the Semgrep fixture fails Gate 2 and the removed marker fails Gate 1.
Hosted GitHub Actions and Docker actionlint 1.7.12 passed. Hosted runner and Docker transport execution remain unverified. Read back required job names and exit codes from the intended merge candidate.
Sigma route correlation pySigma SQLite backend 2.3.0 and SQLite 3.53.1 matched only the positive and cross-boundary groups. Convert to your SIEM backend and rerun the six cases under its actual window semantics.
KQL verifier outcomes The reference harness returned only orders, case-a, 3, 1. Native Kusto execution remains unverified. Run the inline fixture in a test Kusto environment and record the returned row, including the conflict and bucket boundary results.

For your first change ticket, pick a single finding and run the three checks against one candidate. Put the evidence where the next reviewer can find it, including the initial failure and the retest that resolved it.

Access ControlAI Securityapplication securitySecurity Testing

Jamieson-Don Consultants

Jamieson-Don Consultants publishes EncryptCentral to help business owners, security leaders, and technical teams turn cybersecurity evidence into decisions they can implement and verify. Our work draws on official advisories, recognized standards, vendor documentation, and attributable technical research. We explain what a control is for, who owns it, how to deploy it, where it can fail, and what evidence demonstrates that it is working. EncryptCentral is educational and independent: commercial relationships are disclosed, verified facts are separated from judgment, and our content does not replace legal, compliance, incident-response, or professional security advice.