Commit 6619e567 authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Add CSP form-action attribute in LLNG conf. Need more tests (#1480)

parent 8b94550e
......@@ -31,6 +31,7 @@ sub defaultValues {
'cspConnect' => '\'self\'',
'cspDefault' => '\'self\'',
'cspFont' => '\'self\'',
'cspFormAction' => '\'self\'',
'cspImg' => '\'self\' data:',
'cspScript' => '\'self\'',
'cspStyle' => '\'self\'',
......
......@@ -907,6 +907,10 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
'default' => '\'self\'',
'type' => 'text'
},
'cspFormAction' => {
'default' => '\'self\'',
'type' => 'text'
},
'cspImg' => {
'default' => '\'self\' data:',
'type' => 'text'
......
......@@ -599,6 +599,11 @@ sub attributes {
default => "'self'",
documentation => 'Font source for Content-Security-Policy',
},
cspFormAction => {
type => 'text',
default => "'self'",
documentation => 'Form-Action source for Content-Security-Policy',
},
portalAntiFrame => {
default => 1,
type => 'bool',
......
......@@ -736,6 +736,7 @@ sub tree {
'cspDefault', 'cspImg',
'cspScript', 'cspStyle',
'cspConnect', 'cspFont',
'cspFormAction',
]
},
'requireToken',
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -174,6 +174,7 @@ sub reloadConf {
my $prm = $self->conf->{ 'csp' . ucfirst($_) };
$csp .= "$_-src $prm;" if ($prm);
}
$csp = $csp . "form-action 'self' " . $self->conf->{ cspFormAction };
$self->csp($csp);
# Initialize templateDir
......
......@@ -723,7 +723,8 @@ sub sendHtml {
'X-Content-Type-Options' => 'nosniff';
# Set authorizated URL for POST
my $csp = $self->csp . "form-action 'self'";
#my $csp = $self->csp . "form-action 'self'";
my $csp = $self->csp;
if ( my $url = $req->urldc ) {
$url =~ s#(https?://[^/]+).*#$1#;
$csp .= " $url";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment