Drop 'unsafe-inline' from the Content-Security-Policy (closes #530)
check / check (push) Waiting to run

The delete prompts on the webhook page were inline onsubmit handlers.
Each delete form now carries its question in a data-confirm attribute,
which one submit listener in static/js/app.js asks. The three style
attributes became Tailwind classes, with tailwind.css regenerated, and
the x-cloak rule moved to style.css. The policy now sends
script-src 'self' and style-src 'self'.

The browser test now answers a target's delete prompt no and then yes,
and also loads the sign-in page, the webhook list, the settings and
profile pages and the 404 error page under the policy. The README
states the policy as sent.

Model: opus-5-5
This commit is contained in:
2026-10-15 13:05:41 +00:00
parent 0d38aea12c
commit 5ea5356c1d
15 changed files with 219 additions and 94 deletions
+11 -3
View File
@@ -1,7 +1,7 @@
/*
* The two shared styles for the controls a user clicks. Every page loads
* this file after tailwind.css. It is plain CSS: make css does not build
* it.
* The two shared styles for the controls a user clicks, and the rule that
* hides an element marked x-cloak. Every page loads this file after
* tailwind.css. It is plain CSS: make css does not build it.
*
* A button is btn-primary, btn-secondary or btn-danger, from input.css.
* A secondary or inline action, such as Copy beside an entrypoint URL or
@@ -46,3 +46,11 @@
outline-offset: 2px;
}
}
/*
* Alpine.js removes x-cloak from an element once it has started, so
* something Alpine hides is not seen on the page while it loads.
*/
[x-cloak] {
display: none !important;
}
File diff suppressed because one or more lines are too long
+12
View File
@@ -58,6 +58,18 @@
}
})();
// Asks before a form with a data-confirm attribute is sent, such as a
// delete form on the webhook page. The browser's own prompt shows the
// attribute's text, and the form is sent only if the user accepts.
document.addEventListener("submit", function (event) {
"use strict";
const message = event.target.getAttribute("data-confirm");
if (message !== null && !window.confirm(message)) {
event.preventDefault();
}
});
// Alpine.js components.
//
// The pages' Content-Security-Policy forbids eval, so the UI loads