Skip to content

Commit c7806d9

Browse files
committed
fix: address credential and evidence review
1 parent c8af8b2 commit c7806d9

18 files changed

Lines changed: 120 additions & 21 deletions

File tree

crates/agnix-cli/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,8 @@ rules:
12981298
sigv4_object: sandbox.credentials.sigv4 must be an object (got %{actual})
12991299
sigv4_entry: 'sandbox.credentials.sigv4.%{field} must be deny or passthrough, and the field must be streaming, presigned, or sigv4a (got %{actual})'
13001300
sigv4_suggestion: Set streaming, presigned, and sigv4a policies to deny or passthrough, or remove unsupported fields.
1301+
tls_terminate_required: AWS credential re-signing via sandbox.credentials.%{feature} requires sandbox.network.tlsTerminate to be an object
1302+
tls_terminate_suggestion: 'Set sandbox.network.tlsTerminate to an object such as {}, or remove the AWS credential re-signing settings.'
13011303
cc_set_013:
13021304
message: autoMode.classifyAllShell must be a boolean when present (got %{actual}); Claude Code 2.1.193+ documents this
13031305
auto-mode setting as a strict true/false toggle

crates/agnix-cli/locales/es.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,8 @@ rules:
808808
sigv4_object: sandbox.credentials.sigv4 debe ser un objeto (se obtuvo %{actual})
809809
sigv4_entry: 'sandbox.credentials.sigv4.%{field} debe ser deny o passthrough, y el campo debe ser streaming, presigned o sigv4a (se obtuvo %{actual})'
810810
sigv4_suggestion: Establece las politicas streaming, presigned y sigv4a en deny o passthrough, o elimina campos no admitidos.
811+
tls_terminate_required: La firma de credenciales de AWS mediante sandbox.credentials.%{feature} requiere que sandbox.network.tlsTerminate sea un objeto
812+
tls_terminate_suggestion: 'Establece sandbox.network.tlsTerminate en un objeto como {}, o elimina la configuracion de firma de credenciales de AWS.'
811813
cc_set_013:
812814
message: autoMode.classifyAllShell debe ser un booleano cuando esta presente (se obtuvo %{actual}); Claude Code 2.1.193+
813815
documenta esta configuracion de auto-mode como un interruptor true/false estricto

crates/agnix-cli/locales/zh-CN.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ rules:
772772
sigv4_object: sandbox.credentials.sigv4 必须是对象(实际为 %{actual})
773773
sigv4_entry: 'sandbox.credentials.sigv4.%{field} 必须是 deny 或 passthrough,且字段必须是 streaming、presigned 或 sigv4a(实际为 %{actual})'
774774
sigv4_suggestion: 将 streaming、presigned 和 sigv4a 策略设置为 deny 或 passthrough,或移除不支持的字段。
775+
tls_terminate_required: 通过 sandbox.credentials.%{feature} 重新签署 AWS 凭证时,sandbox.network.tlsTerminate 必须是对象
776+
tls_terminate_suggestion: '将 sandbox.network.tlsTerminate 设置为对象(例如 {}),或移除 AWS 凭证重新签署设置。'
775777
cc_set_013:
776778
message: autoMode.classifyAllShell 存在时必须是布尔值 (实际为 %{actual}); Claude Code 2.1.193+ 将该 auto-mode 设置记录为严格的 true/false 开关
777779
suggestion: 将 autoMode.classifyAllShell 设置为不带引号的 true 或 false,或移除此字段以保留默认的 auto-mode 分类器范围。

