diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-20 15:36:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-20 15:36:54 +0900 |
| commit | 80228e0a3b883ccdf2d80ba544c01619a856ef9c (patch) | |
| tree | 328494692631454d96cbab7196504afec9190e9d /crates/shirabe/src/advisory | |
| parent | 85fb9b70f4f41ead644b24f98052e6ffd9699e48 (diff) | |
| download | php-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.tar.gz php-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.tar.zst php-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.zip | |
fix(advisory): treat int-keyed ignore entries as plain IDs
parseIgnoreWithApply distinguishes ['CVE-123' => 'reason'] from
[0 => 'CVE-123'] by checking is_int($key) in PHP. AuditConfig only
matched on the value's type, so a canonical-int-keyed string value
was mistaken for an id => reason pair. Expose canonical_int_key from
the php-shim to replicate PHP's key-canonicalization rule and
unignore test_mixed_formats.
Diffstat (limited to 'crates/shirabe/src/advisory')
| -rw-r--r-- | crates/shirabe/src/advisory/audit_config.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/shirabe/src/advisory/audit_config.rs b/crates/shirabe/src/advisory/audit_config.rs index 458ebefe..e5bf6985 100644 --- a/crates/shirabe/src/advisory/audit_config.rs +++ b/crates/shirabe/src/advisory/audit_config.rs @@ -3,7 +3,7 @@ use crate::advisory::Auditor; use crate::config::Config; use indexmap::IndexMap; -use shirabe_php_shim::{InvalidArgumentException, PhpMixed}; +use shirabe_php_shim::{InvalidArgumentException, PhpMixed, canonical_int_key}; #[derive(Debug, Clone)] pub struct AuditConfig { @@ -83,7 +83,13 @@ impl AuditConfig { for (key, value) in entries { let (id, apply, reason) = match value { PhpMixed::String(reason_str) => { - (key.clone(), "all".to_string(), Some(reason_str.clone())) + // TODO(phase-e): PHP's `array` type must be modeled more precisely. This is + // escape hatch. + if canonical_int_key(key).is_some() { + (reason_str.clone(), "all".to_string(), None) + } else { + (key.clone(), "all".to_string(), Some(reason_str.clone())) + } } PhpMixed::Array(detail) => { let apply = detail |
