2929use SensitiveParameter ;
3030
3131/**
32- * Class Security
33- *
3432 * Provides methods that help protect your site against
3533 * Cross-Site Request Forgery attacks.
3634 *
@@ -42,26 +40,6 @@ class Security implements SecurityInterface
4240 public const CSRF_PROTECTION_SESSION = 'session ' ;
4341 protected const CSRF_HASH_BYTES = 16 ;
4442
45- /**
46- * CSRF Protection Method
47- *
48- * Protection Method for Cross Site Request Forgery protection.
49- *
50- * @var string 'cookie' or 'session'
51- *
52- * @deprecated 4.4.0 Use $this->config->csrfProtection.
53- */
54- protected $ csrfProtection = self ::CSRF_PROTECTION_COOKIE ;
55-
56- /**
57- * CSRF Token Randomization
58- *
59- * @var bool
60- *
61- * @deprecated 4.4.0 Use $this->config->tokenRandomize.
62- */
63- protected $ tokenRandomize = false ;
64-
6543 /**
6644 * CSRF Hash (without randomization)
6745 *
@@ -71,28 +49,6 @@ class Security implements SecurityInterface
7149 */
7250 protected $ hash ;
7351
74- /**
75- * CSRF Token Name
76- *
77- * Token name for Cross Site Request Forgery protection.
78- *
79- * @var string
80- *
81- * @deprecated 4.4.0 Use $this->config->tokenName.
82- */
83- protected $ tokenName = 'csrf_token_name ' ;
84-
85- /**
86- * CSRF Header Name
87- *
88- * Header name for Cross Site Request Forgery protection.
89- *
90- * @var string
91- *
92- * @deprecated 4.4.0 Use $this->config->headerName.
93- */
94- protected $ headerName = 'X-CSRF-TOKEN ' ;
95-
9652 /**
9753 * The CSRF Cookie instance.
9854 *
@@ -109,58 +65,6 @@ class Security implements SecurityInterface
10965 */
11066 protected $ cookieName = 'csrf_cookie_name ' ;
11167
112- /**
113- * CSRF Expires
114- *
115- * Expiration time for Cross Site Request Forgery protection cookie.
116- *
117- * Defaults to two hours (in seconds).
118- *
119- * @var int
120- *
121- * @deprecated 4.4.0 Use $this->config->expires.
122- */
123- protected $ expires = 7200 ;
124-
125- /**
126- * CSRF Regenerate
127- *
128- * Regenerate CSRF Token on every request.
129- *
130- * @var bool
131- *
132- * @deprecated 4.4.0 Use $this->config->regenerate.
133- */
134- protected $ regenerate = true ;
135-
136- /**
137- * CSRF Redirect
138- *
139- * Redirect to previous page with error on failure.
140- *
141- * @var bool
142- *
143- * @deprecated 4.4.0 Use $this->config->redirect.
144- */
145- protected $ redirect = false ;
146-
147- /**
148- * CSRF SameSite
149- *
150- * Setting for CSRF SameSite cookie token.
151- *
152- * Allowed values are: None - Lax - Strict - ''.
153- *
154- * Defaults to `Lax` as recommended in this link:
155- *
156- * @see https://portswigger.net/web-security/csrf/samesite-cookies
157- *
158- * @var string
159- *
160- * @deprecated `Config\Cookie` $samesite property is used.
161- */
162- protected $ samesite = Cookie::SAMESITE_LAX ;
163-
16468 private readonly IncomingRequest $ request ;
16569
16670 /**
@@ -454,29 +358,6 @@ public function shouldRedirect(): bool
454358 return $ this ->config ->redirect ;
455359 }
456360
457- /**
458- * Sanitize Filename
459- *
460- * Tries to sanitize filenames in order to prevent directory traversal attempts
461- * and other security threats, which is particularly useful for files that
462- * were supplied via user input.
463- *
464- * If it is acceptable for the user input to include relative paths,
465- * e.g. file/in/some/approved/folder.txt, you can set the second optional
466- * parameter, $relativePath to TRUE.
467- *
468- * @deprecated 4.6.2 Use `sanitize_filename()` instead
469- *
470- * @param string $str Input file name
471- * @param bool $relativePath Whether to preserve paths
472- */
473- public function sanitizeFilename (string $ str , bool $ relativePath = false ): string
474- {
475- helper ('security ' );
476-
477- return sanitize_filename ($ str , $ relativePath );
478- }
479-
480361 /**
481362 * Restore hash from Session or Cookie
482363 */
0 commit comments