crates/agnix-core/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,8 @@ rules:
12981298
sigv4_object: sandbox.credentials.sigv4 must be an object (got %{actual})
12991299
sigv4_entry: 'sandbox.credentials.sigv4.%{field} must be deny or passthrough, and the field must be streaming, presigned, or sigv4a (got %{actual})'
13001300
sigv4_suggestion: Set streaming, presigned, and sigv4a policies to deny or passthrough, or remove unsupported fields.
1301+
tls_terminate_required: AWS credential re-signing via sandbox.credentials.%{feature} requires sandbox.network.tlsTerminate to be an object
1302+
tls_terminate_suggestion: 'Set sandbox.network.tlsTerminate to an object such as {}, or remove the AWS credential re-signing settings.'
13011303
cc_set_013:
13021304
message: autoMode.classifyAllShell must be a boolean when present (got %{actual}); Claude Code 2.1.193+ documents this
13031305
auto-mode setting as a strict true/false toggle

crates/agnix-core/locales/es.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,8 @@ rules:
808808
sigv4_object: sandbox.credentials.sigv4 debe ser un objeto (se obtuvo %{actual})
809809
sigv4_entry: 'sandbox.credentials.sigv4.%{field} debe ser deny o passthrough, y el campo debe ser streaming, presigned o sigv4a (se obtuvo %{actual})'
810810
sigv4_suggestion: Establece las politicas streaming, presigned y sigv4a en deny o passthrough, o elimina campos no admitidos.
811+
tls_terminate_required: La firma de credenciales de AWS mediante sandbox.credentials.%{feature} requiere que sandbox.network.tlsTerminate sea un objeto
812+
tls_terminate_suggestion: 'Establece sandbox.network.tlsTerminate en un objeto como {}, o elimina la configuracion de firma de credenciales de AWS.'
811813
cc_set_013:
812814
message: autoMode.classifyAllShell debe ser un booleano cuando esta presente (se obtuvo %{actual}); Claude Code 2.1.193+
813815
documenta esta configuracion de auto-mode como un interruptor true/false estricto

crates/agnix-core/locales/zh-CN.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ rules:
772772
sigv4_object: sandbox.credentials.sigv4 必须是对象(实际为 %{actual})
773773
sigv4_entry: 'sandbox.credentials.sigv4.%{field} 必须是 deny 或 passthrough,且字段必须是 streaming、presigned 或 sigv4a(实际为 %{actual})'
774774
sigv4_suggestion: 将 streaming、presigned 和 sigv4a 策略设置为 deny 或 passthrough,或移除不支持的字段。
775+
tls_terminate_required: 通过 sandbox.credentials.%{feature} 重新签署 AWS 凭证时,sandbox.network.tlsTerminate 必须是对象
776+
tls_terminate_suggestion: '将 sandbox.network.tlsTerminate 设置为对象(例如 {}),或移除 AWS 凭证重新签署设置。'
775777
cc_set_013:
776778
message: autoMode.classifyAllShell 存在时必须是布尔值 (实际为 %{actual}); Claude Code 2.1.193+ 将该 auto-mode 设置记录为严格的 true/false 开关
777779
suggestion: 将 autoMode.classifyAllShell 设置为不带引号的 true 或 false,或移除此字段以保留默认的 auto-mode 分类器范围。

crates/agnix-core/src/rules/claude_settings.rs

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,9 @@ fn validate_respond_to_bash_commands(
865865
/// Both arrays are optional, but when present they must be arrays of objects.
866866
/// Each entry must name the credential target and carry a supported `mode`.
867867
/// Claude Code v2.1.199 added environment-variable masking, and v2.1.221 added
868-
/// file masking plus controls for narrowing injection and extraction.
868+
/// file masking plus controls for narrowing injection and extraction. Claude
869+
/// Code v2.1.224 added AWS credential re-signing, which requires
870+
/// `sandbox.network.tlsTerminate`.
869871
fn validate_sandbox_credentials(
870872
path: &Path,
871873
content: &str,
@@ -939,6 +941,13 @@ fn validate_sandbox_credentials(
939941
diagnostics,
940942
);
941943
validate_sandbox_credential_sigv4(path, content, credentials_obj.get("sigv4"), diagnostics);
944+
validate_sandbox_credential_aws_tls_termination(
945+
path,
946+
content,
947+
value,
948+
credentials_obj,
949+
diagnostics,
950+
);
942951
}
943952

944953
#[derive(Clone, Copy)]
@@ -1711,6 +1720,46 @@ fn validate_sandbox_credential_sigv4(
17111720
}
17121721
}
17131722

