summaryrefslogtreecommitdiff
path: root/dist/wipfel/index.html
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-30 08:42:39 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-30 08:42:39 +0100
commitdbc0fd52a8497c5002e8311eb1728050a4e97c7a (patch)
tree21d38cb830faf347390d2bdd2a141c3f90fcd97e /dist/wipfel/index.html
parent34377db6b5c8e563dca18f72cc8174a5df2dd92e (diff)
web: ship a Content-Security-Policy as meta tag
Self-contained hardening, no server config required: default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; img-src 'self' blob: data:; connect-src 'self' blob: data:; style-src 'self' 'unsafe-inline' - script-src needs 'wasm-unsafe-eval' for WebAssembly compilation (the scoped exception; plain 'unsafe-eval' stays forbidden) and no inline script is allowed, so the module loader moved from an inline <script> to loader.js - style-src keeps 'unsafe-inline' because the Yew views position the find-peak popup and size the compass strip via style attributes - blob: in img-src/connect-src for createImageBitmap and blob reads; data: for inline assets Size budget note: unchanged (~550 KB gzipped total, well under the 1.5 MB plan budget).
Diffstat (limited to 'dist/wipfel/index.html')
-rw-r--r--dist/wipfel/index.html15
1 files changed, 11 insertions, 4 deletions
diff --git a/dist/wipfel/index.html b/dist/wipfel/index.html
index 67d0378..e56de5c 100644
--- a/dist/wipfel/index.html
+++ b/dist/wipfel/index.html
@@ -2,6 +2,16 @@
<html lang="en">
<head>
<meta charset="utf-8" />
+ <!--
+ Content-Security-Policy (ships with the page so it applies on any
+ static host). Scripts only from this origin, no inline JS; wasm
+ compilation is the one scoped exception. Inline style *attributes*
+ are used by the Yew views, hence style-src unsafe-inline.
+ -->
+ <meta
+ http-equiv="Content-Security-Policy"
+ content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; img-src 'self' blob: data:; connect-src 'self' blob: data:; style-src 'self' 'unsafe-inline'"
+ />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#101014" media="(prefers-color-scheme: dark)" />
<meta name="theme-color" content="#e9eaf0" media="(prefers-color-scheme: light)" />
@@ -9,9 +19,6 @@
<link rel="stylesheet" href="style.css" />
</head>
<body>
- <script type="module">
- import init from './wipfel.js';
- init();
- </script>
+ <script type="module" src="loader.js"></script>
</body>
</html>