- πΈπͺSweden Kleve
Patch 3098417-26.patch is partly rejected in current stable release 2.0.1. Looks like rejected code is in /tests/src/Functional/SecKitTestCaseTest.php
Do we have a working patch for 2.0.1?
Rejected code
--- tests/src/Functional/SecKitTestCaseTest.php +++ tests/src/Functional/SecKitTestCaseTest.php @@ -97,11 +97,12 @@ class SecKitTestCaseTest extends BrowserTestBase { 'seckit_xss[csp][child-src]' => '*', 'seckit_xss[csp][font-src]' => '*', 'seckit_xss[csp][connect-src]' => '*', + 'seckit_xss[csp][base-uri]' => '*', 'seckit_xss[csp][report-uri]' => $this->reportPath, 'seckit_xss[csp][upgrade-req]' => TRUE, ]; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); - $expected = 'default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; report-uri ' . base_path() . $this->reportPath . '; upgrade-insecure-requests'; + $expected = "default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; base-uri *; report-uri " . base_path() . $this->reportPath . '; upgrade-insecure-requests'; $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-WebKit-CSP', $expected); @@ -126,11 +127,12 @@ class SecKitTestCaseTest extends BrowserTestBase { 'seckit_xss[csp][child-src]' => '*', 'seckit_xss[csp][font-src]' => '*', 'seckit_xss[csp][connect-src]' => '*', + 'seckit_xss[csp][base-uri]' => '*', 'seckit_xss[csp][report-uri]' => $this->reportPath, 'seckit_xss[csp][upgrade-req]' => TRUE, ]; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); - $expected = 'default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; report-uri ' . base_path() . $this->reportPath . '; upgrade-insecure-requests'; + $expected = "default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; base-uri *; report-uri " . base_path() . $this->reportPath . '; upgrade-insecure-requests'; $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', NULL); $this->assertSession()->responseHeaderEquals('X-WebKit-CSP', NULL); @@ -155,11 +157,12 @@ class SecKitTestCaseTest extends BrowserTestBase { 'seckit_xss[csp][child-src]' => '*', 'seckit_xss[csp][font-src]' => '*', 'seckit_xss[csp][connect-src]' => '*', + 'seckit_xss[csp][base-uri]' => '*', 'seckit_xss[csp][report-uri]' => $this->reportPath, 'seckit_xss[csp][upgrade-req]' => TRUE, ]; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); - $expected = 'default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; report-uri ' . base_path() . $this->reportPath . '; upgrade-insecure-requests'; + $expected = "default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; base-uri *; report-uri " . base_path() . $this->reportPath . '; upgrade-insecure-requests'; $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-WebKit-CSP', NULL); @@ -184,11 +187,12 @@ class SecKitTestCaseTest extends BrowserTestBase { 'seckit_xss[csp][child-src]' => '*', 'seckit_xss[csp][font-src]' => '*', 'seckit_xss[csp][connect-src]' => '*', + 'seckit_xss[csp][base-uri]' => '*', 'seckit_xss[csp][report-uri]' => $this->reportPath, 'seckit_xss[csp][upgrade-req]' => TRUE, ]; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); - $expected = 'default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; report-uri ' . base_path() . $this->reportPath . '; upgrade-insecure-requests'; + $expected = "default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; frame-ancestors *; child-src *; font-src *; connect-src *; base-uri *; report-uri " . base_path() . $this->reportPath . '; upgrade-insecure-requests'; $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', NULL); $this->assertSession()->responseHeaderEquals('X-WebKit-CSP', $expected); @@ -247,12 +252,13 @@ class SecKitTestCaseTest extends BrowserTestBase { 'seckit_xss[csp][child-src]' => '', 'seckit_xss[csp][font-src]' => '', 'seckit_xss[csp][connect-src]' => '', + 'seckit_xss[csp][base-uri]' => "'self'", 'seckit_xss[csp][report-uri]' => $this->reportPath, 'seckit_xss[csp][upgrade-req]' => FALSE, 'seckit_xss[csp][policy-uri]' => '', ]; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); - $expected = "default-src self; report-uri " . base_path() . $this->reportPath; + $expected = "default-src self; base-uri 'self'; report-uri " . base_path() . $this->reportPath; $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-WebKit-CSP', $expected); @@ -320,15 +326,16 @@ class SecKitTestCaseTest extends BrowserTestBase { $form['seckit_xss[csp][vendor-prefix][x]'] = TRUE; $form['seckit_xss[csp][vendor-prefix][webkit]'] = TRUE; $form['seckit_xss[csp][default-src]'] = 'self'; + $form['seckit_xss[csp][base-uri]'] = "'self'"; $form['seckit_xss[csp][report-uri]'] = $report_uri['uri']; $this->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration')); if ($report_uri['valid']) { $base_path = ($report_uri['absolute']) ? '' : base_path(); - $expected = 'default-src self; report-uri ' . $base_path . $report_uri['uri']; + $expected = "default-src self; base-uri 'self'; report-uri " . $base_path . $report_uri['uri']; if (!$report_uri['absolute'] && strpos($report_uri['uri'], '/') === 0) { // In this case, check that the leading slash on the relative path // was not mistakenly turned into two leading slashes. - $expected = 'default-src self; report-uri ' . $base_path . ltrim($report_uri['uri'], '/'); + $expected = "default-src self; base-uri 'self'; report-uri " . $base_path . ltrim($report_uri['uri'], '/'); } $this->assertSession()->responseHeaderEquals('Content-Security-Policy', $expected); $this->assertSession()->responseHeaderEquals('X-Content-Security-Policy', $expected);
- First commit to issue fork.
- Open on Drupal.org βCore: 10.0.7 + Environment: PHP 7.3 & MySQL 5.7last update
over 1 year ago Not currently mergeable. - @the_g_bomb opened merge request.
- last update
over 1 year ago Composer error. Unable to continue. - π¬π§United Kingdom the_g_bomb
2.x branch in the fork isn't up to date, I think, so am uploading an updated patch instead.
- last update
over 1 year ago Composer error. Unable to continue. - π¬π§United Kingdom the_g_bomb
Found a typo and updated to include changes to the JS that Adds/removes attributes.
- Status changed to RTBC
5 months ago 2:38pm 14 June 2024 - π¬π§United Kingdom Alina Basarabeanu
The patch from #35 is working on Drupal 10.2.2 and Seckit 2.0.1.
- π¬π§United Kingdom the_g_bomb
Thanks @leo-liao,
New patch applies cleanly to 2.x