1723+
fn validate_sandbox_credential_aws_tls_termination(
1724+
path: &Path,
1725+
content: &str,
1726+
value: &serde_json::Value,
1727+
credentials: &serde_json::Map<String, serde_json::Value>,
1728+
diagnostics: &mut Vec<Diagnostic>,
1729+
) {
1730+
let feature = match (
1731+
credentials.contains_key("awsPairs"),
1732+
credentials.contains_key("sigv4"),
1733+
) {
1734+
(true, true) => "awsPairs and sigv4",
1735+
(true, false) => "awsPairs",
1736+
(false, true) => "sigv4",
1737+
(false, false) => return,
1738+
};
1739+
1740+
if value
1741+
.pointer("/sandbox/network/tlsTerminate")
1742+
.is_some_and(serde_json::Value::is_object)
1743+
{
1744+
return;
1745+
}
1746+
1747+
let line = find_key_line(content, "awsPairs")
1748+
.or_else(|| find_key_line(content, "sigv4"))
1749+
.or_else(|| find_key_line(content, "credentials"))
1750+
.unwrap_or(1);
1751+
diagnostics.push(
1752+
Diagnostic::warning(
1753+
path.to_path_buf(),
1754+
line,
1755+
0,
1756+
"CC-SET-012",
1757+
t!("rules.cc_set_012.tls_terminate_required", feature = feature),
1758+
)
1759+
.with_suggestion(t!("rules.cc_set_012.tls_terminate_suggestion")),
1760+
);
1761+
}
1762+
17141763
fn has_javascript_capturing_group(pattern: &str) -> bool {
17151764
let bytes = pattern.as_bytes();
17161765
let mut escaped = false;
@@ -3716,6 +3765,9 @@ mod tests {
37163765
fn test_sandbox_credentials_v2_1_224_options_are_valid() {
37173766
let content = r#"{
37183767
"sandbox": {
3768+
"network": {
3769+
"tlsTerminate": {}
3770+
},
37193771
"credentials": {
37203772
"files": [{
37213773
"path": "~/.config/service/token.json",
@@ -3760,6 +3812,9 @@ mod tests {
37603812
fn test_sandbox_credentials_v2_1_224_invalid_options_flag() {
37613813
let content = r#"{
37623814
"sandbox": {
3815+
"network": {
3816+
"tlsTerminate": {}
3817+
},
37633818
"credentials": {
37643819
"files": [{
37653820
"path": "~/.config/service/token.json",
@@ -3805,7 +3860,9 @@ mod tests {
38053860

38063861
#[test]
38073862
fn test_sandbox_credentials_aws_pairs_and_sigv4_containers_are_checked() {
3808-
let diagnostics = validate(r#"{"sandbox":{"credentials":{"awsPairs":true,"sigv4":[]}}}"#);
3863+
let diagnostics = validate(
3864+
r#"{"sandbox":{"network":{"tlsTerminate":{}},"credentials":{"awsPairs":true,"sigv4":[]}}}"#,
3865+
);
38093866
let hits: Vec<_> = diagnostics
38103867
.iter()
38113868
.filter(|diagnostic| diagnostic.rule == "CC-SET-012")
@@ -3815,6 +3872,21 @@ mod tests {
38153872
assert!(hits.iter().any(|hit| hit.message.contains("sigv4")));
38163873
}
38173874

3875+
#[test]
3876+
fn test_sandbox_credentials_aws_resigning_requires_tls_termination() {
3877+
for content in [
3878+
r#"{"sandbox":{"credentials":{"awsPairs":[],"sigv4":{}}}}"#,
3879+
r#"{"sandbox":{"network":{"tlsTerminate":true},"credentials":{"awsPairs":[]}}}"#,
3880+
] {
3881+
let hits: Vec<_> = validate(content)
3882+
.into_iter()
3883+
.filter(|diagnostic| diagnostic.rule == "CC-SET-012")
3884+
.collect();
3885+
assert_eq!(hits.len(), 1);
3886+
assert!(hits[0].message.contains("tlsTerminate"));
3887+
}
3888+
}
3889+
38183890
#[test]
38193891
fn test_sandbox_credentials_optional_field_types_are_checked() {
38203892
let diagnostics = validate(

crates/agnix-lsp/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,8 @@ rules:
12981298
sigv4_object: sandbox.credentials.sigv4 must be an object (got %{actual})
12991299
sigv4_entry: 'sandbox.credentials.sigv4.%{field} must be deny or passthrough, and the field must be streaming, presigned, or sigv4a (got %{actual})'
13001300
sigv4_suggestion: Set streaming, presigned, and sigv4a policies to deny or passthrough, or remove unsupported fields.
1301+
tls_terminate_required: AWS credential re-signing via sandbox.credentials.%{feature} requires sandbox.network.tlsTerminate to be an object
1302+
tls_terminate_suggestion: 'Set sandbox.network.tlsTerminate to an object such as {}, or remove the AWS credential re-signing settings.'
13011303
cc_set_013:
13021304
message: autoMode.classifyAllShell must be a boolean when present (got %{actual}); Claude Code 2.1.193+ documents this
13031305
auto-mode setting as a strict true/false toggle

crates/agnix-lsp/locales/es.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,8 @@ rules:
808808
sigv4_object: sandbox.credentials.sigv4 debe ser un objeto (se obtuvo %{actual})
809809
sigv4_entry: 'sandbox.credentials.sigv4.%{field} debe ser deny o passthrough, y el campo debe ser streaming, presigned o sigv4a (se obtuvo %{actual})'
810810
sigv4_suggestion: Establece las politicas streaming, presigned y sigv4a en deny o passthrough, o elimina campos no admitidos.
811+
tls_terminate_required: La firma de credenciales de AWS mediante sandbox.credentials.%{feature} requiere que sandbox.network.tlsTerminate sea un objeto
812+
tls_terminate_suggestion: 'Establece sandbox.network.tlsTerminate en un objeto como {}, o elimina la configuracion de firma de credenciales de AWS.'
811813
cc_set_013:
812814
message: autoMode.classifyAllShell debe ser un booleano cuando esta presente (se obtuvo %{actual}); Claude Code 2.1.193+
813815
documenta esta configuracion de auto-mode como un interruptor true/false estricto

crates/agnix-lsp/locales/zh-CN.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,8 @@ rules:
772772
sigv4_object: sandbox.credentials.sigv4 必须是对象(实际为 %{actual})
773773
sigv4_entry: 'sandbox.credentials.sigv4.%{field} 必须是 deny 或 passthrough,且字段必须是 streaming、presigned 或 sigv4a(实际为 %{actual})'
774774
sigv4_suggestion: 将 streaming、presigned 和 sigv4a 策略设置为 deny 或 passthrough,或移除不支持的字段。
775+
tls_terminate_required: 通过 sandbox.credentials.%{feature} 重新签署 AWS 凭证时,sandbox.network.tlsTerminate 必须是对象
776+
tls_terminate_suggestion: '将 sandbox.network.tlsTerminate 设置为对象(例如 {}),或移除 AWS 凭证重新签署设置。'
775777
cc_set_013:
776778
message: autoMode.classifyAllShell 存在时必须是布尔值 (实际为 %{actual}); Claude Code 2.1.193+ 将该 auto-mode 设置记录为严格的 true/false 开关
777779
suggestion: 将 autoMode.classifyAllShell 设置为不带引号的 true 或 false,或移除此字段以保留默认的 auto-mode 分类器范围。

0 commit comments

Comments
 (0)