I was seeing errors for URLs like /admin/reports/event/admin/config/system/seckit/csp-report

Because the report URL is relative to the page you're viewing.

CommentFileSizeAuthor
#1 seckit-base_path-2091627-1.patch472 bytesjweowu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jweowu’s picture

Status: Active » Needs review
FileSize
472 bytes
jweowu’s picture

Title: report-uri header is relative » CSP report-uri directive is relative
p0deje’s picture

Assigned: Unassigned » p0deje
Status: Needs review » Needs work

@jweowu Thanks for both bug report and patch. Could you please also add a regression test for this (if it is possible)?

p0deje’s picture

Nevermind, I think it is not testable with SimpleTest

p0deje’s picture

Status: Needs work » Fixed

Thanks for patch, applied and release as 1.7

jweowu’s picture

I'm not using a policy file, but I guess this change needs to happen for policy-uri as well?

(And while you're looking at this function, there's an extra space in the img-src string.)

Edit: And while I'm mentioning trivial formatting in general :) There's a code-formatting glitch at the end of this #description:

diff --git a/sites/all/modules/contrib/seckit/includes/seckit.form.inc b/sites/all/modules/contrib/seckit/includes/seckit.form.inc
index 581a643..95c016d 100644
--- a/sites/all/modules/contrib/seckit/includes/seckit.form.inc
+++ b/sites/all/modules/contrib/seckit/includes/seckit.form.inc
@@ -145,7 +145,8 @@ function seckit_admin_form() {
     '#type' => 'textfield',
     '#default_value' => $options['seckit_xss']['csp']['policy-uri'],
     '#title' => 'policy-uri',
-    '#description' => t("Specify URI to a file containing the policy. It should be text/x-content-security-policy content-type. Note, that policy-uri must only be declated when no other policies are specified. Otherwise, user-agent enforces default-src 'none'. Thus, other directives will be ignored by Security Kit."),);
+    '#description' => t("Specify URI to a file containing the policy. It should be text/x-content-security-policy content-type. Note, that policy-uri must only be declated when no other policies are specified. Otherwise, user-agent enforces default-src 'none'. Thus, other directives will be ignored by Security Kit."),
+  );

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jweowu’s picture

policy-uri fixes committed in 9399d95b58a9dd6d8957014936af1ec31abc9882

jweowu’s picture

Title: CSP report-uri directive is relative » CSP report-uri and policy-uri directives are relative to current URL rather than to base URL