Skip to content

Commit 3e3c144

Browse files
committed
fix: remove structured input lint suppression
Preserve the rejected control and invisible-character ranges with an explicit code-point check so the production suppression inventory stays closed.
1 parent 50d9ab1 commit 3e3c144

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

‎src/agents/harness/structured-input-boundary.ts‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ const MAX_SNAPSHOT_ARRAY_ITEMS = 16;
4848
const MAX_SNAPSHOT_TEXT = 65_536;
4949
const MAX_FIELD_NAME = 256;
5050

51-
/* oxlint-disable eslint/no-control-regex -- Boundary validation rejects literal controls. */
52-
const UNSAFE_VISIBLE_CHARACTERS =
53-
/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2060\u2066-\u2069\ufeff]/u;
54-
/* oxlint-enable eslint/no-control-regex */
55-
5651
/** Copies only bounded, enumerable own data properties without invoking accessors. */
5752
export function snapshotStructuredInput(value: unknown): StructuredInputValue | undefined {
5853
let nodes = 0;
@@ -213,7 +208,21 @@ export function readStructuredInputText(value: unknown, maximum: number): string
213208
}
214209

215210
export function hasUnsafeVisibleCharacters(value: string): boolean {
216-
return UNSAFE_VISIBLE_CHARACTERS.test(value);
211+
for (const character of value) {
212+
const codePoint = character.codePointAt(0) ?? 0;
213+
if (
214+
codePoint <= 0x1f ||
215+
(codePoint >= 0x7f && codePoint <= 0x9f) ||
216+
(codePoint >= 0x200b && codePoint <= 0x200f) ||
217+
(codePoint >= 0x2028 && codePoint <= 0x202e) ||
218+
codePoint === 0x2060 ||
219+
(codePoint >= 0x2066 && codePoint <= 0x2069) ||
220+
codePoint === 0xfeff
221+
) {
222+
return true;
223+
}
224+
}
225+
return false;
217226
}
218227

219228
export function boundStructuredInputText(value: string, maximum: number): string {

0 commit comments

Comments
 (0)