Fixed validation caching for HTTP validators to include rendered headers so inactive secrets no longer appear active, in some cases

This commit is contained in:
Mick Grove 2025-08-01 09:15:24 -07:00
commit f48eeb79e2
5 changed files with 28 additions and 118 deletions

View file

@ -491,7 +491,7 @@ mod tests {
}
#[test]
fn test_validate_response_slack_webhook() {
// 1️⃣ Build matchers equivalent to rule kingfisher.slack.4
// 1Build matchers equivalent to rule kingfisher.slack.4
let matchers = vec![
ResponseMatcher::WordMatch {
r#type: "word-match".to_string(),
@ -507,16 +507,16 @@ mod tests {
},
];
// 2Simulate the real Slack response you posted
// 2Simulate the real Slack response you posted
let body = "invalid_payload";
let status = StatusCode::BAD_REQUEST; // 400
let mut headers = HeaderMap::new();
headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/plain"));
// 3Call validate_response with html_allowed = false
// 3Call validate_response with html_allowed = false
let ok = validate_response(&matchers, body, &status, &headers, false);
// 4It *should* be valid (true) because all matcher conditions hold
// 4It *should* be valid (true) because all matcher conditions hold
assert!(ok, "Slack webhook response should be considered ACTIVE");
}
}