Skip to content

Commit 679b2bf

Browse files
joshtrichardscome-nc
authored andcommitted
test(settings): cover compatible X-Robots-Tag directives
Assisted-by: Copilot:gpt-5.6-luna Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent bc1224a commit 679b2bf

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/settings/tests/SetupChecks/SecurityHeadersTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public static function dataSuccess(): array {
9797
'basic' => [[]],
9898
'no-space-in-x-robots' => [['X-Robots-Tag' => 'noindex,nofollow']],
9999
'reordered-x-robots' => [['X-Robots-Tag' => 'nofollow, noindex']],
100+
'x-robots-noarchive' => [['X-Robots-Tag' => 'noindex,nofollow,noarchive']],
101+
'x-robots-all-allowed-directives' => [['X-Robots-Tag' => 'notranslate, noarchive, nofollow, noimageindex, noindex, nosnippet']],
100102
'strict-origin-when-cross-origin' => [['Referrer-Policy' => 'strict-origin-when-cross-origin']],
101103
'referrer-no-referrer-when-downgrade' => [['Referrer-Policy' => 'no-referrer-when-downgrade']],
102104
'referrer-strict-origin' => [['Referrer-Policy' => 'strict-origin']],
@@ -138,7 +140,14 @@ public static function dataFailure(): array {
138140
return [
139141
// description => modifiedHeaders
140142
'x-robots-none' => [['X-Robots-Tag' => 'none'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
141-
'x-robots-additional-directive' => [['X-Robots-Tag' => 'noindex,nofollow,noarchive'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
143+
'x-robots-missing-noindex' => [['X-Robots-Tag' => 'nofollow'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
144+
'x-robots-missing-nofollow' => [['X-Robots-Tag' => 'noindex'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
145+
'x-robots-conflicting-index' => [['X-Robots-Tag' => 'noindex,nofollow,index'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
146+
'x-robots-conflicting-follow' => [['X-Robots-Tag' => 'noindex,nofollow,follow'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
147+
'x-robots-unknown-directive' => [['X-Robots-Tag' => 'noindex,nofollow,unknown'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
148+
'x-robots-duplicate-directive' => [['X-Robots-Tag' => 'noindex,nofollow,nofollow'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
149+
'x-robots-trailing-comma' => [['X-Robots-Tag' => 'noindex,nofollow,'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
150+
'x-robots-empty-directive' => [['X-Robots-Tag' => 'noindex,,nofollow'], "- The `X-Robots-Tag` HTTP header is not set to `noindex,nofollow`. This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.\n"],
142151
'referrer-origin' => [['Referrer-Policy' => 'origin'], "- The `Referrer-Policy` HTTP header is not set to `no-referrer`, `no-referrer-when-downgrade`, `strict-origin`, `strict-origin-when-cross-origin` or `same-origin`. This can leak referer information. See the {w3c-recommendation}.\n"],
143152
'referrer-origin-when-cross-origin' => [['Referrer-Policy' => 'origin-when-cross-origin'], "- The `Referrer-Policy` HTTP header is not set to `no-referrer`, `no-referrer-when-downgrade`, `strict-origin`, `strict-origin-when-cross-origin` or `same-origin`. This can leak referer information. See the {w3c-recommendation}.\n"],
144153
'referrer-unsafe-url' => [['Referrer-Policy' => 'unsafe-url'], "- The `Referrer-Policy` HTTP header is not set to `no-referrer`, `no-referrer-when-downgrade`, `strict-origin`, `strict-origin-when-cross-origin` or `same-origin`. This can leak referer information. See the {w3c-recommendation}.\n"],

0 commit comments

Comments
 (0)