Skip to content

Commit 5feaa18

Browse files
authored
secrets fix (#16)
1 parent cd63b9c commit 5feaa18

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

executors/src/webhook/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ use crate::webhook::envelope::{BareWebhookNotificationEnvelope, WebhookNotificat
1616

1717
pub mod envelope;
1818

19+
// --- Constants ---
20+
const SIGNATURE_HEADER_NAME: &str = "x-signature-sha256";
21+
const TIMESTAMP_HEADER_NAME: &str = "x-request-timestamp";
22+
1923
// --- Configuration ---
2024
#[derive(Clone, Debug)]
2125
pub struct WebhookRetryConfig {
@@ -187,15 +191,11 @@ impl DurableExecution for WebhookJobHandler {
187191
let signature_bytes = mac.finalize().into_bytes();
188192
let signature_hex = hex::encode(signature_bytes);
189193

190-
// Standard header names
191-
let signature_header_name = "X-Signature-SHA256";
192-
let timestamp_header_name = "X-Request-Timestamp";
193-
194194
let signature_header_value = HeaderValue::from_str(&signature_hex)
195195
.map_err(|e| {
196196
WebhookError::RequestConstruction(format!(
197197
"Invalid header value for '{}': {}",
198-
signature_header_name, e
198+
SIGNATURE_HEADER_NAME, e
199199
))
200200
})
201201
.map_err_fail()?;
@@ -204,17 +204,17 @@ impl DurableExecution for WebhookJobHandler {
204204
.map_err(|e| {
205205
WebhookError::RequestConstruction(format!(
206206
"Invalid header value for '{}': {}",
207-
timestamp_header_name, e
207+
TIMESTAMP_HEADER_NAME, e
208208
))
209209
})
210210
.map_err_fail()?;
211211

212212
request_headers.insert(
213-
HeaderName::from_static(signature_header_name),
213+
HeaderName::from_static(SIGNATURE_HEADER_NAME),
214214
signature_header_value,
215215
);
216216
request_headers.insert(
217-
HeaderName::from_static(timestamp_header_name),
217+
HeaderName::from_static(TIMESTAMP_HEADER_NAME),
218218
timestamp_header_value,
219219
);
220220
}

0 commit comments

Comments
 (0)