Skip to content

Commit de2fcb1

Browse files
author
Tarek Mahmoud Sayed
committed
Remove case-insensitive =?base64? prefix test
The spec states header values are case-sensitive (RFC 9110). The =?base64? prefix is part of the header value, not the header name, so it should be matched case-sensitively. This was identified as a bug in the conformance tests per feedback on SEP-2243. Changes: - Remove server-accepts-case-insensitive-base64 check from server validation scenario - Change base64 prefix regex from case-insensitive (/i) to case-sensitive in client header validation - Remove corresponding entry from sep-2243.yaml
1 parent 76704d7 commit de2fcb1

3 files changed

Lines changed: 4 additions & 24 deletions

File tree

src/scenarios/client/http-custom-headers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const SPEC_REFERENCE_TOOL_DEF = {
3838
* Base64-encoded values use the format: =?base64?{Base64EncodedValue}?=
3939
*/
4040
function decodeHeaderValue(value: string): string {
41-
const base64Match = value.match(/^=\?base64\?(.+)\?=$/i);
41+
const base64Match = value.match(/^=\?base64\?(.+)\?=$/);
4242
if (base64Match) {
4343
return Buffer.from(base64Match[1], 'base64').toString('utf-8');
4444
}
@@ -77,7 +77,8 @@ function validateEncodedHeader(
7777
): string | null {
7878
if (needsBase64Encoding(bodyValue)) {
7979
// Value requires Base64 encoding
80-
const base64Match = rawHeader.match(/^=\?base64\?(.+)\?=$/i);
80+
const base64Match = rawHeader.match(/^=\?base64\?(.+)\?=$/);
81+
8182
if (!base64Match) {
8283
return `Value '${bodyValue}' requires Base64 encoding but header was sent as plain: '${rawHeader}'`;
8384
}

src/scenarios/sep-2243.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ requirements:
8181
check: server-rejects-invalid-base64-padding
8282
- text: 'Servers MUST reject requests with invalid Base64 characters in Mcp-Param values.'
8383
check: server-rejects-invalid-base64-chars
84-
- text: 'Servers MUST accept case-insensitive =?base64? wrappers.'
85-
check: server-accepts-case-insensitive-base64
84+
8685
- text: 'Servers MUST return HTTP 400 Bad Request when required standard headers are missing.'
8786
check: server-rejects-missing-method-header
8887
- text: 'Servers MUST reject requests where Mcp-Name is omitted but the corresponding body value is present.'

src/scenarios/server/http-standard-headers.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ export class HttpCustomHeaderServerValidationScenario implements ClientScenario
472472
- Server MUST validate Base64-encoded header values
473473
- Server MUST reject requests with invalid Base64 padding or characters
474474
- Server MUST treat values without =?base64?...?= wrapper as literal
475-
- Server MUST accept case-insensitive =?base64? prefix
476475
- Server MUST reject requests where custom header is omitted but value is in body`;
477476

478477
async run(serverUrl: string): Promise<ConformanceCheck[]> {
@@ -696,25 +695,6 @@ export class HttpCustomHeaderServerValidationScenario implements ClientScenario
696695
defaultHeaders
697696
);
698697

699-
// Case-insensitive Base64 prefix - server MUST accept
700-
await this.testBase64Case(
701-
checks,
702-
serverUrl,
703-
baseHeaders,
704-
nextId,
705-
'accept',
706-
'server-accepts-case-insensitive-base64',
707-
'ServerAcceptsCaseInsensitiveBase64',
708-
'Server MUST accept case-insensitive =?BASE64? prefix',
709-
xMcpTool.name,
710-
paramName,
711-
'Hello',
712-
headerSuffix,
713-
`=?BASE64?${validBase64Value}?=`,
714-
defaultArgs,
715-
defaultHeaders
716-
);
717-
718698
// --- Missing Custom Header with Value in Body ---
719699

720700
await this.testMissingCustomHeader(

0 commit comments

Comments
 (0)