Skip to content

feat(plugins): add signed registry index client - #1726

Open
developerkunal wants to merge 5 commits into
DXCDT-2601/manifest-schemafrom
DXCDT-2602/registry-client
Open

developerkunal wants to merge 5 commits into
DXCDT-2601/manifest-schemafrom
DXCDT-2602/registry-client

Conversation

@developerkunal

@developerkunal developerkunal commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🔧 Changes

Adds internal/plugins/registry, a client that fetches the plugin registry, verifies it with TUF (The Update Framework) through go-tuf v2, and keeps a verified copy on disk. This is a library only, so nothing changes for users yet.

Fail closed by default. A normal build embeds no root of trust yet, so every refresh fails until the production root is added under DXCDT-2611. One root.json is embedded in the binary, and no environment variable, config entry or flag can add or replace it.

Verified before the index is used

  • The registry is a TUF repository with root, targets, snapshot and timestamp roles and consistent snapshots. The client walks from the embedded root through any newer roots, so keys can be rotated without a CLI release.
  • index.json is the one target. It is accepted only with the length and hash that the signed targets file gives.
  • The format version, the schema, expiry, and a rollback check against the highest index version accepted before.
  • Duplicate JSON keys and unsorted permission lists are rejected, and each permissionsHash is recomputed with the manifest algorithm.
  • Per-plugin files an index points to are pinned by hash, size capped and validated like the index.

Client behavior

  • A failed refresh leaves the cache as it was. Load re-verifies the saved copy every time, including the chain of roots, and never uses the network.
  • When the network is unreachable, the registry serves older metadata or an older index, its timestamp has expired, or another process holds the lock, EnsureFresh falls back to the verified cache and marks it stale without advancing the last refresh time. A registry that keeps failing therefore makes installed plugins unrunnable once the offline grace period (30 days by default) passes. Signature, threshold, hash and length failures never fall back, and neither do an expired root, snapshot or targets file.
  • All fetches are https only, including every redirect hop, with size caps.

Config. The config gains an optional registries list. The built in auth0 registry is always there, a configured auth0 entry can only change its URL, which is now the base URL of the metadata directory, and any other name is rejected because custom registries are not supported yet.

Existing code. ParseManifest and ParseInstalledManifest now reject duplicate JSON keys, which is a deliberate stricter behavior.

Dependencies. Adds github.com/theupdateframework/go-tuf/v2 and the modules it needs.

📚 References

DXCDT-2602. This is part of the plugin framework stack and builds on the PR below it, DXCDT-2601.

🔬 Testing

The new code is covered by unit tests.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@developerkunal
developerkunal requested a review from a team as a code owner October 24, 2026 14:47
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from 522d4e7 to 14e0f88 Compare October 24, 2026 15:30
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from 14e0f88 to d921ea4 Compare November 2, 2026 11:12
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from d921ea4 to 527c48c Compare November 2, 2026 19:34
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from 527c48c to a4ae0b8 Compare November 24, 2026 11:33
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from a4ae0b8 to 3b7773e Compare November 24, 2026 12:03
@bkiran6398
bkiran6398 force-pushed the DXCDT-2602/registry-client branch from 3b7773e to 1abe1f1 Compare November 27, 2026 06:23
@developerkunal
developerkunal removed this pull request from stack #1736 November 30, 2026 17:24
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from 1abe1f1 to d576bd1 Compare November 30, 2026 17:24
@developerkunal
developerkunal removed this pull request from stack #1792 November 30, 2026 17:27
Fetch the plugin registry index, refuse anything that is not correctly
signed, fresh and newer than what this machine has seen, and keep a
verified copy on disk. A normal build trusts no keys yet, so it fails
closed until the production key is embedded.

- Ed25519 signature over the raw index bytes, embedded keys looked up by
  key ID, rollback and expiry checks, a revocation and deprecation list,
  and a policy block with offline grace and check interval.
- Index and per-plugin files are validated against an embedded schema, with
  duplicate keys, case variant keys and unsorted permission lists rejected,
  and each version's permissions hash recomputed with the manifest algorithm.
- A client with Refresh, Load and EnsureFresh. Files are staged and renamed
  in a fail closed order under a cross process file lock, the cache is
  verified again on every load, and a verified cache is used when the
  network, a rollback or a busy lock prevents a refresh.
- Registries list in the CLI config with the built in auth0 entry, https
  only fetches including every redirect hop, and size caps on every read.
- registrytest fixtures and a plugintest build tag that trusts a throwaway
  key and allows loopback http, so the flow can be tested without
  publishing. Contract vectors are shipped for the catalog pipeline.
- Shared helpers in the plugins package: strict JSON decoding that rejects
  duplicate keys, a normalized permissions function and a platform lookup.
The index schema now rejects the same control and format characters in artifact URLs and text fields that the manifest schema rejects, and the schema equality test covers the URL definition.
A registry that leaves offlineGraceDays out of its policy now gives installed plugins 7 days without a reachable registry instead of 30, which matches the security model. Tests that used clock offsets around 30 days now use offsets around 7.
…index

A version record can carry permissions.secrets, the union of the secret paths its commands ask to keep. The list must be sorted and distinct like the other permission lists, and the contract vectors cover a valid record, a bare name and an unsorted list.
The index schema uses the same pattern as plugin.json for permissions.secrets, and a contract vector refuses a name that is not ASCII.
@developerkunal
developerkunal force-pushed the DXCDT-2602/registry-client branch from d576bd1 to d426b4d Compare December 1, 2026 17:11

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant