Skip to content

Commit 8c5445e

Browse files
authored
Merge pull request #7 from evaristoc/feat/add_security
Feat/add security
2 parents dea4e16 + 9b3e6d3 commit 8c5445e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/handlers/authentication.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const usePassport = function(app: any, prisma: PrismaClient): void {
6969
cookie: {
7070
maxAge: 1000 * 60 * 60 * 24 * 7, // ms
7171
secure: (NODE_ENV === 'production'), // Secure HTTPS cookies only in production
72+
sameSite: "lax", // Bound the cookie to be sent only from self frontend (reduce exposurse to CSRF)
7273
},
7374
name: 'nl.codam.coalitions.session',
7475
proxy: (NODE_ENV === 'production'), // Trust the X-Forwarded-Proto header

src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ const main = async () => {
5252
// Set up the Express app
5353
const app = express();
5454

55+
// Adding size limit to json request (DoS); 10kb seems to be standard
56+
app.use(express.json({ limit: "10kb" }));
57+
5558
// Adding helmet
5659
app.use(helmet.contentSecurityPolicy({
5760
directives: {

0 commit comments

Comments
 (0)