Skip to content

Commit 22f7d0f

Browse files
chore(kms-connector): enforce acl check (#1944)
1 parent bed88b0 commit 22f7d0f

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

kms-connector/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kms-connector/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["Zama"]
77
edition = "2024"
88
license = "BSD-3-Clause-Clear"
99
publish = true
10-
version = "0.10.0"
10+
version = "0.12.0"
1111

1212
[workspace.dependencies]
1313

kms-connector/crates/kms-worker/src/core/event_processor/processor.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use connector_utils::types::{
1111
use sqlx::{Pool, Postgres};
1212
use thiserror::Error;
1313
use tonic::Code;
14-
use tracing::{error, info, warn};
14+
use tracing::{error, info};
1515

1616
/// Interface used to process Gateway's events.
1717
pub trait EventProcessor: Send {
@@ -143,20 +143,19 @@ impl<GP: Provider, HP: Provider> DbEventProcessor<GP, HP> {
143143
// No need to check decryption is done for user decrypt, as MPC parties don't
144144
// communicate between each other for user decrypt
145145

146-
// Skip the ACL check if we don't have the `tx_hash` just for v0.11.
147-
// This is tracked by this issue: https://github.com/zama-ai/fhevm-internal/issues/916.
148-
if let Some(tx_hash) = event.tx_hash {
149-
let calldata = self.decryption_processor.fetch_calldata(tx_hash).await?;
150-
self.decryption_processor
151-
.check_ciphertexts_allowed_for_user_decryption(
152-
calldata,
153-
&req.snsCtMaterials,
154-
req.userAddress,
155-
)
156-
.await?;
157-
} else {
158-
warn!("No `tx_hash` found. Skipping the ACL check!");
159-
}
146+
let tx_hash = event.tx_hash.ok_or_else(|| {
147+
ProcessingError::Irrecoverable(anyhow!(
148+
"No `tx_hash` found for user decryption. Cannot perform ACL check."
149+
))
150+
})?;
151+
let calldata = self.decryption_processor.fetch_calldata(tx_hash).await?;
152+
self.decryption_processor
153+
.check_ciphertexts_allowed_for_user_decryption(
154+
calldata,
155+
&req.snsCtMaterials,
156+
req.userAddress,
157+
)
158+
.await?;
160159
self.decryption_processor
161160
.prepare_decryption_request(
162161
req.decryptionId,

0 commit comments

Comments
 (0)