Issue #3470890 by quietone: Remove misc usage of whitelist in tests and comments

merge-requests/8968/head
catch 2024-08-30 20:52:53 +09:00
parent ca19c94c7c
commit a20c4c2c32
8 changed files with 22 additions and 22 deletions

View File

@ -764,7 +764,7 @@
* @code
* path_alias.manager:
* class: Drupal\path_alias\AliasManager
* arguments: ['@path_alias.repository', '@path_alias.whitelist', '@language_manager']
* arguments: ['@path_alias.repository', '@path_alias.prefix_list', '@language_manager']
* @endcode
* Some services use other services as factories; a typical service definition
* is:

View File

@ -44,8 +44,8 @@ class PathAliasTest extends PathTestBase {
]);
$this->drupalLogin($web_user);
// The \Drupal\path_alias\AliasWhitelist service performs cache clears after
// Drupal has flushed the response to the client. We use
// The \Drupal\path_alias\AliasPrefixList service performs cache clears
// after Drupal has flushed the response to the client. We use
// WaitTerminateTestTrait to wait for Drupal to do this before continuing.
$this->setWaitForTerminate();
}
@ -64,7 +64,7 @@ class PathAliasTest extends PathTestBase {
$this->drupalGet('admin/config/search/path/add');
$this->submitForm($edit, 'Save');
// Check the path alias whitelist cache.
// Check the path alias prefix list cache.
$prefix_list = \Drupal::cache('bootstrap')->get('path_alias_prefix_list');
$this->assertTrue($prefix_list->data['node']);
$this->assertFalse($prefix_list->data['admin']);

View File

@ -85,8 +85,8 @@ class DisplayFeedTranslationTest extends ViewTestBase {
// that hold a list of languages.
$this->rebuildContainer();
// The \Drupal\path_alias\AliasWhitelist service performs cache clears after
// Drupal has flushed the response to the client. We use
// The \Drupal\path_alias\AliasPrefixList service performs cache clears
// after Drupal has flushed the response to the client. We use
// WaitTerminateTestTrait to wait for Drupal to do this before continuing.
$this->setWaitForTerminate();
}

View File

@ -74,8 +74,8 @@ class PathWorkspacesTest extends BrowserTestBase {
$this->setupWorkspaceSwitcherBlock();
// The \Drupal\path_alias\AliasWhitelist service performs cache clears after
// Drupal has flushed the response to the client. We use
// The \Drupal\path_alias\AliasPrefixList service performs cache clears
// after Drupal has flushed the response to the client. We use
// WaitTerminateTestTrait to wait for Drupal to do this before continuing.
$this->setWaitForTerminate();
}

View File

@ -14,11 +14,11 @@ use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Tests white-listing of entity properties.
* Tests the allowed list of entity properties.
*
* @group Theme
*/
class TwigWhiteListTest extends KernelTestBase {
class TwigAllowListTest extends KernelTestBase {
/**
* Term for referencing.
@ -119,9 +119,9 @@ class TwigWhiteListTest extends KernelTestBase {
}
/**
* Tests white-listing of methods doesn't interfere with chaining.
* Tests listing of methods doesn't interfere with chaining.
*/
public function testWhiteListChaining(): void {
public function testAllowListChaining(): void {
/** @var \Drupal\Core\Template\TwigEnvironment $environment */
$environment = \Drupal::service('twig');
$node = Node::create([

View File

@ -300,7 +300,7 @@ class XssTest extends TestCase {
'HTML filter attributes removal evasion -- breaking with nulls.',
['img'],
],
// Only whitelisted scheme names allowed in attributes.
// Only allowed scheme names allowed in attributes.
[
'<img src="javascript:alert(0)">',
'javascript',

View File

@ -56,12 +56,12 @@ class RequestSanitizerTest extends UnitTestCase {
* @param array|null $expected_errors
* An array of expected errors. If set to NULL then error logging is
* disabled.
* @param array $whitelist
* An array of keys to whitelist and not sanitize.
* @param array $allow_list
* An array of keys to allow and not sanitize.
*
* @dataProvider providerTestRequestSanitization
*/
public function testRequestSanitization(Request $request, array $expected = [], ?array $expected_errors = NULL, array $whitelist = []): void {
public function testRequestSanitization(Request $request, array $expected = [], ?array $expected_errors = NULL, array $allow_list = []): void {
// Set up globals.
$_GET = $request->query->all();
$_POST = $request->request->all();
@ -70,7 +70,7 @@ class RequestSanitizerTest extends UnitTestCase {
$request->server->set('QUERY_STRING', http_build_query($request->query->all()));
$_SERVER['QUERY_STRING'] = $request->server->get('QUERY_STRING');
$request = RequestSanitizer::sanitize($request, $whitelist, is_null($expected_errors) ? FALSE : TRUE);
$request = RequestSanitizer::sanitize($request, $allow_list, is_null($expected_errors) ? FALSE : TRUE);
// Normalize the expected data.
$expected += ['cookies' => [], 'query' => [], 'request' => []];
@ -160,10 +160,10 @@ class RequestSanitizerTest extends UnitTestCase {
$tests['recursive sanitization log'] = [$request, ['query' => ['q' => 'index.php', 'foo' => []]], ['Potentially unsafe keys removed from query string parameters (GET): #bar']];
$request = new Request(['q' => 'index.php', 'foo' => ['#bar' => 'foo']]);
$tests['recursive no sanitization whitelist'] = [$request, ['query' => ['q' => 'index.php', 'foo' => ['#bar' => 'foo']]], [], ['#bar']];
$tests['recursive no sanitization allowed list'] = [$request, ['query' => ['q' => 'index.php', 'foo' => ['#bar' => 'foo']]], [], ['#bar']];
$request = new Request([], ['#field' => 'value']);
$tests['no sanitization POST whitelist'] = [$request, ['request' => ['#field' => 'value']], [], ['#field']];
$tests['no sanitization POST allowed list'] = [$request, ['request' => ['#field' => 'value']], [], ['#field']];
$request = new Request(['q' => 'index.php', 'foo' => ['#bar' => 'foo', '#foo' => 'bar']]);
$tests['recursive multiple sanitization log'] = [$request, ['query' => ['q' => 'index.php', 'foo' => []]], ['Potentially unsafe keys removed from query string parameters (GET): #bar, #foo']];
@ -194,7 +194,7 @@ class RequestSanitizerTest extends UnitTestCase {
$tests['destination removal subkey'] = [$request];
$request = new Request(['destination' => 'whatever?q[%23test]=value']);
$tests['destination whitelist'] = [$request, ['query' => ['destination' => 'whatever?q[%23test]=value']], [], ['#test']];
$tests['destination allowed list'] = [$request, ['query' => ['destination' => 'whatever?q[%23test]=value']], [], ['#test']];
$request = new Request(['destination' => "whatever?\x00bar=base&%23test=value"]);
$tests['destination removal zero byte'] = [$request];

View File

@ -105,8 +105,8 @@ class TwigSandboxTest extends UnitTestCase {
/**
* Tests that valid methods can be called from within Twig templates.
*
* Currently the following methods are whitelisted: id, label, bundle, and
* get.
* Currently the following methods are in the allowed list: id, label, bundle,
* and get.
*/
public function testEntitySafeMethods(): void {
$entity = $this->getMockBuilder(ContentEntityBaseMockableClass::class)