Web build ships the desktop meta CSP, app fails to start behind proxies that rewrite CSP

Open
#1,950 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
docker
Domain
devops, frontend

Research direction

The problem is in the web build output of index.html, where a meta Content-Security-Policy tag is emitted alongside the server's CSP header. Find where the web build injects that tag and separate it from the desktop build, which should keep it. The issue says a fix is already in a linked pull request, but the payload lists none, so check for an existing PR before starting. Done means the web index.html has no CSP meta tag and the desktop build still does.

Written by the indexing model from the issue text.

Description

bug platform-docker platform-web
What happened?

Since 26.11.2 the web/Docker build of index.html contains the desktop <meta http-equiv="Content-Security-Policy"> tag (the one with localhost sources and HTML-escaped quotes, &#39;self&#39;). The server already sends the full CSP as a header, so on the web the page carries a second, duplicate policy.

Behind a proxy or CDN that adds nonces to CSP headers and meta tags, the entity-escaped meta content gets corrupted (default-src ' self' ;, script-src ' 'nonce-...'). Chromium then reports invalid CSP sources and blocks every script bundle and the web app manifest, so the app doesn't start (blank page).

26.11.1 and earlier had no CSP in the page, so nothing was corrupted.

Steps to reproduce
  1. Run the Termix server image (26.11.2 or newer).
  2. Put it behind a proxy or CDN that rewrites CSP headers and meta tags to add nonces.
  3. Open the web UI in Chromium.
What did you expect?

The app loads. The server image should send the policy only as a header, and only the desktop build (loaded without a server) should carry it as a meta tag.

Termix version

26.11.3 (also 26.11.2)

Platform

Web browser

Server install

Docker

Environment

Web, Chromium. Docker image behind a reverse proxy/CDN that rewrites CSP.

Logs

Browser console: Chromium reports invalid CSP sources for the meta policy and blocks the script bundles and the manifest.

Anything else?

A fix is up in the linked pull request: the web build stops emitting the meta tag; the desktop build keeps it.

Dominant language
TypeScript
Stars
16.1k
Forks
776
Avg merge
1d 5h
Merged PRs (30d)
57

Getting set up

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.

More from Termix-SSH/Termix

All issues in Termix-SSH/Termix

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.