Skip to content

zipcontent responses are missing nosniff and other security headers #16153

Backlog

Description

@vtushar06

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Observed behavior

add_security_headers in kolibri/core/content/zip_wsgi.py (lines 112-124 on develop, 646b04dd) sets CORS and a fairly open CSP:

default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:

It does not set:

  • X-Content-Type-Options: nosniff
  • frame-ancestors on the CSP
  • base-uri
  • form-action
  • Referrer-Policy

The main Django app already sets SECURE_CONTENT_TYPE_NOSNIFF = True (see #9033), but zipcontent is served by its own Cheroot WSGI app so it does not go through Django's SecurityMiddleware. I checked #9033, #15779, and #15888 before filing; those are adjacent but do not cover these zipcontent headers.

Expected behavior

zipcontent responses should set X-Content-Type-Options: nosniff, pin frame-ancestors (allowing the main Kolibri origin), base-uri, and form-action in the CSP, and set a conservative Referrer-Policy so embedded resources do not leak the zipcontent URL or peer base URL.

User-facing consequences

HTML5, H5P, Bloom, and similar resources are served from this app. Without nosniff and a tighter CSP, the browser has fewer guards against MIME sniffing or framing/navigation outside what the sandbox expects.

Steps to reproduce

  1. On a local develop install, open any HTML5, H5P, or Bloom resource in Learn.
  2. Inspect a zipcontent response in DevTools.
  3. Confirm the headers above are missing and the CSP is only the default-src string from add_security_headers.

Context

Kolibri version: develop (646b04dd)

Activity

  1. added theissue type on Dec 3, 2026
  2. added
    bug
    on Dec 3, 2026
  3. learning-equality-bot commented on Dec 3, 2026

    @learning-equality-bot
    Contributor

    📝 This issue doesn't follow one of our issue templates yet. It is closest to Report a bug. Please edit the description to fix:

    • ## AI usage is missing.

    The check runs again when you save, and this comment goes away once it passes. We review the issue after that. If it still doesn't follow a template in 7 days, it will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-template

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions