Skip to content

Update Vault validate observations#22736

Open
russell-stern wants to merge 1 commit into
developfrom
validate_observations
Open

Update Vault validate observations#22736
russell-stern wants to merge 1 commit into
developfrom
validate_observations

Conversation

@russell-stern
Copy link
Copy Markdown
Contributor

Summary

Fixes two malicious-node liveness vulnerabilities in the vault OCR plugin where observations could pass ValidateObservation but fail to reach consensus in StateTransition when only 2F+1 observations are available.

Fix 1 — Pending queue observation validation (no flag, needs to be merged after optimizations flag is enabled)

ValidateObservation now re-runs appendPendingQueueObservations using the submitted PendingQueueItems and SortNonce to compute the expected truncation point, then requires the submitted observations to be an ordered prefix of exactly that length.

This blocks attacks where a malicious node submits too few items (e.g. only the first or last pending queue item), which would otherwise leave honest nodes one observation short of the 2F+1 GetSecrets quorum.

Fix 2 — Ciphertextless GetSecrets observations (feature-flagged)

GetSecrets observations previously included EncryptedValue in the observation SHA without validating it, so a malicious node could submit fake ciphertext and split consensus.

When VaultCiphertextlessObservationsEnabled is on:

  • Observation omits ciphertext from GetSecrets responses
  • shaForObservation excludes ciphertext from the SHA
  • StateTransition reads the real ciphertext from KV when building outcomes

The optimizations smoke topology enables both VaultOptimizationsEnabled and VaultCiphertextlessObservationsEnabled.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

✅ No conflicts with other open PRs targeting develop

@russell-stern russell-stern marked this pull request as ready for review June 3, 2026 20:59
@russell-stern russell-stern requested review from a team as code owners June 3, 2026 20:59
@cl-sonarqube-production
Copy link
Copy Markdown

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Jun 3, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestBridgeTask_PipelineAdapterLWBAError The test failed because the latest blockchain head was unexpectedly nil, indicating a problem with retrieving the current blockchain state. Logs ↗︎

View Full Report ↗︎Docs

return gateAllows(ctx, r.lggr, r.cfg.VaultOptimizationsEnabled, "VaultOptimizationsEnabled")
}

func (r *ReportingPlugin) ciphertextlessObservationsEnabled(ctx context.Context) bool {
Copy link
Copy Markdown
Contributor

@cedric-cordenier cedric-cordenier Jun 4, 2026

Choose a reason for hiding this comment

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

Nit: worth inlining IMO -- I don't think you gain much by abstracting this out

Result: &vaultcommon.SecretResponse_Data{
Data: &vaultcommon.SecretData{
EncryptedValue: hex.EncodeToString(secret.EncryptedSecret),
EncryptedValue: encryptedValueForGetSecretsObservation(r.ciphertextlessObservationsEnabled(ctx), secret.EncryptedSecret),
Copy link
Copy Markdown
Contributor

@cedric-cordenier cedric-cordenier Jun 4, 2026

Choose a reason for hiding this comment

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

I do wonder if this has some weird error modes and I think we should ask research to take a look.

One possibility that springs to mind: we generate the shares during Observation, but then a request in the same batch updates the secret. If this is processed before the get request in StateTransition, the shares will effectively be for an outdated version of the ciphertext.

It might be safer to hash the ciphertext so that we can effectively "pin" the shares to a particular ciphertext to avoid issues like this.

}
continue
}
resp.GetData().EncryptedValue = hex.EncodeToString(stored.EncryptedSecret)
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.

You shouldn't use a getter when writing; this will initialize a nil Data if it doesn't exist which may lead to unexpected results. You're guarding against that above, so you can just use resp.Data.EncryptedValue = foo

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