Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -16,11 +16,8 @@ const postFormCsrfExceptions = new Map<string, string>([
["modules/users/components/LoginForm.tsx", "public login form creates a session before CSRF exists"],
// D-D0a — die Reset-Request-Form lebt jetzt in ForgotPasswordScreen.tsx (mit name="csrf" -> von der
// Standard-Pruefung abgedeckt, daher kein Exception-Eintrag mehr noetig).
// WF-P2 — die Invitation-Accept-Form (routes/invitation.$id.tsx) lebt jetzt in SetPasswordScreen.tsx
// (intent=set-password / magic-link). Die Action validiert bewusst KEIN CSRF: der eingeladene
// Neu-Nutzer hat noch keine Session/keinen CSRF-Token (analog zur Login-Form), die Session entsteht
// erst am Ende des Annahme-Flows. Exception daher auf die Datei mit der Post-Form re-verankert.
["modules/users/components/SetPasswordScreen.tsx", "public invitation acceptance surface"],
// WF-P2 — Invitation acceptance now submits the root loader's CSRF token,
// so it no longer needs a public-form exception.
// D-D0a — die Reset-Completion-Form lebt jetzt in ResetPasswordScreen.tsx (mit name="csrf").
]);
@@ -28,7 +25,7 @@ const protectedPostFormAllowlist = new Map<string, string>([
["modules/users/components/RegisterForm.tsx", "includes hidden csrf input and AuthService validates it server-side"],
]);
const protectedPostFormFilePatterns = [/^modules\/users\/components\/RegisterForm\.tsx$/];
const protectedPostFormFilePatterns = [/^modules\/users\/components\/RegisterForm\.tsx$/, /^modules\/users\/components\/SetPasswordScreen\.tsx$/];
type SourceFile = {
relativePath: string;
@@ -96,18 +93,24 @@ describe("CSRF session wiring sweep", () => {
.filter((file) => protectedPostFormFilePatterns.some((pattern) => pattern.test(file.relativePath)));
const unclassifiedProtectedForms = protectedPostFormFiles.filter((file) => {
const sourceWithoutCommentOnlyLines = stripLineComments(file.source);
return !csrfFieldPattern.test(sourceWithoutCommentOnlyLines) && !validatorPattern.test(sourceWithoutCommentOnlyLines) && !protectedPostFormAllowlist.has(file.relativePath);
return (
!csrfFieldPattern.test(sourceWithoutCommentOnlyLines) &&
!validatorPattern.test(sourceWithoutCommentOnlyLines) &&
!protectedPostFormAllowlist.has(file.relativePath)
);
});
expect(
unclassifiedProtectedForms.map((file) => file.relativePath),
"protected Form/fetcher.Form method=post files must include name=\"csrf\", call validateCSRFToken, or be path-allowlisted with a reason"
'protected Form/fetcher.Form method=post files must include name="csrf", call validateCSRFToken, or be path-allowlisted with a reason'
).toEqual([]);
});
it("keeps public csrf exceptions anchored to existing post form files", () => {
const postFormPaths = new Set(sourceFiles.filter((file) => postFormPattern.test(file.source)).map((file) => file.relativePath));
const staleExceptionPaths = [...postFormCsrfExceptions.keys(), ...protectedPostFormAllowlist.keys()].filter((allowedPath) => !postFormPaths.has(allowedPath));
const staleExceptionPaths = [...postFormCsrfExceptions.keys(), ...protectedPostFormAllowlist.keys()].filter(
(allowedPath) => !postFormPaths.has(allowedPath)
);
expect(staleExceptionPaths, "CSRF form allowlist entries must name existing app/ post form files").toEqual([]);
});
@@ -141,11 +144,66 @@ describe("CSRF session wiring sweep", () => {
}
});
it("protects telephony actions and the Aircall install boundary with the current session CSRF token", () => {
for (const relativePath of [
"routes/app.$tenant/calls.$id.tsx",
"routes/app.$tenant/settings/integrations/telephony.tsx",
"routes/integrations.aircall.oauth.install.tsx",
]) {
const source = fs.readFileSync(path.join(appRoot, relativePath), "utf8");
expect(source, relativePath).toContain("await validateCSRFToken(request, { formData: form })");
expect(source.indexOf("await request.formData()"), relativePath).toBeLessThan(source.indexOf("await validateCSRFToken(request, { formData: form })"));
}
for (const relativePath of ["routes/app.$tenant/calls.$id.tsx", "routes/app.$tenant/settings/integrations/telephony.tsx"]) {
const source = fs.readFileSync(path.join(appRoot, relativePath), "utf8");
expect(source, relativePath).toContain("appendCSRFToken(form)");
}
const settingsSource = fs.readFileSync(path.join(appRoot, "routes/app.$tenant/settings/integrations/telephony.tsx"), "utf8");
expect(settingsSource).toContain('form.set("intent", "connect")');
expect(settingsSource).toContain('method: "post", action: connectHref');
});
it("protects embedded Click-to-Call actions while keeping tel fallback client-only", () => {
const serverSources = [
{
relativePath: "utils/integrations/crm/crmDetailRoute.server.ts",
validator: "await validateCSRFToken(args.request, { formData: form })",
},
{
relativePath: "routes/app.$tenant/leads.$id.tsx",
validator: "await validateCSRFToken(request, { formData: form })",
},
{
relativePath: "routes/app.$tenant/projects.$id.tsx",
validator: "await validateCSRFToken(request, { formData })",
},
];
for (const { relativePath, validator } of serverSources) {
const source = fs.readFileSync(path.join(appRoot, relativePath), "utf8");
expect(source, relativePath).toContain(validator);
expect(source, relativePath).toContain("startTelephonyEntityCall(");
expect(source.indexOf(validator), relativePath).toBeLessThan(source.indexOf("startTelephonyEntityCall("));
}
for (const relativePath of [
"routes/app.$tenant/contacts.$id.tsx",
"routes/app.$tenant/contacts.companies.$id.tsx",
"routes/app.$tenant/leads.$id.tsx",
"routes/app.$tenant/projects.$id.tsx",
]) {
const source = fs.readFileSync(path.join(appRoot, relativePath), "utf8");
expect(source, relativePath).toContain("appendCSRFToken(form)");
expect(source, relativePath).toContain("window.location.assign(`tel:${number.e164}`)");
}
});
it("posts tenant feedback with the current csrf token", () => {
const source = fs.readFileSync(path.join(appRoot, "components/layouts/buttons/AddFeedbackButton.tsx"), "utf8");
expect(source).toContain("useRootData()");
expect(source).toContain('name="csrf"');
expect(source).toContain("value={csrf ?? \"\"}");
expect(source).toContain('value={csrf ?? ""}');
});
});