Skip to content

Commit

Permalink
web: serveFile: also serve a CSP putting served HTML in its own origin
Browse files Browse the repository at this point in the history
  • Loading branch information
delroth authored and dasJ committed Apr 22, 2024
1 parent 8b48579 commit b72528b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/Hydra/Controller/Build.pm
Expand Up @@ -234,6 +234,9 @@ sub serveFile {
}

elsif ($ls->{type} eq "regular") {
# Have the hosted data considered its own origin to avoid being a giant
# XSS hole.
$c->response->header('Content-Security-Policy' => 'sandbox allow-scripts');

$c->stash->{'plain'} = { data => grab(cmd => ["nix", "--experimental-features", "nix-command",
"store", "cat", "--store", getStoreUri(), "$path"]) };
Expand Down

0 comments on commit b72528b

Please sign in to comment.