From cdc26a69674ea7a3413efce2f8d4e3225c6ab76e Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 4 Apr 2018 22:18:58 -0400 Subject: render bugzilla templates using mojo --- Bugzilla/CGI/Mojo.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Bugzilla/CGI/Mojo.pm') 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) = @_; -- cgit v1.2.3-24-g4f1b