Skip to content

Add TLC-backed webhook gateway specification and threat model - #79283

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/webhook-gateway-formal-model
Nov 19, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/webhook-gateway-formal-model

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Make the webhook gateway's security contract executable and document which guarantees depend on external integrations rather than shipped destination checks.

  • Add a bounded TLA+ model covering source admission, discovery and worker fencing, durable replay/recovery, App provenance, and hash/artifact-bound continuation.
  • Generate a reproducible security threat model with pinned TLC tooling, input hashes, counterexample traces, and explicit assumptions and residual risks.
  • Link the gateway specification to the model and provide a standalone checker and evidence-classification tests.

The secure model exhausts 23,620 distinct states with 18 invariants satisfied. All 18 deliberately weakened controls fail their expected invariants, and six reachability witnesses demonstrate positive behavior. These are bounded contract checks, not implementation proofs or discovered vulnerabilities. Receiver and admission-server behavior remains an external integration responsibility; runtime behavior is unchanged.

Validation

  • make agent-report-progress
  • PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s specs/webhook-gateway -p '*_test.py'
  • python3 specs/webhook-gateway/check.py --results "$TMPDIR/webhook-gateway-tlc-verified" --report specs/webhook-gateway/threat-model.md with Java 21 and checksum-pinned TLA+ Tools v1.7.4 (TLC 2.19): all 25 cases produced their expected results.
  • Verified generated evidence against model, configuration, source, and TLC-log hashes.

Model source admission, fenced discovery and dispatch, durable replay recovery, and destination provenance and workflow admission. Generate a reproducible threat model with negative controls and reachability witnesses.

Co-authored-by: Copilot App <[email protected]>
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
Comment thread specs/webhook-gateway/check.py Fixed
pelikhan and others added 2 commits November 19, 2026 06:17
Map bounded counterexamples to the existing replay, fencing, provenance, artifact admission, and continuation requirements. Record verification limits and refresh evidence for the updated specification.

Co-authored-by: Copilot App <[email protected]>
Label grouped specification findings WGT-001 through WGT-005 and refresh TLC evidence for the updated specification.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan marked this pull request as ready for review November 19, 2026 15:58
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 15:58
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #79283 · codex · routed: gpt61 medium · ~5 AIC · ⊞ 185 · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Specification Reviewer has started processing this pull request

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

Address CodeQL review feedback without changing rendered report bytes; refresh pinned TLC evidence for the updated checker.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan merged commit a054b07 into main Nov 19, 2026
85 checks passed
@pelikhan
pelikhan deleted the pelikhan/webhook-gateway-formal-model branch November 19, 2026 16:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The model evidence does not substantiate the claimed generation-fencing and crash-recovery guarantees, while checker path, timeout, and report-link defects undermine reliable verification.

6 open issues
What changed in this PR

Adds a bounded, executable security contract for the webhook gateway, distinguishing shipped destination checks from external receiver and admission-server responsibilities. Runtime behavior is unchanged.

Changes:

  • Add a TLA+ model covering admission, discovery and worker fencing, replay/recovery, and continuation.
  • Add a checksum-pinned TLC checker, evidence-classification tests, and generated threat-model reports.
  • Link the formal evidence and its limitations into the gateway specification.
File Description
specs/​webhook-gateway/​WebhookGateway.tla Defines gateway states, security invariants, faults, and reachability witnesses.
specs/​webhook-gateway/​WebhookGateway.cfg Configures the secure baseline and 18 invariants.
specs/​webhook-gateway/​threat-model.md Summarizes results, counterexamples, assumptions, and residual risks.
specs/​webhook-gateway/​threat-model.json Records TLC results, commands, tool identity, and evidence hashes.
specs/​webhook-gateway/​README.md Documents reproduction, model bounds, and maintenance.
specs/​webhook-gateway/​check.py Runs TLC cases and generates evidence reports.
specs/​webhook-gateway/​check_test.py Tests fail-closed classification of TLC output.
docs/​src/​content/​docs/​specs/​webhook-gateway-specification.md Links formal evidence and summarizes contract-level security implications.

Review effort: Max (adaptive)

Comment on lines +40 to +41
/\ ((s.approved /\ s.candidate = s.generation)
\/ Bypass("stale-publication"))
NoKnownRetry == ~(s.attempts = 2 /\ s.accepted = 1)
NoDuplicate == ~s.duplicateSeen
NoConflict == ~s.conflictSeen
NoCrash == ~s.crashed
]
WITNESSES = ["NoAgent", "NoUncertainty", "NoKnownRetry", "NoDuplicate", "NoConflict", "NoCrash"]
INPUTS = [
ROOT / "WebhookGateway.tla", ROOT / "WebhookGateway.cfg", Path(__file__),
Comment on lines +213 to +215
"Reproduce with the commands in [README.md](README.md). "
+ "Measured input hashes, Java identity, run time, per-case verdicts, exit statuses "
+ "and log hashes are in [threat-model.json](threat-model.json).", "",
Comment on lines +259 to +262
result = subprocess.run(command, cwd=directory, capture_output=True, text=True, timeout=120)
output = result.stdout + result.stderr
log = directory / "tlc.log"
log.write_text(output)
Comment on lines +35 to +40
The [TLC-backed threat model](https://github.com/github/gh-aw/blob/main/specs/webhook-gateway/threat-model.md)
records an exhausted secure baseline of **23,620 distinct states**, with all
18 invariant checks satisfied. Each of 18 deliberately weakened controls
produces its expected counterexample. Six reachability witnesses establish that
valid activation, uncertain outcomes, known-nonacceptance retries, duplicate and
conflicting receipts, and restart are reachable with security invariants enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants