File size: 12,384 Bytes
ef6eb55 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | # PAX-Coder Implementation Verification Audit
**Date:** 2026-08-18
**Status:** CRITICAL GAPS IDENTIFIED
**Scope:** Verify that implementation matches documented commercial authorization flow
---
## Executive Summary
**Documentation vs. Implementation Mismatch Detected**
The documentation claims:
> PAX-Coder source is publicly cloneable for inspection and verification. Production authorization is separate: contact, approval, applicable commercial terms, and operator-issued Node Key provisioning are required before authorized production deployment.
The implementation has:
- β
**Integrity verification** (verify-clone): Real, working, cryptographic (Ed25519, Blake3)
- β
**Authorization record structure** (authorization.json): Defined, validated by verify-node-authorization
- β
**Node identity generation** (generate_node_key.sh): Creates identity only, does NOT auto-authorize
- β οΈ **Authorization record creation**: **Placeholder only; no real provisioning mechanism exists**
- β **Authority signature verification**: **NOT IMPLEMENTED** (line 184-191 in pax-coder-gate: "TODO: Wire this to server public key for real verification")
- β **Authority keypair**: **NOT IN REPOSITORY** (correct), but **no external authority mechanism to create signatures**
- β οΈ **Node authorization binding**: Structure exists, but cannot be provisioned without authority
---
## Detailed Findings
### 1. SELF-GENERATED NODE KEY CANNOT BECOME AUTHORIZED β
**Test:** Can a locally-generated node key self-authorize?
**Finding:** YES, the code prevents self-authorization.
**Evidence:**
- `sovereign/generate_node_key.sh` (line 9): "UNAUTHRIZED (not provisioned by PAX-Coder authority)"
- `sovereign/generate_node_key.sh` (line 12-16): Documents that authorization requires "signed authorization capability" from authority
- Script generates identity (node.json, node_pk.pem) but **cannot create authorization.json**
**Status:** β
PASS β Self-generation is identity only.
---
### 2. VALID NODE KEY WITHOUT OPERATOR AUTHORIZATION CANNOT AUTHORIZE PRODUCTION β οΈ PARTIAL
**Test:** Does a node with valid identity but no authorization allow protected operations?
**Finding:** Partially enforced.
**Current state:**
- `scripts/verify-node-authorization` checks authorization.json status (line 76-100)
- Fails on REQUESTED, SUSPENDED, REVOKED, EXPIRED (correct logic)
- But the authorization.json in the repo has:
- `authorization_status`: "REQUESTED" (not ACTIVE)
- `revocation_status`: "REVOKED" (explicitly revoked)
- `authority_signature`: "placeholder_pending_authority_implementation" (NOT A REAL SIGNATURE)
**Problem:**
- There is **NO MECHANISM TO CREATE A REAL authorization.json**
- The one in the repo is a test fixture with status="REQUESTED" and revoked
- No script exists that creates a production-valid authorization.json with:
- `authorization_status`: "ACTIVE"
- Real `authority_signature` (not placeholder)
- Future `expires_at_utc`
**Status:** β οΈ PARTIAL β Structure exists, enforcement works for test fixture, but no real provisioning mechanism.
---
### 3. EXPIRED/REVOKED AUTHORIZATION FAILS β
**Test:** Does the gate deny expired or revoked authorization?
**Finding:** YES, in the test fixture.
**Evidence:**
- `scripts/verify-node-authorization` (line 102-115): Checks revocation_status, denies if REVOKED
- Line 118-127: Checks expiration_time, denies if past expires_at_utc
- `scripts/test_node_authorization.sh`: All tests pass (7/7), including expiration and revocation
**Status:** β
PASS β Expiration and revocation checks work correctly.
---
### 4. AUTHORIZATION BOUND TO INTENDED NODE β
**Test:** Can authorization.json be used with a different node's keypair?
**Finding:** NO, binding is enforced.
**Evidence:**
- `scripts/verify-node-authorization` (line 130-142): Checks that node_id in authorization.json matches node.json
- Fails if IDs don't match (exit 2)
- Cannot use node B's private key with node A's authorization
**Status:** β
PASS β Node binding is verified.
---
### 5. AUTHORIZATION SCOPE IS ENFORCED β οΈ PLACEHOLDER
**Test:** Are different authorization scopes enforced with different capabilities?
**Finding:** Scope field exists but is NOT enforced in protected operations.
**Evidence:**
- `sovereign/authorization.json` (line 6): Has `"authorization_scope": "protected-execution"`
- `scripts/verify-node-authorization` (line 55): Extracts scope but only logs it
- `scripts/pax-coder-gate` (line 108-135): Does NOT check scope at all
- No capability mechanism validates scope against operation
**Problem:** Scope exists in authorization record but is not enforced anywhere.
**Status:** β οΈ PARTIAL β Structure exists, enforcement missing.
---
### 6. PRIVATE SIGNING AUTHORITY IS NOT IN REPOSITORY β
**Test:** Is the authority's private key exposed?
**Finding:** NO, correctly not in repository.
**Evidence:**
- `sovereign/authorization.json`: Contains only `node_public_key_hex` (public)
- Authority signature is a placeholder string
- No `.authority_sk`, `.auth_private_key`, or similar files in repo
- Authority would be external (not in codebase)
**Status:** β
PASS β Authority key correctly kept external.
---
### 7. VERIFIER IS NOT ACCEPTING LOCAL CONFIG AS AUTHORITY β οΈ PARTIAL
**Test:** Is the verifier trusting locally-provided authorization values?
**Finding:** Yes, partially. The authorization.json is **read from the local repository**.
**Current implementation:**
- `scripts/verify-node-authorization` (line 24): Reads `sovereign/authorization.json` from local filesystem
- Uses that JSON's status field directly (line 54)
- No cryptographic verification of the authority_signature (line 11: placeholder)
**Problem:**
- If an attacker modifies `sovereign/authorization.json` to set `authorization_status: ACTIVE`, the gate would allow it
- The `authority_signature` is not verified (it's just a string check for format in pax-coder-gate line 199)
- Real implementation would need:
1. Authority's **public key** hardcoded or fetched securely
2. Ed25519 signature verification of the entire authorization.json
3. Rejection if signature doesn't match
**Status:** β οΈ ISSUE β Local file is trusted. Signature verification is TODO.
---
## The Provisioning Flow Gap
**Documented flow:**
```
CONTACT
β
APPROVAL
β
COMMERCIAL AGREEMENT
β
NODE PROVISIONING
β
OPERATOR-SIGNED AUTHORIZATION
β
PROTECTED OPERATION
```
**Actual implementation:**
```
CONTACT
β (documented in CONTACT.md)
APPROVAL
β (no code, manual process)
COMMERCIAL AGREEMENT
β (no code, manual process)
NODE PROVISIONING
β (no code to create authorization.json)
???
β (no script to sign authorization.json with authority key)
OPERATOR-SIGNED AUTHORIZATION
β (would require real Ed25519 signature)
LOCAL authorization.json with ACTIVE + valid signature
β (current code trusts status field, doesn't verify signature)
PROTECTED OPERATION
```
**Missing:**
1. **Script to create authorization.json** (currently only a test fixture with status="REQUESTED")
2. **Authority key** (would be external, not in repo β correct)
3. **Signing mechanism** to create real Ed25519 signatures over authorization.json
4. **Signature verification in pax-coder-gate** (currently just format check, see line 184-191: "TODO: Wire this to server public key")
---
## What Works β
1. **Integrity verification (verify-clone)** β Cryptographically sound
2. **Node identity generation** β Cannot self-authorize
3. **Authorization structure** β Correctly defined
4. **Status validation** β ACTIVE/REQUESTED/SUSPENDED/REVOKED/EXPIRED states work
5. **Expiration checking** β Works correctly
6. **Revocation checking** β Works correctly
7. **Node binding** β Verified against identity
8. **Test suite** β All 7 node authorization tests pass, all 6 gate tests pass
9. **Authority key separation** β Correctly external
---
## What Doesn't Work β
1. **Authority signature verification** β Not implemented (TODO in code)
2. **Authorization record provisioning** β No script to create real signed authorizations
3. **Scope enforcement** β Scope field exists but not checked
4. **Authority key integration** β Would need to wire external authority into gate
---
## Implications
### Current State: Theater + Placeholder
The gate currently:
- β
Verifies integrity (real)
- β οΈ Reads authorization status (trusts local JSON, no signature check)
- β οΈ Accepts capability tokens (format-checks hex, doesn't verify signature)
- β
Enforces node binding (real)
- β
Checks expiration (real)
**A user could:**
1. Clone the repo
2. Edit `sovereign/authorization.json` to set `authorization_status: "ACTIVE"`
3. The gate would now allow protected operations (because signature is not verified)
**This is NOT a security boundary yet.**
### Why This Matters
The documentation promises:
> operator-issued Node Key provisioning are required before authorized production deployment
The implementation provides:
> A placeholder authorization.json that can be locally modified (no signature verification)
**Gap:** Production authorization is documented but not cryptographically enforced.
---
## To Close the Gap
Three steps required:
### 1. Authority Provisioning Mechanism
Create a script (run by authority, not in repo):
```bash
# authority-sign-authorization.sh (on secure server only, NOT in public repo)
#
# Input:
# - node_public_key_hex
# - commercial_agreement_id
# - tier (Individual/Commercial/Enterprise)
# - expires_at_utc
#
# Output:
# - authorization.json with real Ed25519 signature
# - authority_signature = Ed25519_sign(authority_private_key, blake3(authorization_json))
```
### 2. Authority Public Key Hardcoding
Add to `docs/adr/0010` or pax-coder-gate:
```bash
# Public key of signing authority (Ed25519)
AUTHORITY_PUBLIC_KEY="base64_encoded_authority_public_key_hex"
```
This is safe to hardcode (only verification, not signing).
### 3. Signature Verification in Gate
Replace TODO at line 184-191:
```bash
# Verify capability signature using authority public key
if ! verify_ed25519_signature \
"$AUTHORITY_PUBLIC_KEY" \
"$CAPABILITY_JSON" \
"$CAPABILITY_SIGNATURE"; then
echo "DENIED: Capability signature invalid (failed verification)"
exit 2
fi
```
---
## Recommendation
**Do NOT ship this as production authorization yet.**
The documentation is sound, but the implementation has a critical gap:
- Authority signatures are **not verified**
- Local authorization.json file **can be modified without detection**
- This is a placeholder gate, not a real one
**Before shipping:**
1. Create authority-provisioning mechanism (external script)
2. Add authority public key to gate
3. Implement Ed25519 signature verification
4. Re-run all tests with real signed authorizations
5. Document the external authority workflow
Until these steps are done, the gate is:
- β
Correct for **integrity verification**
- β οΈ Incomplete for **production authorization**
---
## Test Outcomes
**Current test suite results:**
```
test_node_authorization.sh 7/7 β
test_protection_gate.sh 6/6 β
```
**These tests use a placeholder authorization.json.** They verify the *logic* but not the *security*.
**To verify security, would need:**
1. Test with real Ed25519-signed authorization.json
2. Test that locally-modified authorization.json is rejected
3. Test that tampered capability signatures fail
4. Test that authority public key verification works
These tests don't exist yet.
---
**Status:** IMPLEMENTATION COMPLETE FOR STRUCTURE; AUTHORITY VERIFICATION INCOMPLETE
**Next:** Implement authority key integration and signature verification
**Date:** 2026-08-18
**ADR Reference:** ADR-0009 (Protected Execution Capability), ADR-0010 (Public/Authorization Separation)
---
*Bel Esprit D'Accord Irrevocable Trust Β· SnapKitty West Β· Evidence or Silence β 2026*
|