-
Notifications
You must be signed in to change notification settings - Fork 0
ABP Verification
verify_abp.py— standalone ABP verifier with 8 structural checks. Also callable fromverify_pack.py.
verify_abp.py validates an ABP artifact against 8 checks that cover structural validity, cryptographic integrity, authority binding, and logical consistency. It operates independently of the EDGE gate — the gate validates ABP-in-HTML, while the verifier validates the ABP artifact itself.
flowchart LR
ABP["abp_v1.json"] --> VERIFY["verify_abp.py"]
LEDGER["authority_ledger.ndjson"] -.->|"optional"| VERIFY
SCHEMA["abp_v1.json schema"] -.->|"optional"| VERIFY
VERIFY --> REPORT["Verification Report\n8 checks"]
REPORT --> PASS["PASS: ABP VALID"]
REPORT --> FAIL["FAIL: ABP INVALID"]
style PASS fill:#51cf66,color:#fff
style FAIL fill:#ff6b6b,color:#fff
| # | Check Name | What It Verifies | Requires |
|---|---|---|---|
| 1 | abp.schema_valid |
ABP validates against enterprise/schemas/reconstruct/abp_v1.json
|
jsonschema library (optional) |
| 2 | abp.hash_integrity |
Recomputed content hash matches recorded hash field |
— |
| 3 | abp.id_deterministic |
Recomputed ABP ID from scope + authority_ref + created_at matches abp_id
|
— |
| 4 | abp.authority_ref_valid |
authority_entry_id exists in ledger, hash matches, not revoked |
--ledger |
| 5 | abp.authority_not_expired |
ABP created_at falls within authority entry's effective/expires window |
--ledger |
| 6 | abp.composition_valid |
Parent/child references consistent; no duplicate child ABP IDs; parent_id/parent_hash paired | — |
| 7 | abp.no_contradictions |
No objective ID in both allowed and denied; no tool name in both allow and deny | — |
| 8 | abp.delegation_review_valid |
When present: no duplicate trigger IDs, valid severities (warn/critical), review_policy has approver_role and output. When absent: passes (optional section) | — |
Uses jsonschema library if installed. Validates against enterprise/schemas/reconstruct/abp_v1.json. If jsonschema is not installed, the check passes with a note. The schema path is auto-detected relative to the verifier's location.
Recomputes the content hash:
- Copy ABP object
- Set
copy["hash"] = "" - Compute
sha256(canonical_dumps(copy)) - Compare against
abp["hash"]
Any tampering with any field (except hash) will cause this check to fail.
Recomputes the ABP ID:
seed = canonical_dumps({
"scope": abp["scope"],
"authority_ref": abp["authority_ref"],
"created_at": abp["created_at"],
})
expected = "ABP-" + sha256(seed)[:8]Requires --ledger flag. Reads the NDJSON authority ledger and:
- Finds entry matching
authority_entry_id - Verifies
entry_hashmatchesauthority_entry_hash - Confirms
revoked_atis null (not revoked)
Without --ledger, this check is skipped with a note.
Requires --ledger flag and check #4 to have found the entry. Verifies:
authority.effective_at <= abp.created_at <= authority.expires_at
If expires_at is null, only the lower bound is checked.
Validates the composition section:
- If
parent_abp_idis set,parent_abp_hashmust also be set (and vice versa) - No duplicate
abp_idvalues inchildren[]
Checks for overlap between allow and deny lists:
- No objective ID in both
objectives.allowedandobjectives.denied - No tool name in both
tools.allowandtools.deny
When delegation_review is present:
- All trigger IDs must be unique
- All severities must be
"warn"or"critical" -
review_policymust haveapprover_roleandoutput
When absent, the check passes (it's an optional section).
python enterprise/src/tools/reconstruct/verify_abp.py \
--abp edge/abp_v1.jsonpython enterprise/src/tools/reconstruct/verify_abp.py \
--abp edge/abp_v1.json \
--ledger enterprise/artifacts/public_demo_pack/authority_ledger.ndjsonpython enterprise/src/tools/reconstruct/verify_abp.py \
--abp edge/abp_v1.json \
--schema enterprise/schemas/reconstruct/abp_v1.json| Flag | Description |
|---|---|
--abp PATH |
Path to ABP JSON file (required) |
--ledger PATH |
Path to authority ledger NDJSON (enables checks #4 and #5) |
--schema PATH |
Path to ABP JSON schema (auto-detected if omitted) |
============================================================
ABP Verification Report
============================================================
[PASS] abp.json_valid: Valid JSON
[PASS] abp.schema_valid: Validates against abp_v1.json
[PASS] abp.hash_integrity: Content hash verified
[PASS] abp.id_deterministic: ABP ID verified (ABP-bf0afe15)
[PASS] abp.authority_ref_valid: Authority AUTH-033059a5 valid and active
[PASS] abp.authority_not_expired: ABP created_at within authority window
[PASS] abp.composition_valid: 0 children
[PASS] abp.no_contradictions: No contradictions
[PASS] abp.delegation_review_valid: 4 triggers, policy output=abp_patch
------------------------------------------------------------
RESULT: ABP VALID (9/9 checks passed)
============================================================
Exit codes: 0 = valid, 1 = invalid.
verify_pack.py integrates ABP verification as part of full evidence pack validation:
python enterprise/src/tools/reconstruct/verify_pack.py \
--pack /tmp/pack \
--require-abpWhen --require-abp is set:
- Pack discovery looks for
abp_v1.jsonin the pack directory - If found, runs all 8 ABP verification checks
- If not found and
--require-abpis set, the pack verification fails - ABP checks are reported alongside replay, signature, log, and ledger checks
An admissibility pack with ABP:
pack_dir/
├── RUN-abc12345_20260221T000000Z.json # sealed run
├── RUN-abc12345_20260221T000000Z.json.sig.json # signature
├── RUN-abc12345_20260221T000000Z.manifest.json # manifest
├── transparency_log.ndjson # tamper-evident log
├── authority_ledger.ndjson # authority chain
├── abp_v1.json # ABP artifact
└── VERIFY_INSTRUCTIONS.md # human-readable guide
flowchart TD
PACK["Evidence Pack Directory"]
PACK --> REPLAY["Replay + Integrity\n(sealed run)"]
PACK --> SIG["Signature Verification\n(.sig.json files)"]
PACK --> LOG["Transparency Log\n(chain integrity)"]
PACK --> LEDGER["Authority Ledger\n(chain + signatures)"]
PACK --> ABP_V["ABP Verification\n(8 checks)"]
PACK --> DET["Determinism Audit\n(9 checks)"]
REPLAY & SIG & LOG & LEDGER & ABP_V & DET --> RESULT{"All Pass?"}
RESULT -->|"yes"| VALID["PACK VALID"]
RESULT -->|"no"| INVALID["PACK INVALID"]
style VALID fill:#51cf66,color:#fff
style INVALID fill:#ff6b6b,color:#fff
from pathlib import Path
from verify_abp import verify_abp
result = verify_abp(
abp_path=Path("edge/abp_v1.json"),
ledger_path=Path("enterprise/artifacts/public_demo_pack/authority_ledger.ndjson"),
)
# Check overall result
assert result.passed # True if all checks pass
# Iterate checks
for name, passed, detail in result.checks:
print(f"{'PASS' if passed else 'FAIL'} {name}: {detail}")
# Count failures
print(f"Failures: {result.failed_count}")The VerifyAbpResult class accumulates checks and provides:
-
checks— list of(name: str, passed: bool, detail: str)tuples -
passed— property:Trueif all checks pass -
failed_count— property: count of failed checks
Σ OVERWATCH — Coherence Ops Platform • Current release: v2.1.0 • DeepSigma
- Start
- Core
- Schemas
- FEEDS + Exhaust
- Integrations
- Reference Layer
- Ops
- Excel-First
- EDGE + ABP
- Domain Modes
- Governance
- Meta