Skip to content

Commit d3f1e66

Browse files
committed
fix(servicenow): allow non-ASCII KB category names
Switch from a \w-based allowlist (ASCII only) to a denylist that rejects only encoded-query-meaningful characters (^, control chars, quotes). International category names like 'Général' or 'Ação' are now accepted.
1 parent 589db98 commit d3f1e66

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/sim/connectors/servicenow/servicenow.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ const PAGE_SIZE = 100
2222
*/
2323
const SYS_ID_PATTERN = /^[a-f0-9]{32}$/i
2424
const NUMERIC_ID_PATTERN = /^\d+$/
25-
const KB_CATEGORY_PATTERN = /^[\w \-./]+$/
25+
/**
26+
* Reject characters that have meaning in a ServiceNow encoded query
27+
* (`^` is the operator separator; control chars and quotes can break the
28+
* URL). All other Unicode characters — including accented letters used in
29+
* categories like "Général" or "Ação" — are allowed.
30+
*/
31+
const KB_CATEGORY_DISALLOWED = /[\^"'`\u0000-\u001f\u007f]/
2632
const VALID_WORKFLOW_STATES = new Set(['published', 'draft', 'review', 'retired', 'outdated'])
2733

2834
interface ServiceNowRecord {
@@ -377,7 +383,7 @@ function buildKBQuery(sourceConfig: Record<string, unknown>): string {
377383
const kbCategory = sourceConfig.kbCategory as string | undefined
378384
const trimmedCategory = kbCategory?.trim()
379385
if (trimmedCategory) {
380-
if (KB_CATEGORY_PATTERN.test(trimmedCategory)) {
386+
if (!KB_CATEGORY_DISALLOWED.test(trimmedCategory)) {
381387
parts.push(`kb_category.label=${trimmedCategory}`)
382388
} else {
383389
logger.warn('Skipping kbCategory filter: value contains disallowed characters', {

0 commit comments

Comments
 (0)