Skip to content

Commit cb5bc51

Browse files
committed
test(core): pin the percent-encoded marker no-resolver fail-closed path
The no-resolver scan already catches the percent-encoded canonical marker through its decoded pass; this regression pins it: a request line carrying openshell%3Aresolve%3Aenv%3AKEY with no resolver must fail closed with UnresolvedPlaceholderError { location: header }. Signed-off-by: Tony Luo <[email protected]>
1 parent cc8aaf4 commit cb5bc51

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎crates/openshell-core/src/secrets.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,17 @@ mod tests {
19211921
assert_eq!(err.location, "header");
19221922
}
19231923

1924+
#[test]
1925+
fn no_resolver_with_percent_encoded_marker_fails_closed() {
1926+
// Percent-encoded form of the canonical marker: a client (or an evasive
1927+
// sender) can URL-encode the reserved token, and the no-resolver scan
1928+
// must still catch it via the percent-decoded pass.
1929+
let raw = b"GET /api/openshell%3Aresolve%3Aenv%3AKEY HTTP/1.1\r\nHost: x\r\n\r\n";
1930+
let err = rewrite_http_header_block(raw, None)
1931+
.expect_err("percent-encoded placeholder without resolver must fail closed");
1932+
assert_eq!(err.location, "header");
1933+
}
1934+
19241935
#[test]
19251936
fn no_resolver_with_provider_alias_marker_fails_closed() {
19261937
// The provider-shaped alias marker is also a reserved credential token

0 commit comments

Comments
 (0)