You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(enclave): seal and provision key bundles, with enclave seal/provision/status - #1317
Part of #1301. Stacked on #1313; the base switches to master once that merges. Seals BLS keys into a key bundle and provisions a bundle into a running enclave signer, with the enclave subcommands that drive both. This is the whole host side: an operator can seal, provision and check an enclave signer with what's here.
Sealer. Reads EIP-2335 keystores (one password file or one password file per keystore) and a raw secrets file, and seals every secret under a new data key, with the public key as additional data. It refuses a wrong password, malformed JSON, a key seen twice, zero keys and invalid secrets, without ever printing a secret. JSON that isn't a keystore, such as deposit_data-*.json, is skipped.
Provisioner. Checks the bundle's provider against the broker and optionally runs the broker's key policy check, before waiting for the enclave. Then it checks the enclave's platform, gets evidence, has the broker release the data key, and loads the keys. It fails unless every key ends up loaded or already held.
enclave seal, enclave provision, enclave status.seal takes the region from a KMS key ARN, so --aws-region is only needed for a bare key id or alias. provision builds its KMS broker from the bundle's key ARN, so there's no region flag. --verify-key-policy defaults to true for KMS bundles and false for dev ones, since the dev broker has no key policy. status --min-keys --wait-seconds lets a deployment script wait for a provisioned enclave. The tools print their results on stdout and log to stderr. The HTTP client's wire and header loggers stay at INFO, so --logging=DEBUG never prints the KMS data key.
Fake enclave signer in enclave-host's test fixtures. It does the real crypto for the dev platform: a fresh RSA release key per GET_EVIDENCE, a CMS unwrap, then an AES-GCM open of each sealed key, checked against its public key with Teku. So this PR's tests don't need the enclave signer module.
The sealer and provisioner come from #1304 and the subcommands from #1306. Changes from those:
I thought about documentation and added the doc-change-required label to this PR if updates are required. The deployment guide comes at the end of the series.
Changelog
I thought about adding a changelog entry, and added one if I deemed necessary. One entry, with the deployment guide.
Testing
I thought about testing these changes in a realistic/non-local environment.
The sealer tests cover every input source and refusal. The provisioner tests run against the fake enclave and cover:
loading, duplicates and adding to keys already held;
bundles larger than one load request;
every entry or some entries rejected;
provider, platform and key policy refusals before any release;
the release blob dump;
giving up when nothing listens, and waiting for an enclave that starts late;
an enclave on another protocol version, and a connection lost after the keys load;
wiping the data key after use.
The commandline tests seal, provision and check status end to end against the fake, and check that seal --logging=DEBUG keeps the data key out of the logs. Seal and provision against real KMS and Nitro come with the acceptance tests later in the series.
Note
High Risk
Introduces operator-facing handling of BLS secrets, KMS data keys, and enclave provisioning; mistakes or logging misconfiguration could expose key material despite deliberate safeguards.
Overview
Adds an experimental web3signer enclave command tree with seal, provision, and status, wiring the CLI to new enclave-hostKeySealer and KeyProvisioner implementations so operators can encrypt BLS keys into bundles and load them into a running enclave signer.
seal supports AWS Nitro (KMS) and dev platforms, reading EIP-2335 keystores or raw hex secrets; provision releases the data key via KMS or dev master key and loads the bundle; status can poll with --wait-seconds and --min-keys for deployment checks. CLI integration keeps tool output on stdout, logs and errors on stderr, skips the normal signer startup banner, and caps HTTP wire logging at INFO so KMS data keys are not logged at DEBUG.
EnclaveClient gains a separate connectTimeout (short connects while --wait-seconds bounds overall polling). enclave-host adds test fixtures (FakeEnclaveSigner) and broad unit/integration tests for sealing, provisioning, and the CLI path.
Reviewed by Cursor Bugbot for commit 9e89cca. Bugbot is set up for automated code reviews on this repo. Configure here.
…ision/status
Adds KeySealer, which seals EIP-2335 keystores and raw secrets into a key
bundle, and KeyProvisioner, which loads a bundle into a running enclave
signer through the broker's key release. The enclave subcommand wraps both,
plus a status check. A fake enclave signer in enclave-host's test fixtures
does the dev platform's real crypto, so the host side is tested end to end
without the enclave signer module.
Ported from #1304 and #1306.
- Errors: keystore failures give their reason; the tools print the cause chain,
name missing or unreadable files, and print the stack trace at debug level.
- enclave tools: no server startup log line; --version and help on every tool;
bare `enclave` fails; key source options are checked up front by name.
- seal: takes the region from a KMS key ARN; gets the data key before decrypting
keystores, so a wrong key fails fast; keystores are read once.
- provision: checks --address first; a 2 second connect timeout so
--wait-seconds holds; the key policy check runs before connecting; a protocol
version mismatch is an EnclaveHostException; a lost key count after loading no
longer fails the run (Result.enclaveKeyCount is optional, bundleKeys removed).
- Help text for --response-timeout-seconds and --dev-master-key-file.
- Tests: connect retry, partial load, status wait, version mismatch, data key
wiping, raw key formats and option checks; no free port races.
- At --logging=DEBUG the HTTP client's wire logger printed KMS responses,
including GenerateDataKey's plaintext data key. The enclave tools now hold
the client's wire and header loggers at INFO.
- The enclave tools log to stderr, so stdout carries only their output.
- One shared 2 second connect timeout for provision and status.
…1313
- KeyBundle.Provider enum in place of the provider strings
- KeySealer seals a bundle through one AesGcm instance, closed after use
- FakeEnclaveSigner opens entries through an AesGcm instance
- AwsKmsKeyReleaseBroker.arnRegion matches key and alias ARNs itself, as
#1313 replaced regionOf with a key-ARN-only pattern
- KeySealerTest keeps the data key array, as DataKey refuses plaintext()
once closed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ykVB9dTVuCZAgm9NVX9oZ
- provision: wait for the enclave with a pooled STATUS on the short
request timeout before opening the session, so --wait-seconds holds
when a proxy accepts but the enclave never answers
- status: add --response-timeout-seconds (default 10); EnclaveClient.Options
gains a separate connectTimeout so the connect stays short
- seal/provision: refuse options of the other platform, so a leftover
--aws-kms-key-id cannot silently produce a dev bundle (and vice versa)
- enclave tools: usage errors go to stderr, keeping stdout for results;
execution failures no longer say "Failed to initialize Web3Signer";
an OutOfMemoryError while sealing gets a heap hint
- timeout options are capped at what the client accepts, checked before
any KMS call
- blame the data key whenever no key loads, also when some were already
held
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues allow malformed keystores to be silently omitted, readiness waits to exceed their deadline, and negative --min-keys values to report false readiness.
Adds host-side key sealing, provisioning, and readiness commands for the experimental enclave signer, building on the existing bundle and key-release infrastructure.
Changes:
Seals BLS keys and provisions bundles with provider, platform, policy, and load-result checks.
Adds enclave seal, provision, and status, with script-friendly output and protected HTTP logging.
Separates connection timeouts and adds a cryptographic fake enclave for tests.
- provision: bound the session's first STATUS by what is left of the
wait (at least 2 s) by closing the session from a watchdog, instead
of probing on a pooled connection first; a session that accepts but
never answers no longer holds provisioning for the response timeout
- status: refuse a negative --min-keys, which passed for an empty enclave
- seal: an empty or whitespace-only *.json keystore fails instead of being
skipped as "not a keystore", and content after the JSON value is a
parse error, so a truncated keystore cannot drop a key silently
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- required options (--output, --address, --bundle) are checked by the
tools and not by picocli, whose check failed the parse before a value
from --config-file could be applied
- provision: when the first STATUS outlasts the wait, say that the
enclave did not answer in time, not that the connection dropped
- client: a connect timeout is reported with the connect timeout, not
the request timeout; README describes connectTimeout
- status: an unreachable enclave is reported with its cause (refused,
unknown host, vsock hints), and with a stack trace at DEBUG
- seal: check the output directory before the data key and the slow
decrypts, and refuse more keys than one signer can hold
- test: compare stderr with normalized newlines
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With --wait-seconds=5 --response-timeout-seconds=300, a peer that accepts the connection but never answers blocks this call for roughly 300 seconds, because the deadline is checked only after client.status() returns. This defeats the documented readiness-wait bound for deployment scripts. Bound an in-flight STATUS request by the remaining positive wait, for example with a watchdog like the provisioner's, while preserving the zero-wait single-request behavior.
A request in flight at the deadline ran on for the response timeout,
which --response-timeout-seconds can make much longer than the wait.
With a wait, a watchdog now closes the client at the deadline, which
fails the request in flight; without one, the single request still gets
the whole response timeout.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Part of #1301. Stacked on #1313; the base switches to
masteronce that merges. Seals BLS keys into a key bundle and provisions a bundle into a running enclave signer, with theenclavesubcommands that drive both. This is the whole host side: an operator can seal, provision and check an enclave signer with what's here.deposit_data-*.json, is skipped.enclave seal,enclave provision,enclave status.sealtakes the region from a KMS key ARN, so--aws-regionis only needed for a bare key id or alias.provisionbuilds its KMS broker from the bundle's key ARN, so there's no region flag.--verify-key-policydefaults to true for KMS bundles and false for dev ones, since the dev broker has no key policy.status --min-keys --wait-secondslets a deployment script wait for a provisioned enclave. The tools print their results on stdout and log to stderr. The HTTP client's wire and header loggers stay at INFO, so--logging=DEBUGnever prints the KMS data key.enclave-host's test fixtures. It does the real crypto for the dev platform: a fresh RSA release key perGET_EVIDENCE, a CMS unwrap, then an AES-GCM open of each sealed key, checked against its public key with Teku. So this PR's tests don't need the enclave signer module.The sealer and provisioner come from #1304 and the subcommands from #1306. Changes from those:
enclave benchis gone.Fixed Issue(s)
Part of #1301.
Documentation
doc-change-requiredlabel to this PR if updates are required. The deployment guide comes at the end of the series.Changelog
Testing
The sealer tests cover every input source and refusal. The provisioner tests run against the fake enclave and cover:
The commandline tests seal, provision and check status end to end against the fake, and check that
seal --logging=DEBUGkeeps the data key out of the logs. Seal and provision against real KMS and Nitro come with the acceptance tests later in the series.Note
High Risk
Introduces operator-facing handling of BLS secrets, KMS data keys, and enclave provisioning; mistakes or logging misconfiguration could expose key material despite deliberate safeguards.
Overview
Adds an experimental
web3signer enclavecommand tree withseal,provision, andstatus, wiring the CLI to newenclave-hostKeySealerandKeyProvisionerimplementations so operators can encrypt BLS keys into bundles and load them into a running enclave signer.sealsupports AWS Nitro (KMS) and dev platforms, reading EIP-2335 keystores or raw hex secrets;provisionreleases the data key via KMS or dev master key and loads the bundle;statuscan poll with--wait-secondsand--min-keysfor deployment checks. CLI integration keeps tool output on stdout, logs and errors on stderr, skips the normal signer startup banner, and caps HTTP wire logging at INFO so KMS data keys are not logged at DEBUG.EnclaveClientgains a separateconnectTimeout(short connects while--wait-secondsbounds overall polling).enclave-hostadds test fixtures (FakeEnclaveSigner) and broad unit/integration tests for sealing, provisioning, and the CLI path.Reviewed by Cursor Bugbot for commit 9e89cca. Bugbot is set up for automated code reviews on this repo. Configure here.