Skip to content

test(enclave): acceptance test that seals, provisions and signs with the real enclave signer - #1339

Open
jframe wants to merge 5 commits into
masterfrom
enclave-7-provisioning
Open

jframe wants to merge 5 commits into
masterfrom
enclave-7-provisioning

Conversation

@jframe

@jframe jframe commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Description

Adds EnclaveProvisioningAcceptanceTest, an acceptance test that seals keys, provisions them into the real enclave signer, and signs with them through Web3Signer. It runs the same steps an operator would:

  1. Write 3 BLS keystores with password files, and a dev master key file.
  2. web3signer enclave seal --platform dev turns the keystores into a key bundle.
  3. Start the real enclave signer in process (InProcessEnclaveSigner) on the dev platform.
  4. web3signer enclave provision loads the bundle into the signer.
  5. Start Web3Signer with --Xenclave-signer-address and no local keys.

The tests:

  • Sealed keys provisioned into the enclave are listed and sign the signing root. provision reports 3 loaded, 0 duplicates, 0 rejected of 3, and status shows the dev platform and 3 keys. Web3Signer lists exactly the sealed keys, and each signature matches BLS.sign with the original secret key. keys-check/enclave-bulk-loading and enclave-signer are UP, and the boot id in the health check is the one status printed.
  • Keys provisioned after Web3Signer starts are loaded without a reload. The enclave-signer check is DOWN with NOT_LOADED until the provision runs. Then every key signs without a /reload request, and the check is back to UP with CURRENT.
  • Provisioning the same bundle again adds no keys. The second run reports 0 loaded, 3 duplicates, and Web3Signer holds exactly the 3 keys.
  • A second bundle is added to the keys already loaded. A second bundle, with its own keys and master key, is provisioned after Web3Signer has started. It reports 2 loaded … the enclave holds 5 keys, and Web3Signer picks up the new keys without a reload. All 5 keys are listed and sign.
  • Keys the enclave rejects are reported and not loaded. The sealed secrets of two entries in the bundle are swapped, so the signer rejects both. provision exits 1 with Provisioning incomplete: 1 loaded, 0 duplicates, 2 rejected of 3, and Web3Signer lists and signs with only the intact key.
  • A secret sealed under another public key is rejected. One entry is sealed with the bundle's data key but holds another key's secret, so it decrypts and fails only the signer's check that the secret matches its public key. provision reports 2 loaded, 0 duplicates, 1 rejected of 3, and Web3Signer lists only the other two keys.
  • A bundle with the wrong data key loads nothing, and the right one still provisions. A bundle carrying another bundle's data key exits 1 with The enclave loaded no key and rejected 3: the data key most likely does not match. The correct bundle then provisions into the empty signer, and Web3Signer lists and signs with its keys.

The commands run from the installed distribution (build/install/web3signer/bin/web3signer) through a small DSL helper, EnclaveTool, which keeps their stdout and stderr apart. It finds the distribution with InstalledDistribution, which Web3SignerProcessRunner now uses too. acceptance-tests now depends on the enclave-signer test fixtures for InProcessEnclaveSigner. The signing and health check assertions move to EnclaveAcceptanceTestBase, which EnclaveKeysAcceptanceTest now extends as well.

This is the only test that runs the host side (enclave-host and the enclave subcommands) and the real enclave signer together. The other host and eth2 tests use fake enclaves.

Fixed Issue(s)

Part of #1301.

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required. Test only.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary. Test only.

Testing

  • I thought about testing these changes in a realistic/non-local environment. The real Nitro and KMS path is tested by hand.

Note

Low Risk
Test-only changes to acceptance tests and test DSL; no production signing or enclave runtime code modified.

Overview
Adds end-to-end acceptance coverage for the operator workflow: web3signer enclave seal → enclave provision → Web3Signer signing against InProcessEnclaveSigner (real dev enclave, not FakeEnclaveSigner).

New test DSL pieces: EnclaveTool runs enclave CLI subcommands from the installDist binary and captures stdout/stderr; InstalledDistribution centralizes locating build/install/web3signer/bin/web3signer (also adopted by Web3SignerProcessRunner). EnclaveAcceptanceTestBase holds shared signing, polling, and health-check helpers; EnclaveKeysAcceptanceTest now extends it instead of duplicating helpers.

EnclaveProvisioningAcceptanceTest exercises happy paths (provision before/after signer start, second bundle, duplicate provision), plus failure cases (corrupted secrets, pubkey/secret mismatch, wrong data key). acceptance-tests gains a enclave-signer test-fixtures dependency for InProcessEnclaveSigner.

Reviewed by Cursor Bugbot for commit 1bb28a0. Bugbot is set up for automated code reviews on this repo. Configure here.

@jframe
jframe force-pushed the enclave-7-provisioning branch from 51a0b56 to d8e5aec Compare December 2, 2026 23:42
@jframe jframe changed the title test(enclave): seal, provision and sign through the real enclave signer test(enclave): acceptance test that seals, provisions and signs with the real enclave signer Dec 2, 2026
EnclaveProvisioningAcceptanceTest runs web3signer enclave seal and provision
from the installed distribution against the in-process enclave signer, then
signs through Web3Signer. It is the one test of the real host and enclave
signer together.
…ner, shared enclave test helpers

Adds a test where the real enclave signer rejects keys whose sealed secrets were
swapped, and one where a second bundle with its own master key is added to the
keys Web3Signer already loaded. The signing and health check helpers move to
EnclaveAcceptanceTestBase, shared with EnclaveKeysAcceptanceTest.
provision waits 10 s for the signer, well inside EnclaveTool's 60 s timeout, so a
signer that never answers fails with the tool's own error. A timeout now reports
the command's output.
@jframe
jframe force-pushed the enclave-7-provisioning branch from 9273380 to 8a794b1 Compare December 3, 2026 01:00
… key, and shared distribution lookup

- seal a key's secret under another key's public key, so it decrypts but fails the enclave's public key check
- provision a bundle carrying another bundle's data key: nothing loads, then the right bundle still provisions
- the keys check error clears after keys are provisioned late
- EnclaveTool stops its command when interrupted, and shares the installed distribution lookup with Web3SignerProcessRunner
- match whole status lines, list keys with AssertJ
@jframe
jframe marked this pull request as ready for review December 3, 2026 05:37

This branch was successfully deployed

1 active deployment
docker — 1bb28a0b Deployed Dec 3, 2026 by jframe via docker-build (default, arm64) #1324
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.

2 participants