Skip to content

Add strict QSL Activation v1 contract - #203

Merged
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p0-activation-v1-strict-contract-local-only-20260805
Aug 4, 2026
Merged

Add strict QSL Activation v1 contract#203
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p0-activation-v1-strict-contract-local-only-20260805

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a closed qsl.activation.v1 schema bound to one exact DeploymentBundle identity
  • add a dependency-free, fail-closed validator for stage authority, target identity, UTC windows, self-digest, mismatch, reuse, stale and expired inputs
  • add synthetic tests for canonical stages and negative security/identity cases

Safety boundary

  • contract-only (contract_only=true)
  • no apply/config-sync/deploy/runtime mutation
  • no authority creation, provider, credential, broker, order, fill, capital, paper, shadow, or live action
  • canonical stage names follow the current source-of-truth: PAPER_DRY_RUN and FULL_LIVE

Validation

  • focused Activation + DeploymentBundle: 22 passed
  • full Python suite: 153 passed
  • runtime/config validation, fresh-consumer strict matrix, Ruff, compile, JSON schema parse, temporary package build, actionlint, Node, diff/scope and static secret gates

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit fd84735 into main Aug 4, 2026
6 checks passed
@Pigbibi
Pigbibi deleted the codex/qsl-p0-activation-v1-strict-contract-local-only-20260805 branch August 4, 2026 16:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0503a1a9a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +243 to +244
if expected_authority is None:
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require a trusted authority before validating

When expected_authority is omitted, validation accepts any self-declared authority ID and receipt digest, and the CLI always takes this path because it has no authority input. An activation author can therefore fabricate human_authority, recompute the unkeyed activation hash, and receive a successful validation result without demonstrating the claimed human authorization; require a trusted expected authority for full validation or make the CLI obtain and compare one.

Useful? React with 👍 / 👎.

Comment on lines +235 to +239
target = root["target"]
if target["platform"] != bundle["target"]["platform_id"]:
_fail("activation target does not match deployment bundle target")
if target["revision"] != bundle["dependencies"]["platform"]["revision"]:
_fail("activation platform revision does not match deployment bundle platform revision")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bind the declared activation target to the bundle target

When multiple environments or accounts use the same platform revision, these checks accept contradictory targets: a bundle whose target.id identifies one deployment can be paired with an activation declaring an unrelated environment/account because only the platform ID and revision are compared. The hashes preserve both conflicting declarations rather than preventing them, so a consumer routing from activation.target can apply the wrong bundle; expose and verify an activation target identifier against bundle["target"]["id"].

Useful? React with 👍 / 👎.

if expected_bundle is None:
_fail("expected qsl.deployment_bundle.v1 is required")
try:
bundle = validate_bundle(expected_bundle)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject activations that predate their bundle

When a valid expected bundle has a created_at later than the activation's created_at—or even later than the current as_of time—this path accepts it without comparing the timestamps. The result is a supposedly effective activation that claims to bind an immutable bundle before that bundle existed, undermining audit chronology; compare the parsed bundle creation time against the activation creation/effective times.

Useful? React with 👍 / 👎.

from pathlib import Path
from typing import Any, Mapping

from deployment_bundle_contract import BundleValidationError, parse_bundle_json, validate_bundle

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use a package-relative import for the sibling contract

When this project is installed or invoked as a package, such as PYTHONPATH=python python -m scripts.activation_contract, this absolute import searches for a top-level deployment_bundle_contract module and fails with ModuleNotFoundError; the tests conceal the problem by preloading that name into sys.modules. Import the sibling relatively (with an executable-script fallback if direct file execution must remain supported) so the packaged validator is usable.

Useful? React with 👍 / 👎.

Comment on lines +260 to +262
reused = any(
previous_authority[field] == current_authority[field]
for field in ("authority_id", "authority_receipt_sha256")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Check authority reuse across the full activation history

When stages cycle, checking only the immediately preceding activation permits an older authority receipt to be replayed: for example, PAPER with receipt A, then SHADOW with receipt B, then PAPER with receipt A passes because the final validation compares A only with B. This violates the stated cross-stage reuse prohibition even when callers consistently supply the immediate predecessor, so validate against the target's authority history or a persistent receipt-use registry rather than one activation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant