Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: emit v-mode-compatible patterns for tool schemas
Character classes in emitted patterns carried unescaped '-', '/' and '['. Annex-B and u-mode accept them, so REA's own Zod validation (u) and every u-based validator never saw a defect, but v-mode rejects ClassSetSyntaxCharacters and Ruby rejects [^s[]]. With 6.1.0 tools/list, 117 pattern fields across 11 tools were rejected under v.

The characters are escaped as \x2d, \x2f, \x5b and \x5d rather than \-/\//\[, because oxlint --fix removes an escaped '-' inside a character class as a useless escape, so an escape-only change does not survive the pre-commit hook. \x2d-style escapes are valid under Annex B, u and v, are matched identically, and are not useless-escape candidates.

22 pattern literals in 18 files are touched; no other token changes.
  • Loading branch information
felipeatp committed Oct 9, 2026
commit 0db50d731dad6234e25ab284920cdf8497a4e18e
6 changes: 3 additions & 3 deletions src/browser/CdpSafeMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const parseCsp = (
for (const rawDirective of (value ?? "").split(";")) {
const [rawName, ...tokens] = rawDirective.trim().split(/\s+/u);
const name = (rawName ?? "").toLowerCase();
if (!/^[a-z][a-z0-9-]*$/u.test(name)) continue;
if (!/^[a-z][a-z0-9\x2d]*$/u.test(name)) continue;
const sources: ResponseMetadata["csp"]["directives"][number]["sources"] =
[];
for (const token of tokens) {
Expand Down Expand Up @@ -249,7 +249,7 @@ const linkParameters = (value: string): ReadonlyMap<string, string> => {
const name = (separator < 0 ? raw : raw.slice(0, separator))
.trim()
.toLowerCase();
if (!/^[a-z][a-z0-9-]*$/u.test(name)) continue;
if (!/^[a-z][a-z0-9\x2d]*$/u.test(name)) continue;
const parameter = separator < 0 ? "" : raw.slice(separator + 1).trim();
parameters.set(name, unquote(parameter));
}
Expand Down Expand Up @@ -285,7 +285,7 @@ const permissionFeatures = (value: string | undefined): string[] =>
(value ?? "")
.split(",")
.map((entry) => entry.split("=", 1)[0]?.trim().toLowerCase() ?? "")
.filter((feature) => /^[a-z][a-z0-9-]*$/u.test(feature)),
.filter((feature) => /^[a-z][a-z0-9\x2d]*$/u.test(feature)),
),
].sort();

Expand Down
2 changes: 1 addition & 1 deletion src/contracts/providerSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { z } from "zod";
export const analysisProviderIdSchema = z
.string()
.min(1)
.regex(/^[a-z][a-z0-9-]*$/u)
.regex(/^[a-z][a-z0-9\x2d]*$/u)
.refine((value) => value !== "auto", {
message: "auto is reserved for provider selection",
});
Expand Down
4 changes: 2 additions & 2 deletions src/domain/browserScenarioValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

export const scenarioIdentifierSchema = z
.string()
.regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
.regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);

