Drop 'unsafe-inline' from the Content-Security-Policy (closes #530)
check / check (push) Waiting to run
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user