Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion client/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rewrites": [
{
"source": "/api/v1/(.*)",
"destination": "http://34.42.255.155:3000/api/v1/$1"
"destination": "https://neuramemory-server-6zfpnl4vda-uc.a.run.app/api/v1/$1"
},
{
"source": "/(.*)",
Expand Down
Binary file removed image.png
Binary file not shown.
12 changes: 7 additions & 5 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ app.set('trust proxy', 1);
app.use(helmet());
app.use(cookieParser());
app.use(express.json({ limit: '200kb' }));
app.use(csrfProtection);

// ---------------------------------------------------------------------------
// CORS Configuration
// ---------------------------------------------------------------------------
const allowedOrigins = env.ALLOWED_ORIGINS.split(',')
.map((o) => o.trim())
.filter(Boolean);
const allowedOrigins = [
...env.ALLOWED_ORIGINS.split(',').map((o) => o.trim()),
'https://neuramemory-server-31080282917.us-central1.run.app',
'https://neuramemory-server-6zfpnl4vda-uc.a.run.app',
].filter(Boolean);

app.use(
cors({
Expand All @@ -47,6 +47,8 @@ app.use(
}),
);

app.use(csrfProtection);

// ---------------------------------------------------------------------------
// Documentation & Routes
// ---------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion server/src/middleware/csrf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Request, Response, NextFunction } from 'express';
import { AppError } from '../utils/AppError.js';
import { logger } from '../utils/logger.js';
import { env } from '../config/env.js';

/**
* Custom CSRF middleware.
Expand All @@ -26,7 +27,7 @@ export function csrfProtection(req: Request, res: Response, next: NextFunction)
cookieToken = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
res.cookie(CSRF_COOKIE_NAME, cookieToken, {
httpOnly: false, // Must be readable by frontend to send back in header
secure: process.env.NODE_ENV === 'production',
secure: env.NODE_ENV === 'production',
sameSite: 'lax',
path: '/',
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { AuthPayload, AuthResponse } from '../types/auth.types.js';
import { AppError } from '../utils/AppError.js';

const SALT_ROUNDS = 12;
const SALT_ROUNDS = 10;
const INVALID_CREDENTIALS_MESSAGE = 'Invalid email or password.';

/**
Expand Down
Loading