const browserExecutablePathSchema = localPathStringSchema.refine(
isAbsoluteLocalPath,
Expand Down Expand Up @@ -108,7 +108,7 @@ export const browserScenarioEnvironmentSchema = z
timezone: z
.string()
.min(1)
.regex(/^[A-Za-z0-9_+-]+(?:\/[A-Za-z0-9_+-]+)*$/u)
.regex(/^[A-Za-z0-9_+\x2d]+(?:\x2f[A-Za-z0-9_+\x2d]+)*$/u)
.default("UTC"),
color_scheme: z.enum(["light", "dark", "no-preference"]).default("light"),
reduced_motion: z.enum(["reduce", "no-preference"]).default("reduce"),
Expand Down
6 changes: 4 additions & 2 deletions src/domain/callPathSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { prefixedDigestSchema } from "./../domain/digests.js";

const addressSchema = z
.string()
.regex(/^(?:(?:[A-Za-z0-9._~-]|%[0-9A-F]{2})+:)?0x(?:0|[1-9a-f][0-9a-f]*)$/u);
.regex(
/^(?:(?:[A-Za-z0-9._~\x2d]|%[0-9A-F]{2})+:)?0x(?:0|[1-9a-f][0-9a-f]*)$/u,
);
const inputAddressSchema = z
.string()
.regex(/^(?:(?:[A-Za-z0-9._~-]|%[0-9a-fA-F]{2})+:)?0[xX][0-9a-fA-F]+$/u)
.regex(/^(?:(?:[A-Za-z0-9._~\x2d]|%[0-9a-fA-F]{2})+:)?0[xX][0-9a-fA-F]+$/u)
.transform((address) => {
const separator = address.lastIndexOf(":") + 1;
const space = address
Expand Down
2 changes: 1 addition & 1 deletion src/domain/completionLedgerGeneration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { digestSchema } from "./../domain/digests.js";
import { prefixedDigestSchema } from "./../domain/digests.js";

const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);
const identitySchema = z.strictObject({
id: identifierSchema,
version: z.string().min(1),
Expand Down
2 changes: 1 addition & 1 deletion src/domain/conformancePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { prefixedDigestSchema } from "./../domain/digests.js";

const conformancePackageIdSchema = prefixedDigestSchema("cp");

const scenarioIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
const scenarioIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);

const scenarioManifestSchema = z.strictObject({
scenario_id: scenarioIdSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/domain/evidenceCompletionLedger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { z } from "zod";
import { prefixedDigestSchema } from "./../domain/digests.js";

const evidenceIdSchema = prefixedDigestSchema("ev");
const claimIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
const claimIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);

/** Terminal outcome recorded for one verifier claim. */
export const evidenceCompletionStatusSchema = z.enum([
Expand Down
2 changes: 1 addition & 1 deletion src/domain/native/binaryLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const range = z.strictObject({ offset: unsignedHex, bytes: unsignedHex });
const canonicalBase64 = z
.string()
.regex(
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$/,
/^(?:[A-Za-z0-9+\x2f]{4})*(?:[A-Za-z0-9+\x2f][AQgw]==|[A-Za-z0-9+\x2f]{2}[AEIMQUYcgkosw048]=)?$/,
);
const name = z.strictObject({
display: z.string(),
Expand Down
2 changes: 1 addition & 1 deletion src/domain/native/nativeCallObservation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const nativeString = z
/** Objective-C class names and selectors never contain spaces or brackets. */
const objcName = nativeString
.min(1)
.regex(/^[^\s[\]]+$/u, "Use the bare name without spaces or brackets");
.regex(/^[^\s\x5b\x5d]+$/u, "Use the bare name without spaces or brackets");
Comment thread
morluto marked this conversation as resolved.
Resolved

const functionBreakpoint = {
kind: z.literal("function"),
Expand Down
2 changes: 1 addition & 1 deletion src/domain/native/recordedCrash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const signed32 = z.number().int().min(-2147483648).max(2147483647);
const base64 = z
.string()
.regex(
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/][AQgw]==|[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=)?$/,
/^(?:[A-Za-z0-9+\x2f]{4})*(?:[A-Za-z0-9+\x2f][AQgw]==|[A-Za-z0-9+\x2f]{2}[AEIMQUYcgkosw048]=)?$/,
);
const range = z.strictObject({ offset: hex, bytes: hex });
const diagnostics = z.strictObject({
Expand Down
2 changes: 1 addition & 1 deletion src/domain/process/processTraceEvaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
type ProcessTraceSpecification,
} from "./processTraceSpecification.js";

const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]{0,63}$/u);
const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]{0,63}$/u);

export type ProcessTraceLocation = ProcessObservationLocation;

Expand Down
2 changes: 1 addition & 1 deletion src/domain/process/processTraceSpecification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type ProcessObservationSource,
} from "./processObservation.js";

const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);

/** Process observation families admitted by a declared trace specification. */
export const processTraceSourceSchema = processObservationSourceSchema;
Expand Down
4 changes: 3 additions & 1 deletion src/domain/reconstructionCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { digestSchema } from "./../domain/digests.js";
import { prefixedDigestSchema } from "./../domain/digests.js";

const evidenceIdSchema = prefixedDigestSchema("ev");
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:/-]{0,199}$/u);
const stableIdSchema = z
.string()
.regex(/^[A-Za-z][A-Za-z0-9._:\x2f\x2d]{0,199}$/u);
Comment thread
morluto marked this conversation as resolved.
Resolved
const boundedTextSchema = z.string().trim().min(1);

const authoritySchema = z.enum([
Expand Down
2 changes: 1 addition & 1 deletion src/domain/reconstructionObligationLedgerSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { digestSchema } from "./../domain/digests.js";
import { prefixedDigestSchema } from "./../domain/digests.js";

const evidenceIdSchema = prefixedDigestSchema("ev");
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:/-]*$/u);
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:\x2f\x2d]*$/u);
const textSchema = z.string().trim().min(1);

export const obligationStatusSchema = z.enum([
Expand Down
2 changes: 1 addition & 1 deletion src/domain/reconstructionReadinessSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { digestSchema } from "./../domain/digests.js";
import { prefixedDigestSchema } from "./../domain/digests.js";

const evidenceIdSchema = prefixedDigestSchema("ev");
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:/-]*$/u);
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:\x2f\x2d]*$/u);
const boundedTextSchema = z.string().trim().min(1);

export const readinessStatusSchema = z.enum([
Expand Down
2 changes: 1 addition & 1 deletion src/domain/reconstructionVerificationSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PROCESS_COMPARISON_DIMENSIONS } from "./process/processComparison.js";

const evidenceIdSchema = prefixedDigestSchema("ev");
const unknownIdSchema = prefixedDigestSchema("unk");
const claimIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._-]*$/u);
const claimIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]*$/u);
const titleSchema = z.string().trim().min(1);
const verificationStatusSchema = z.enum(["pass", "fail", "unknown"]);
const commonClaim = {
Expand Down
2 changes: 1 addition & 1 deletion src/domain/referenceSourceGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const graphShape = {
caller: z
.string()
.min(1)
.regex(/^[\w .:@/+-]+$/u),
.regex(/^[\w .:@\x2f+\x2d]+$/u),
}),
limitations: z.array(boundedTextSchema),
};
Expand Down
2 changes: 1 addition & 1 deletion src/ghidra/extensions/GhidraExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { nativeAotAdapter } from "./nativeaot/NativeAotAdapter.js";
const digest = z.string().regex(/^[a-f0-9]{64}$/u);
/** Exact executable extension artifact committed before the session starts. */
export const ghidraExtensionSchema = z.strictObject({
id: z.string().regex(/^[a-z][a-z0-9-]*$/u),
id: z.string().regex(/^[a-z][a-z0-9\x2d]*$/u),
path: z.string().refine(isAbsolute, "Extension path must be absolute"),
configured_path: z
.string()
Expand Down