Skip to content

Commit 3206035

Browse files
committed
Default is false
1 parent 8d59392 commit 3206035

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

docs/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ headers:
5959
named: x-tenant-id
6060
rename: x-acct-tenant
6161
hmac_signature:
62+
enabled: false
6263
extension_name: hmac_signature
6364
http:
6465
host: 0.0.0.0
@@ -1351,13 +1352,14 @@ For more information on the available functions and syntax, see the
13511352

13521353
|Name|Type|Description|Required|
13531354
|----|----|-----------|--------|
1354-
|**enabled**|||yes|
1355+
|**enabled**||Default: `false`<br/>|no|
13551356
|**extension\_name**|`string`|Default: `"hmac_signature"`<br/>|no|
13561357
|**secret**|`string`||yes|
13571358

13581359
**Example**
13591360

13601361
```yaml
1362+
enabled: false
13611363
extension_name: hmac_signature
13621364
13631365
```

lib/executor/src/executors/http.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ impl HTTPSubgraphExecutor {
169169
};
170170

171171
let hmac_signature_ext = if should_sign_hmac {
172+
if self.config.hmac_signature.secret.is_empty() {
173+
return Err(SubgraphExecutorError::HMACSignatureError(
174+
"HMAC signature secret is empty".to_string(),
175+
));
176+
}
172177
let mut mac = HmacSha256::new_from_slice(self.config.hmac_signature.secret.as_bytes())
173178
.map_err(|e| {
174179
SubgraphExecutorError::HMACSignatureError(format!(

lib/router-config/src/hmac_signature.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub struct HMACSignatureConfig {
1616
// } else {
1717
// false
1818
// }
19+
#[serde(default = "default_hmac_signature_enabled")]
1920
pub enabled: BooleanOrExpression,
2021

2122
// The secret key used for HMAC signing and verification.
@@ -55,3 +56,7 @@ impl HMACSignatureConfig {
5556
}
5657
}
5758
}
59+
60+
fn default_hmac_signature_enabled() -> BooleanOrExpression {
61+
BooleanOrExpression::Boolean(false)
62+
}

0 commit comments

Comments
 (0)