metabase / metabase/metabase

Implement anti-CSRF tokens or require custom headers for non-safe requests

Open
#14,319 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

.Backend .Frontend .Security related Difficulty:Hard Operation/ Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

  • Our anti-CSRF story is pretty good with SameSite=Lax cookies, but not perfect.
    • As OWASP says:

      It is important to note that this attribute should be implemented as an additional layer defense in depth concept. [...] This attribute should not replace having a CSRF Token. Instead, it should co-exist with that token in order to protect the user in a more robust way.

    • Login is an example of a place we’re not fully covered -- it would be possible to log in to Metabse from a 3rd-party site via CSRF, since the cookies only protect authenticated requests, rather than all POST requests. Someone theoretically might be able to use this to capture sensitive credentials -- see https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#login-csrf
  • Thus, we should implement another anti-CSRF strategy to have maximum protection. Here are the basics of a few ideas we could implement:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; begin by tracing the login and REST API request paths, then review the existing EE anti-CSRF handling. Compare the synchronizer-token and custom-header approaches, including form-based results downloads and the reverted PRs 9547 and 9559; done requires a decided strategy with appropriate exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
api, authentication, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.