summaryrefslogtreecommitdiffstats
path: root/Bugzilla/CGI/Mojo.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-04-05 04:18:58 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:54 +0200
commitcdc26a69674ea7a3413efce2f8d4e3225c6ab76e (patch)
treecdee5c2c8b40652cdea40becdcc96f13c3a97bc9 /Bugzilla/CGI/Mojo.pm
parente680057dd24ea4290096f4420bdd5c354acea024 (diff)
downloadbugzilla-cdc26a69674ea7a3413efce2f8d4e3225c6ab76e.tar.gz
bugzilla-cdc26a69674ea7a3413efce2f8d4e3225c6ab76e.tar.xz
render bugzilla templates using mojo
Diffstat (limited to 'Bugzilla/CGI/Mojo.pm')
-rw-r--r--Bugzilla/CGI/Mojo.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/Bugzilla/CGI/Mojo.pm b/Bugzilla/CGI/Mojo.pm
index e3adf1133..2d4f40d3e 100644
--- a/Bugzilla/CGI/Mojo.pm
+++ b/Bugzilla/CGI/Mojo.pm
@@ -14,6 +14,23 @@ has 'controller' => (
handles => [qw(param cookie)],
);
+has 'content_security_policy' => (
+ is => 'lazy',
+);
+
+sub _build_content_security_policy {
+ my ($self) = @_;
+ my $csp = $self->controller->stash->{content_security_policy} // { Bugzilla::CGI::DEFAULT_CSP() };
+ return Bugzilla::CGI::ContentSecurityPolicy->new( $csp );
+}
+
+sub csp_nonce {
+ my ($self) = @_;
+
+ my $csp = $self->content_security_policy;
+ return $csp->has_nonce ? $csp->nonce : '';
+}
+
sub script_name {
my ($self) = @_;