PluginProbe
Blocks – Reusable Content, Shortcodes & Site Variables / trunk
Blocks – Reusable Content, Shortcodes & Site Variables vtrunk
26.09.03.15 26.08.31.21 26.08.22.20 26.08.22.22 26.08.22.17 26.08.22.13 26.08.21.19 26.08.07.23 26.07.19.14 26.07.13.21 26.07.13.17 26.07.12.13 026.07.07.21 026.07.05.18 026.06.26.20 026.06.26.21 026.06.08.20 026.05.13.14 026.04.29.10 trunk 026.02.22.22 026.03.16.23 026.04.23.13
blocks / src / Settings / Tabs / SecurityTab.php

SecurityTab.php in Blocks – Reusable Content, Shortcodes & Site Variables trunk, at src/Settings/Tabs/SecurityTab.php

236 lines 9.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace RenzoJohnson\Blocks\Settings\Tabs;
6
7 use RenzoJohnson\Blocks\Settings\FieldDefinition;
8 use RenzoJohnson\Blocks\Settings\FieldType;
9 use RenzoJohnson\Blocks\Settings\Requirement;
10 use RenzoJohnson\Blocks\Settings\SanitizerType;
11 use RenzoJohnson\Blocks\Settings\SectionDefinition;
12 use RenzoJohnson\Blocks\Settings\SettingDefinition;
13 use RenzoJohnson\Blocks\Settings\TabDefinition;
14 use RenzoJohnson\Blocks\Settings\TabProvider;
15
16 \defined( 'ABSPATH' ) || exit;
17
18 final class SecurityTab implements TabProvider {
19
20 public function definition(): TabDefinition {
21 return new TabDefinition(
22 'security',
23 \__( 'Security', 'blocks' ),
24 array(
25 new SectionDefinition(
26 'blocks_security_section',
27 \__( 'Security Hardening', 'blocks' ),
28 array(
29 \__( 'Harden your site by hiding version info, cleaning up unnecessary head tags, and enabling HSTS.', 'blocks' ),
30 ),
31 array(
32 new FieldDefinition(
33 'blocks_security_hsts',
34 \__( 'HSTS Headers', 'blocks' ),
35 \__( 'Send Strict-Transport-Security header (1 year, includeSubDomains, preload).', 'blocks' ),
36 FieldType::Checkbox,
37 array(
38 new SettingDefinition( 'blocks_security_hsts', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
39 ),
40 array(),
41 Requirement::Always,
42 ),
43 new FieldDefinition(
44 'blocks_security_hide_versions',
45 \__( 'Hide Asset Versions', 'blocks' ),
46 \__( 'Strip ?ver= from third-party CSS and JS URLs. Blocks keeps its release version to prevent stale CDN assets after updates.', 'blocks' ),
47 FieldType::Checkbox,
48 array(
49 new SettingDefinition( 'blocks_security_hide_versions', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
50 ),
51 array(),
52 Requirement::Always,
53 ),
54 new FieldDefinition(
55 'blocks_security_hide_generator',
56 \__( 'Hide WP Generator', 'blocks' ),
57 \__( 'Remove WordPress version from meta generator tag and RSS feeds.', 'blocks' ),
58 FieldType::Checkbox,
59 array(
60 new SettingDefinition( 'blocks_security_hide_generator', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
61 ),
62 array(),
63 Requirement::Always,
64 ),
65 new FieldDefinition(
66 'blocks_security_remove_feeds',
67 \__( 'Remove Feed Links', 'blocks' ),
68 \__( 'Remove RSS and Atom feed links from the HTML head.', 'blocks' ),
69 FieldType::Checkbox,
70 array(
71 new SettingDefinition( 'blocks_security_remove_feeds', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
72 ),
73 array(),
74 Requirement::Always,
75 ),
76 new FieldDefinition(
77 'blocks_security_remove_rsd_wlw',
78 \__( 'Remove RSD / WLW Links', 'blocks' ),
79 \__( 'Remove Really Simple Discovery and Windows Live Writer links from head.', 'blocks' ),
80 FieldType::Checkbox,
81 array(
82 new SettingDefinition( 'blocks_security_remove_rsd_wlw', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
83 ),
84 array(),
85 Requirement::Always,
86 ),
87 new FieldDefinition(
88 'blocks_security_remove_oembed',
89 \__( 'Remove oEmbed Links', 'blocks' ),
90 \__( 'Remove oEmbed discovery links (JSON and XML) from the HTML head.', 'blocks' ),
91 FieldType::Checkbox,
92 array(
93 new SettingDefinition( 'blocks_security_remove_oembed', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
94 ),
95 array(),
96 Requirement::Always,
97 ),
98 new FieldDefinition(
99 'blocks_security_remove_rest_api_link',
100 \__( 'Remove REST API Links', 'blocks' ),
101 \__( 'Remove WP REST API and WP JSON page links from head and HTTP headers.', 'blocks' ),
102 FieldType::Checkbox,
103 array(
104 new SettingDefinition( 'blocks_security_remove_rest_api_link', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
105 ),
106 array(),
107 Requirement::Always,
108 ),
109 new FieldDefinition(
110 'blocks_security_remove_shortlink',
111 \__( 'Remove Shortlink', 'blocks' ),
112 \__( 'Remove the shortlink tag from the HTML head and HTTP headers.', 'blocks' ),
113 FieldType::Checkbox,
114 array(
115 new SettingDefinition( 'blocks_security_remove_shortlink', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
116 ),
117 array(),
118 Requirement::Always,
119 ),
120 ),
121 false,
122 ),
123 new SectionDefinition(
124 'blocks_user_enum_section',
125 \__( 'User Enumeration Protection', 'blocks' ),
126 array(
127 \__( 'Stop attackers from discovering usernames via the REST API, author URLs, sitemaps, oEmbed, and login errors.', 'blocks' ),
128 ),
129 array(
130 new FieldDefinition(
131 'blocks_security_stop_user_enum',
132 \__( 'Stop User Enumeration', 'blocks' ),
133 \__( 'Remove the REST /wp/v2/users endpoints for logged-out visitors and block ?author=N probing.', 'blocks' ),
134 FieldType::Checkbox,
135 array(
136 new SettingDefinition( 'blocks_security_stop_user_enum', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
137 ),
138 array(),
139 Requirement::Always,
140 ),
141 new FieldDefinition(
142 'blocks_security_disable_author_archives',
143 \__( 'Disable Author Archives', 'blocks' ),
144 \__( 'Return 404 for /author/{slug}/ archive pages (closes the pretty-permalink enumeration path).', 'blocks' ),
145 FieldType::Checkbox,
146 array(
147 new SettingDefinition( 'blocks_security_disable_author_archives', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
148 ),
149 array(),
150 Requirement::Always,
151 ),
152 new FieldDefinition(
153 'blocks_security_strip_oembed_author',
154 \__( 'Strip oEmbed Author', 'blocks' ),
155 \__( 'Remove author_name / author_url from oEmbed endpoint responses.', 'blocks' ),
156 FieldType::Checkbox,
157 array(
158 new SettingDefinition( 'blocks_security_strip_oembed_author', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
159 ),
160 array(),
161 Requirement::Always,
162 ),
163 new FieldDefinition(
164 'blocks_security_disable_user_sitemap',
165 \__( 'Disable User Sitemap', 'blocks' ),
166 \__( 'Remove the core users provider from wp-sitemap (wp-sitemap-users-*.xml).', 'blocks' ),
167 FieldType::Checkbox,
168 array(
169 new SettingDefinition( 'blocks_security_disable_user_sitemap', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
170 ),
171 array(),
172 Requirement::Always,
173 ),
174 new FieldDefinition(
175 'blocks_security_generic_login_errors',
176 \__( 'Generic Login Errors', 'blocks' ),
177 \__( 'Replace login error messages with a single generic message (no username-exists oracle).', 'blocks' ),
178 FieldType::Checkbox,
179 array(
180 new SettingDefinition( 'blocks_security_generic_login_errors', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
181 ),
182 array(),
183 Requirement::Always,
184 ),
185 new FieldDefinition(
186 'blocks_security_disable_app_passwords',
187 \__( 'Disable Application Passwords', 'blocks' ),
188 \__( 'Turn off WordPress Application Passwords (a REST auth surface). Leave off if you use headless or app-password integrations.', 'blocks' ),
189 FieldType::Checkbox,
190 array(
191 new SettingDefinition( 'blocks_security_disable_app_passwords', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
192 ),
193 array(),
194 Requirement::Always,
195 ),
196 ),
197 false,
198 ),
199 new SectionDefinition(
200 'blocks_hide_login_section',
201 \__( 'Hide Login URL', 'blocks' ),
202 array(
203 \__( 'Replace the default /wp-login.php URL with a custom path. Both the toggle and a non-empty Login Path must be set for the rewrite to be active.', 'blocks' ),
204 ),
205 array(
206 new FieldDefinition(
207 'blocks_hide_login_enabled',
208 \__( 'Enable Custom Login URL', 'blocks' ),
209 \__( 'Replace wp-login.php with a custom path. Requires a Login Path below to be active.', 'blocks' ),
210 FieldType::Checkbox,
211 array(
212 new SettingDefinition( 'blocks_hide_login_enabled', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ),
213 ),
214 array(),
215 Requirement::Always,
216 ),
217 new FieldDefinition(
218 'blocks_login_slug',
219 \__( 'Login Path', 'blocks' ),
220 \__( 'Required when "Enable Custom Login URL" is on. Choose a unique path (e.g. "secret-door"). Reserved values like "admin" or "login" are rejected.', 'blocks' ),
221 FieldType::Text,
222 array(
223 new SettingDefinition( 'blocks_login_slug', 'string', '', SanitizerType::LoginSlug, sensitive: false, exportable: true, public_token: null ),
224 ),
225 array(),
226 Requirement::Always,
227 ),
228 ),
229 false,
230 ),
231 ),
232 Requirement::Always,
233 );
234 }
235 }
236