Capgemini / Capgemini/gov-prototype-by-prompt

Add CSRF protection

Open
#95 0 comments 0 reactions 0 assignees View on GitHub
size L
Dominant language
TypeScript
Stars
20
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### What feature do you want to see added?

Add CSRF protection to improve security.

### Why do you want this feature? Does it solve a problem?

Websites that rely on cookie-based authentication may be vulnerable to cross-site request forgery (CSRF). Specifically, a state-changing request should include a secret token so the request can't be forged by an attacker. Otherwise, unwanted requests can be submitted on behalf of a user who visits a malicious website.

This is typically mitigated by embedding a session-specific secret token in each request. This token is then checked as an additional authentication measure. A malicious website should have no way of guessing the correct token to embed in the request.

### How should the feature be implemented?

Could use a middleware package such as lusca.csrf to protect against CSRF attacks.

### Additional context (if applicable)

See https://github.com/Capgemini/gov-prototype-by-prompt/security/code-scanning/31 for more details.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reviewing the Express request handling and the linked security report, then assess the proposed lusca.csrf middleware. Done should mean state-changing requests using cookie-based authentication require a valid session-specific token.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, nodejs, typescript
Domain
backend, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.