@@ -187,85 +187,6 @@ def process_response(self, request, response):
187187 return response
188188
189189
190- class XssProtectMiddleware (BaseMiddleware ):
191- """
192- DEPRECATED: Will be removed in future releases. Consider
193- django.middleware.security.SecurityMiddleware as a replacement for this via
194- SECURE_BROWSER_XSS_FILTER setting.
195-
196- Sends X-XSS-Protection HTTP header that controls Cross-Site Scripting
197- filter on MSIE. Use XSS_PROTECT option in settings file with the following
198- values:
199-
200- ``sanitize`` enable XSS filter that tries to sanitize requests instead
201- of blocking (*default*)
202-
203- ``on`` enable full XSS filter blocking XSS requests (may `leak
204- document.referrer <http://homakov.blogspot.com/2013/02/hacking-with-xss-
205- auditor.html>`_)
206-
207- ``off`` completely disable XSS filter
208-
209- **Note:** As of 1.8, Django's `SECURE_BROWSER_XSS_FILTER
210- <https://docs.djangoproject.com/en/1.8/ref/settings/#secure-browser-xss-filter>`_
211- controls the X-XSS-Protection header.
212-
213- Reference:
214-
215- - `Controlling the XSS Filter
216- <http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-
217- internet-explorer-xss-filter-with-the-x-xss-protection-http-
218- header.aspx>`_
219- """
220-
221- OPTIONAL_SETTINGS = ("XSS_PROTECT" ,)
222-
223- OPTIONS = {
224- "on" : "1; mode=block" ,
225- "off" : "0" ,
226- "sanitize" : "1" ,
227- }
228-
229- DEFAULT = "sanitize"
230-
231- def __init__ (self , get_response = None ):
232- super ().__init__ (get_response )
233- warnings .warn (
234- (
235- 'DEPRECATED: The middleware "{name}" will no longer be '
236- "supported in future releases of this library. Refer to {url} for "
237- "an alternative approach with regards to the settings: {settings}"
238- ).format (
239- name = self .__class__ .__name__ ,
240- url = DJANGO_SECURITY_MIDDLEWARE_URL ,
241- settings = "SECURE_BROWSER_XSS_FILTER" ,
242- )
243- )
244-
245- def load_setting (self , setting , value ):
246- if not value :
247- self .option = self .DEFAULT
248- return
249-
250- value = value .lower ()
251-
252- if value in self .OPTIONS .keys ():
253- self .option = value
254- return
255-
256- raise ImproperlyConfigured (
257- self .__class__ .__name__ + " invalid option for XSS_PROTECT."
258- )
259-
260- def process_response (self , request , response ):
261- """
262- Add X-XSS-Protection to the response header.
263- """
264- header = self .OPTIONS [self .option ]
265- response ["X-XSS-Protection" ] = header
266- return response
267-
268-
269190class ClearSiteDataMiddleware (BaseMiddleware ):
270191 """
271192 Sends Clear-Site-Data HTTP response header on requests that match
0 commit comments