Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(#7112): literal message-template regexes (semgrep); hono override to ^4.13.11 for GHSA-5r4p-p66f-jhc7

garrytan11dc939fc1a2
diff --git a/bun.lock b/bun.lock
index 0c6580e018..9849792466 100644
--- a/bun.lock
+++ b/bun.lock
@@ -60,7 +60,7 @@
"fast-xml-builder": "^1.1.7",
"fast-xml-parser": "^5.7.0",
"form-data": "^4.0.6",
- "hono": "^4.13.5",
+ "hono": "^4.13.11",
"ip-address": "^10.5.1",
"js-yaml": "^4.3.2",
"qs": "6.16.0",
@@ -438,7 +438,7 @@
"heic-decode": ["[email protected]", "", { "dependencies": { "libheif-js": "^1.19.8" } }, "sha512-0fB3O3WMk38+PScbHLVp66jcNhsZ/ErtQ6u2lMYu/YxXgbBtl+oKOhGQHa4RpvE68k8IzbWkABzHnyAIjR758A=="],
- "hono": ["[email protected]", "", {}, "sha512-c8/gF9ac8Y78/agExVocyLevgR+JlpNB444Py0FSX8pJoPdYUfUzRcXtYEYGwt6l19qIlVZPN5Mfsw9jFShmQQ=="],
+ "hono": ["[email protected]", "", {}, "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA=="],
"http-errors": ["[email protected]", "", { "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" } }, "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ=="],
diff --git a/package.json b/package.json
index a00daa55c5..519f096f0e 100644
--- a/package.json
+++ b/package.json
@@ -252,7 +252,7 @@
"fast-xml-builder": "^1.1.7",
"fast-xml-parser": "^5.7.0",
"form-data": "^4.0.6",
- "hono": "^4.13.5",
+ "hono": "^4.13.11",
"ip-address": "^10.5.1",
"qs": "6.16.0",
"js-yaml": "^4.3.2"
diff --git a/src/core/persistence/publication-failure.ts b/src/core/persistence/publication-failure.ts
index 4e797abd7d..356cdb1bea 100644
--- a/src/core/persistence/publication-failure.ts
+++ b/src/core/persistence/publication-failure.ts
@@ -246,24 +246,23 @@ function sqlShape(query: string): { text: string; names: Set<string> } {
return { text: out.length > STATEMENT_MAX ? `${out.slice(0, STATEMENT_MAX - 1)}…` : out, names };
}
-const quotedName = (template: string) => new RegExp(`^${template.replace(/"N"/g, '"([A-Za-z_][A-Za-z0-9_$]{0,62})"')}$`);
/** Server messages whose every double-quoted token is a catalog name: a bound or literal value cannot appear in them. */
const CATALOG_NAMED = [
- 'null value in column "N" of relation "N" violates not-null constraint',
- 'duplicate key value violates unique constraint "N"',
- 'new row for relation "N" violates check constraint "N"',
- 'insert or update on table "N" violates foreign key constraint "N"',
- 'update or delete on table "N" violates foreign key constraint "N" on table "N"',
-].map(quotedName);
+ /^null value in column "([A-Za-z_][A-Za-z0-9_$]{0,62})" of relation "([A-Za-z_][A-Za-z0-9_$]{0,62})" violates not-null constraint$/,
+ /^duplicate key value violates unique constraint "([A-Za-z_][A-Za-z0-9_$]{0,62})"$/,
+ /^new row for relation "([A-Za-z_][A-Za-z0-9_$]{0,62})" violates check constraint "([A-Za-z_][A-Za-z0-9_$]{0,62})"$/,
+ /^insert or update on table "([A-Za-z_][A-Za-z0-9_$]{0,62})" violates foreign key constraint "([A-Za-z_][A-Za-z0-9_$]{0,62})"$/,
+ /^update or delete on table "([A-Za-z_][A-Za-z0-9_$]{0,62})" violates foreign key constraint "([A-Za-z_][A-Za-z0-9_$]{0,62})" on table "([A-Za-z_][A-Za-z0-9_$]{0,62})"$/,
+];
/**
* Server messages whose quoted token is a name from the statement text, kept only when the statement holds it as an
* identifier: a bound value cast to regclass or regtype yields the same message with the value in it.
*/
const STATEMENT_NAMED = [
- 'syntax error at or near "N"',
- '(?:relation|column|type|function|schema|index|constraint|table) "N" does not exist',
- 'column "N" of relation "N" does not exist',
-].map(quotedName);
+ /^syntax error at or near "([A-Za-z_][A-Za-z0-9_$]{0,62})"$/,
+ /^(?:relation|column|type|function|schema|index|constraint|table) "([A-Za-z_][A-Za-z0-9_$]{0,62})" does not exist$/,
+ /^column "([A-Za-z_][A-Za-z0-9_$]{0,62})" of relation "([A-Za-z_][A-Za-z0-9_$]{0,62})" does not exist$/,
+];
/**
* #7112: a server message without the values it can carry. A message that matches a known template keeps its object