Skip to content

fix(sovereign-agent-connector): reject boolean GCP claims, invalid validity_seconds, and non-canonical base64url signatures (#379) - #384

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-auc-379
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-auc-379

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Closes #379

Summary

  • Reject boolean iat, exp, and instance_id (and empty instance_id) in make_gcp_placement_assertion.
  • Validate type(validity_seconds) is int and validity_seconds > 0 and canonical 64-char lowercase hex workload_key across make_placement_assertion, make_azure_placement_assertion, and make_gcp_placement_assertion.
  • Enforce canonical unpadded 64-byte base64url signatures and 64-char lowercase hex trusted_key_hex in agentrust_auc.core._unb64 and _verify_signed.
  • Add unit tests in examples/sovereign-agent-connector/tests/test_appraisal.py.

Validation

  • pytest examples/sovereign-agent-connector/tests/test_appraisal.py -q — passed (14 passed)

@drk-ram
drk-ram requested review from a team, carloshvp and imran-siddique as code owners October 25, 2026 07:00
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 25, 2026
carloshvp
carloshvp previously approved these changes Oct 25, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed exact head c17d8244b79cda2624fc6477ce0a4ceeff8f0970 in an isolated checkout.

The software example rejects boolean GCP numeric claims, invalid validity intervals, malformed public-key hex and noncanonical/wrong-length signatures, while preserving the valid signed placement/appraisal controls. All 53 example tests pass; the focused control fails with the baseline appraisal/core modules restored. I resolved the example's declared requirements into a fresh local hash lock; pip check, scoped example/repository Ruff and diff whitespace checks pass. Operator placement assertions, verified token claims and hardware evidence remain separate. No blocking finding in the changed example; hosted CI and maintainer policy remain separate.

Reviewed with OpenAI Codex.

@rajnisht7 rajnisht7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

independent_verify.py still accepts padded base64url signatures.

tools/independent_verify.py has:

def decode_b64url(value: str) -> bytes:
    return base64.urlsafe_b64decode(value + "=" * (-len(value) % 4))

verify_ed25519() uses it directly, no canonical re-encode check, no 64-byte length check on the signature, and no lowercase 64-char hex check on the trusted key.

also confirmed a signature with a trailing = is rejected by core._verify_signed but accepted by the independent verifier. The docs describe independent_verify.py as a clean-room reproduction of the same wire semantics, so the two paths should agree.

kindly update decode_b64url (and the key check in verify_ed25519) to match the rules in core._unb64 / _verify_signed, and add a test that a padded signature is rejected. That keeps the independent path consistent with the producer.

@dinakarjs dinakarjs 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.

Source follow-up at c17d824. The changed core verifier has canonical base64url and key-format checks, but the added padded-signature test calls only core._verify_signed. It therefore does not cover the independent-verifier discrepancy reported by Rajnish.

Please exercise the same intact signed artifact through both verifier entry points, then alter only its textual signature encoding by adding padding. The canonical control should remain accepted and the same-byte padded representation should be refused by both. Add independent wrong-length signature and malformed trusted-key controls so one validation failure does not hide another. Preserve the independent implementation while aligning the documented wire semantics.

This is a source/test-coverage follow-up to the existing report, not a claim of a fresh local reproduction or test run. Reviewed with OpenAI Codex.

…lidity_seconds, and non-canonical base64url signatures (agentrust-io#379)

- Reject boolean GCP numeric claims, non-string/blank GCE instance_id,
  non-positive or non-int validity_seconds, and non-hex workload_key in
  agentrust_auc/appraisal.py.
- Enforce canonical unpadded base64url signatures (64 decoded bytes) and
  64-character lowercase hex trusted keys across both agentrust_auc/core.py
  (_unb64 / _verify_signed) and tools/independent_verify.py (decode_b64url /
  verify_ed25519).

Closes agentrust-io#379

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram

drk-ram commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@rajnisht7 @dinakarjs @carloshvp Rebased onto origin/main and updated at HEAD:

  1. Align independent_verify.py wire semantics with core.py (examples/sovereign-agent-connector/tools/independent_verify.py, agentrust_auc/core.py): Updated decode_b64url and verify_ed25519 in tools/independent_verify.py to enforce canonical unpadded base64url ([A-Za-z0-9_-]+, len % 4 != 1, round-trip re-encode equality), 64-byte decoded Ed25519 signature length, and 64-character lowercase hex ([0-9a-f]{64}) on trusted_hex, matching core._unb64 / core._verify_signed.
  2. Independent dual-entry-point regression tests (tests/test_appraisal.py, tests/test_independent_verifier.py): Added separate parametrized tests exercising the same intact signed placement artifact through both core._verify_signed and independent_verify.verify_ed25519, confirming the canonical artifact passes both and that:
    • appending = or == padding (same decoded bytes, non-canonical text) is rejected by both verifiers;
    • wrong-length canonical base64url signatures (0, 32, 63, 65 bytes) are rejected by both verifiers;
    • malformed/uppercase/whitespace trusted public keys are rejected by both verifiers (45 passed).

@dinakarjs dinakarjs 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.

Re-reviewed exact head 6b95166 on Linux/Python 3.12.14.

The core and independent signature paths now enforce canonical unpadded base64url, 64-byte Ed25519 signatures and lowercase trusted-key text consistently. I checked the intact signed controls and padding/key/length refusal cases across both entry points. All 72 sovereign-agent-connector tests pass in a fresh environment installed from this example's declared requirements; whitespace passes. My previous independent-verifier follow-up is addressed. These requirements are version declarations, not a fully hash-pinned lock, and the evidence remains bounded to the software example and fixtures; hosted acceptance remains separate.

Reviewed with OpenAI Codex.

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed current head 6b95166f7336305c1c5b1b3eb8c6b92b04c4c150 in an isolated checkout.

The GCP and validity checks reject booleans/malformed values, and core plus independent signature paths agree on canonical unpadded base64url, exact Ed25519 signature lengths and canonical trusted-key hex. The positive/malformed cross-verifier controls pass. All 72 connector tests and 60 root tests pass.

The repository CI Ruff selection and whitespace checks pass; all PR commits carry DCO sign-offs. This approves the bounded software scope. Current-head hosted checks and maintainer requirements remain applicable.

Reviewed with OpenAI Codex.

This branch has not been deployed

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

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

4 participants