MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / isHeaderSafe

Function isHeaderSafe

packages/cli/src/auth/store.ts:385–394  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

383 * `Authorization` / `x-api-key` (RFC 7230 header injection).
384 */
385export function isHeaderSafe(s: string): boolean {
386 // Reject U+0000-U+001F (C0 controls) and U+007F (DEL) — bytes that
387 // aren't allowed in HTTP header values. Using charCodeAt avoids
388 // embedding control characters in regex source (lint requirement).
389 for (let i = 0; i < s.length; i++) {
390 const c = s.charCodeAt(i);
391 if (c < 0x20 || c === 0x7f) return false;
392 }
393 return true;
394}
395
396/**
397 * Strict variant: returns the string when present and non-empty,

Callers 7

parseTokenResponseFunction · 0.85
resolveCredentialFunction · 0.85
parseJsonStoreFunction · 0.85
pickHeaderSafeStringFunction · 0.85
looksLikeApiKeyFunction · 0.85
runApiKeyLoginFunction · 0.85
promptForKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected