Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 406
    • Issues 406
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhalefunkwhale
  • funkwhalefunkwhale
  • Merge requests
  • !826

Resolve "Improve the security via HTTP headers"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Agate requested to merge 880-header-security into develop Jul 10, 2019
  • Overview 5
  • Commits 8
  • Pipelines 2
  • Changes 11

Closes #880 (closed)

The two first commits are not directly related, but were needed to test production-like CSP headers in development.

  • Removed calls to eval() in javascript code (needed for a somewhat safe CSP)
  • Added X-Content-Type-Options: nosniff header to prevent some exploits (cf https://docs.djangoproject.com/en/2.2/ref/middleware/#x-content-type-options)
  • Added X-XSS-Protection: 1; mode=block¶ header to prevent some XSS vulnerabilities (cf https://docs.djangoproject.com/en/2.2/ref/middleware/#x-xss-protection-1-mode-block)
  • Added a CSP that should prevent most of the most dangerous exploits in case of a successful XSS attack (or similar)

About the CSP

This is my first time implementing a CSP ever, so please, feel free to point out any mistake. I'd really like a review on this specific bit.

I've used https://developer.mozilla.org/fr/docs/Web/HTTP/CSP and https://csp-evaluator.withgoogle.com/ as my main resources, the proposed CSP is:

default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; media-src 'self' data:

The 'unsafe-inline' value for the style-src leaves some room in case of an attack, but I lack the time to track down and remove all those inlined styles whithin the codebase (most of which are, I suspect, introduced in dependencies).

However, I've ensured we don't load JS scripts from anywhere else, and don't allow calls to eval or stuff like that.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 880-header-security