Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/api/src/protection/detectors/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const STARTER_PATTERNS: readonly CompiledPattern[] = [
{
id: 'api_key_header',
label: 'api-key header',
pattern: /\b(api-key:?\s+)[^\s"']+/i,
pattern: /\b(api-key:\s+)[^\s"']+/i,
category: 'credential',
},
];
Expand Down
23 changes: 23 additions & 0 deletions packages/api/src/protection/runtime.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,29 @@ describe('configured content inspection', () => {
});
});

it('does not interpret the api-key detector label as an API key header', () => {
const filters: FiltersConfig = {
messages: {
pii: {
starterPatterns: ['api_key_header'],
},
},
};

expect(
inspectContent(
[
fragment(
'message',
'text',
'Submitted content contains an api-key header. Remove it and try again.',
),
],
{ filters },
),
).toBeNull();
});

it('keeps the runtime starter catalog aligned with the public schema', () => {
expect(FILTER_PII_STARTER_PATTERNS).toEqual(STARTER_PATTERN_CASES.map(([ruleId]) => ruleId));
});
Expand Down
Loading