Commit Graph
5 Commits
Author SHA1 Message Date
Alex Ionescu dc9e1478fb Verify eval plugin archives with scoped signing keys (#63528)
## Why

The archive verifier counted keys returned in `eval_keys` but ignored
them during key lookup, so it could not verify archives signed with
those keys.

## What changed

Accept eval signing keys from `eval_keys` and release signing keys from
`keys`. Enforce each list's signing purpose and reject duplicate key IDs
across both lists. Reuse the existing cache scoped by endpoint and
authentication headers.

## Testing

Cover rejection of legacy eval keys in `keys`, successful verification
with a scoped eval key, and cache isolation across endpoints, accounts,
and tokens. Add an app-server test that checks local installation
precedes the remote install request for a valid eval archive and that
tampering prevents both operations.

GitOrigin-RevId: e8b6132f204c7e4e5f30d1dcb30357bac4c136ab
2026-11-24 03:56:24 +00:00
Alex Ionescu 188940258d Coalesce concurrent plugin signing key fetches (#63491)
## Why

Concurrent plugin archive verifications could make repeated signing key
requests when a refresh failed, returned an immediately expired response,
or omitted the requested key.

## What changed

Overlapping lookups for the same endpoint and credentials share the
completed fetch result. Each lookup resolves its own key ID from that
result. A waiting lookup can retry if the in-flight fetch is canceled.

## Testing

Add concurrency tests that check request counts for zero-TTL responses,
unknown keys, and fetch failures. The tests also verify credential
isolation and retry after cancellation.

GitOrigin-RevId: f089f8f4822314683ecadea658d6abeac36d53a3
2026-11-24 01:31:03 +00:00
Alex Ionescu 9340f3c232 Cache Plugin Service signing keys for archive verification (#63490)
## Why

Verifying each signed plugin archive fetched the signing keys again, even
when the same Plugin Service credentials and key ID were used.

## What changed

Reuse signing keys within a plugin manager for the same Plugin Service
endpoint and request headers until the server-provided
`cache_ttl_seconds` expires. Requests without a non-empty
`Authorization` header fetch keys every time.

Fetch keys when the requested key ID is missing or the cache expires.
Serialize refreshes within each scope and clear the previous keys before
fetching so a failed refresh leaves no cached keys to reuse.

## Testing

Add coverage for cache reuse and expiry, missing key IDs, invalidation
after a denied refresh, and recovery after a canceled refresh. Exercise
reuse and isolation across plugin managers through signed bundle downloads.

GitOrigin-RevId: cc1171d7914b904f6895a179cbb0cf55ffa537d3
2026-11-24 01:30:26 +00:00
Alex Ionescu 05d375287d Add signature verification for Plugin Service archives (#63487)
## Why

A SHA-256 digest can detect changed archive bytes, but someone who replaces
both the archive and its digest can still pass that check. A signature
verified with a Plugin Service release signing key lets callers detect
that replacement before extraction.

## What changed

Add `RemotePluginArchiveDownload::verify` to check the archive's SHA-256
digest and verify its detached RSA signature with the matching
release key from the authenticated `/ps/plugins/signing-keys` endpoint.

Allow downloads with missing or null signing metadata to proceed without
verification. Report malformed metadata when verification is called so
catalog responses can still be parsed, and omit signing metadata when
serializing download records.

## Testing

Add a signed archive fixture and tests for successful verification,
tampering with both archive bytes and the reported digest, redirected key
responses, invalid signing metadata and keys, and unsigned downloads.

GitOrigin-RevId: 8dd1575cb24ca3e531223faf57d23c12445651bf
2026-11-24 01:09:47 +00:00
Alex Ionescu 9bcb9614d3 Scaffold the plugin archive verification crate (#63484)
## What changed

Register `codex-plugin-archive-verification` in the Cargo workspace and
add a Bazel library target. The library currently contains only crate
documentation describing its purpose of verifying Plugin Service archive
signatures.

GitOrigin-RevId: 6d5b4e38985ccef2423561f10eea78a8e919946b
2026-11-24 01:00:49 +00:00