MCPcopy Index your code
hub / github.com/callstack/agent-device / isSafeSetupUrlAssignment

Function isSafeSetupUrlAssignment

src/kernel/redaction.ts:63–79  ·  view source on GitHub ↗
(options: {
  key: string;
  separator: string;
  rawValue: string;
  offset: number;
  input: string;
})

Source from the content-addressed store, hash-verified

61}
62
63function isSafeSetupUrlAssignment(options: {
64 key: string;
65 separator: string;
66 rawValue: string;
67 offset: number;
68 input: string;
69}): boolean {
70 if (options.key.toLowerCase() !== 'token') return false;
71 if (!options.separator.includes(':')) return false;
72 try {
73 const url = new URL(options.rawValue);
74 if (url.pathname.replace(/\/+$/, '') !== '/api-keys') return false;
75 return /(?:^|\b)(?:service\/)?api\s+$/i.test(options.input.slice(0, options.offset));
76 } catch {
77 return false;
78 }
79}
80
81function redactUrl(value: string): string | null {
82 try {

Callers 1

redactStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected