Validate that a resolved secret value does not contain characters that could enable HTTP header injection or request splitting.
(value: &str)
| 542 | /// Validate that a resolved secret value does not contain characters that |
| 543 | /// could enable HTTP header injection or request splitting. |
| 544 | fn validate_resolved_secret(value: &str) -> Result<&str, &'static str> { |
| 545 | if value |
| 546 | .bytes() |
| 547 | .any(|b| b == b'\r' || b == b'\n' || b == b'\0') |
| 548 | { |
| 549 | return Err("resolved secret contains prohibited control characters (CR, LF, or NUL)"); |
| 550 | } |
| 551 | Ok(value) |
| 552 | } |
| 553 | |
| 554 | // --------------------------------------------------------------------------- |
| 555 | // Percent encoding/decoding (RFC 3986) |