Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

Revert "fix: constant time eq" (#6208)

Seamus649c886633a0
diff --git a/Cargo.lock b/Cargo.lock
index f636bd9008..d2e4f6fe51 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3114,7 +3114,6 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "subtle",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -5953,7 +5952,6 @@ dependencies = [
"sqs_worker",
"static_file_service_client",
"strum_macros 0.27.2",
- "subtle",
"system_properties",
"thiserror 2.0.18",
"tokio",
@@ -15984,7 +15982,6 @@ dependencies = [
"matchit 0.8.4",
"serde",
"serde_json",
- "subtle",
"sync_service_bebop_schema",
"time",
"tracing",
diff --git a/Cargo.toml b/Cargo.toml
index 39b80d3df6..c59674a54a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -359,7 +359,6 @@ url = "2.5.0"
zip = "=2.4.2"
ammonia = "4.1.4"
html-escape = "0.2"
-subtle = "2.6.1"
# Retain Rust DWARF for local cache profiling while keeping release-level LLVM
# optimization. wasm-pack's custom profile metadata prevents the final
diff --git a/crates/call/Cargo.toml b/crates/call/Cargo.toml
index 0b74b2d546..4bd4adc963 100644
--- a/crates/call/Cargo.toml
+++ b/crates/call/Cargo.toml
@@ -87,7 +87,6 @@ utoipa = { workspace = true, optional = true }
urlencoding = { workspace = true, optional = true }
uuid = { workspace = true }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
-subtle = { workspace = true }
[dev-dependencies]
macro_db_migrator = { path = "../macro_db_migrator" }
diff --git a/crates/call/src/domain/service.rs b/crates/call/src/domain/service.rs
index fda197a4a5..c55382291d 100644
--- a/crates/call/src/domain/service.rs
+++ b/crates/call/src/domain/service.rs
@@ -23,7 +23,6 @@ use notification::domain::ports::VoipPushSender;
use notification::domain::service::NotificationIngress;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
-use subtle::ConstantTimeEq;
use uuid::Uuid;
@@ -479,7 +478,7 @@ impl<
fn validate_internal_call(&self, token: &str) -> bool {
self.internal_call_secret
.as_deref()
- .is_some_and(|secret| secret.as_bytes().ct_eq(token.as_bytes()).into())
+ .is_some_and(|secret| secret == token)
}
#[tracing::instrument(err, skip(self))]
diff --git a/crates/github/Cargo.toml b/crates/github/Cargo.toml
index 3d409868f8..1b363a88b7 100644
--- a/crates/github/Cargo.toml
+++ b/crates/github/Cargo.toml
@@ -70,7 +70,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true }
sqlx = { workspace = true, optional = true }
-subtle = { workspace = true }
+subtle = "2.6.1"
thiserror = { workspace = true }
tracing = { workspace = true }
urlencoding = { workspace = true, optional = true }
diff --git a/services/email_service/Cargo.toml b/services/email_service/Cargo.toml
index c5509896ee..ff14c55cbe 100644
--- a/services/email_service/Cargo.toml
+++ b/services/email_service/Cargo.toml
@@ -181,7 +181,6 @@ urlencoding = { workspace = true }
utoipa = { workspace = true }
utoipa-swagger-ui = { workspace = true }
uuid = { workspace = true }
-subtle = { workspace = true }
macro_service_urls = { path = "../../crates/macro_service_urls" }
workspace-hack = { version = "0.1", path = "../../crates/workspace-hack" }
diff --git a/services/email_service/src/api/calendar_watch.rs b/services/email_service/src/api/calendar_watch.rs
index c7620477db..13fde2573e 100644
--- a/services/email_service/src/api/calendar_watch.rs
+++ b/services/email_service/src/api/calendar_watch.rs
@@ -10,7 +10,6 @@ use axum::Router;
use axum::extract::State;
use axum::http::{HeaderMap, StatusCode};
use axum::routing::post;
-use subtle::ConstantTimeEq;
use crate::api::context::ApiContext;
use email_service::pubsub::context::calendar_watch_config;
@@ -29,18 +28,12 @@ async fn handler(State(ctx): State<ApiContext>, headers: HeaderMap) -> StatusCod
let Some(config) = calendar_watch_config() else {
return StatusCode::NOT_FOUND;
};
-
- let valid = header(&headers, "x-goog-channel-token")
- .is_some_and(|token| bool::from(token.as_bytes().ct_eq(config.token.as_bytes())));
-
- if !valid {
+ if header(&headers, "x-goog-channel-token") != Some(config.token.as_str()) {
return StatusCode::FORBIDDEN;
}
-
if header(&headers, "x-goog-resource-state") == Some("sync") {
return StatusCode::OK;
}
-
let (Some(channel_id), Some(resource_id)) = (
header(&headers, "x-goog-channel-id"),
header(&headers, "x-goog-resource-id"),
diff --git a/services/sync-service/Cargo.toml b/services/sync-service/Cargo.toml
index f05f8f242d..46687da287 100644
--- a/services/sync-service/Cargo.toml
+++ b/services/sync-service/Cargo.toml
@@ -47,4 +47,3 @@ loro = "1.13"
macro_sync_service_jwt = { path = "../../crates/macro_sync_service_jwt" }
matchit = "0.8.4"
worker-rs-otel = { path = "../../crates/worker-rs-otel" }
-subtle = { workspace = true }
diff --git a/services/sync-service/src/auth.rs b/services/sync-service/src/auth.rs
index f4e0f483a1..221375ceeb 100644
--- a/services/sync-service/src/auth.rs
+++ b/services/sync-service/src/auth.rs
@@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize};
-use subtle::ConstantTimeEq;
use tracing::error;
use worker::Error;
@@ -88,13 +87,13 @@ pub fn decode_jwt(
{
// sholud we warn when false?
Some(internal_key) => {
- let res: bool = internal_key
- .as_bytes()
- .ct_eq(secrets.internal_api_secret.as_bytes())
- .into();
-
+ let res = internal_key == secrets.internal_api_secret;
if !res {
- error!("provided header: {internal_key} did not match expected value");
+ error!(
+ "provided header: {internal_key}
+did not match expected value: {}",
+ secrets.internal_api_secret
+ );
}
res
}