Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+6
-2
@@ -1,6 +1,7 @@
|
||||
import { createCookieSessionStorage, redirect, Session } from "react-router";
|
||||
import { loadRequiredWebConfig, resolveSessionCookiePolicy } from "@hivegrid/config";
|
||||
import { randomBytes } from "crypto";
|
||||
import { safeSessionRedirectTarget } from "./app/SessionRedirectSafety.server";
|
||||
|
||||
export type AnalyticsSession = {
|
||||
userAnalyticsId: string;
|
||||
@@ -35,7 +36,7 @@ export async function getAnalyticsInfo(request: Request): Promise<AnalyticsSessi
|
||||
export async function createAnalyticsSession(analyticsSession: AnalyticsSession, redirectTo = "/") {
|
||||
const session = await storage.getSession();
|
||||
session.set("userAnalyticsId", analyticsSession.userAnalyticsId);
|
||||
return redirect(redirectTo, {
|
||||
return redirect(safeSessionRedirectTarget(redirectTo, webConfig.routing), {
|
||||
headers: {
|
||||
"Set-Cookie": await storage.commitSession(session),
|
||||
},
|
||||
@@ -51,5 +52,8 @@ export async function destroyAnalyticsSession(session: Session) {
|
||||
}
|
||||
|
||||
export function generateAnalyticsUserId() {
|
||||
return randomBytes(100).toString("base64");
|
||||
// 128 bits are sufficient for a non-secret pseudonymous identifier. The
|
||||
// compact base64url form avoids sending an unnecessary ~110 cookie bytes on
|
||||
// every authenticated request.
|
||||
return randomBytes(16).toString("base64url");
|
||||
}
|
||||
Reference in new issue
Block a user