Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csp_google
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
csp_google
Commits
f6b1080c
Commit
f6b1080c
authored
1 year ago
by
Jan Leehr
Committed by
Ruud Simons
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3416470
by J-Lee: CSP form submit issues
parent
408329c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Skip disabled policies and option s without configurable URLs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
csp_google.module
+8
-2
8 additions, 2 deletions
csp_google.module
src/EventSubscriber/CspPolicy.php
+2
-2
2 additions, 2 deletions
src/EventSubscriber/CspPolicy.php
with
10 additions
and
4 deletions
csp_google.module
+
8
−
2
View file @
f6b1080c
...
...
@@ -52,9 +52,15 @@ function csp_google_form_csp_settings_form_submit(array &$form, FormStateInterfa
$values
=
$form_state
->
getValues
();
foreach
([
'report-only'
,
'enforce'
]
as
$policy_type_key
)
{
$policy_type_key_config
=
$config
->
get
(
$policy_type_key
);
// Skip disabled policies.
if
(
$policy_type_key_config
[
'enable'
]
===
FALSE
)
{
continue
;
}
foreach
(
$policy_type_key_config
[
'directives'
]
as
$key
=>
$value
)
{
$csp_google_add_google_domain_sources
=
$values
[
$policy_type_key
][
'directives'
][
$key
][
'options'
][
'csp_google_add_google_domain_sources'
]
??
FALSE
;
$policy_type_key_config
[
'directives'
][
$key
][
'csp_google_add_google_domain_sources'
]
=
$csp_google_add_google_domain_sources
;
$csp_google_add_google_domain_sources
=
(
bool
)
$values
[
$policy_type_key
][
'directives'
][
$key
][
'options'
][
'csp_google_add_google_domain_sources'
]
??
FALSE
;
if
(
is_array
(
$policy_type_key_config
[
'directives'
][
$key
]))
{
$policy_type_key_config
[
'directives'
][
$key
][
'csp_google_add_google_domain_sources'
]
=
$csp_google_add_google_domain_sources
;
}
}
$config
->
set
(
$policy_type_key
,
$policy_type_key_config
);
}
...
...
This diff is collapsed.
Click to expand it.
src/EventSubscriber/CspPolicy.php
+
2
−
2
View file @
f6b1080c
...
...
@@ -59,7 +59,7 @@ class CspPolicy implements EventSubscriberInterface {
if
(
!
$policy
->
hasDirective
(
$key
))
{
continue
;
}
if
(
!
$value
[
'csp_google_add_google_domain_sources'
])
{
if
(
!
is_array
(
$value
)
||
!
$value
[
'csp_google_add_google_domain_sources'
])
{
continue
;
}
...
...
@@ -77,8 +77,8 @@ class CspPolicy implements EventSubscriberInterface {
if
(
!
in_array
(
$supported_domain
,
$directive
))
{
$directive
[]
=
$supported_domain
;
}
$policy
->
setDirective
(
$key
,
$directive
);
}
$policy
->
setDirective
(
$key
,
$directive
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment