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

environments/ppa-mbqj77/deployments/207
Christophe Maudoux 7 years ago
parent 8b94550e79
commit 6619e56714
  1. 1
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm
  2. 4
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
  3. 5
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm
  4. 1
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Tree.pm
  5. 2
      lemonldap-ng-manager/site/htdocs/static/reverseTree.json
  6. 2
      lemonldap-ng-manager/site/htdocs/static/struct.json
  7. 1
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm
  8. 3
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm

@ -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',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -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";

Loading…
Cancel
Save