[Aikido] Fix 11 security issues in jinja2, flask, werkzeug and 2 more - #21
Open
aikido-autofix[bot] wants to merge 1 commit into
Open
[Aikido] Fix 11 security issues in jinja2, flask, werkzeug and 2 more#21aikido-autofix[bot] wants to merge 1 commit into
aikido-autofix[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade dependencies to fix path traversal, XSS injection, DoS attacks, and debugger PIN vulnerabilities. This update includes breaking changes that require manual migration.
1. Python 2 Support Dropped
Where affected: Entire codebase (
runtime.txtspecifiespython-2.7.13)Impact: Werkzeug 2.0.0+ and Flask-Cors 4.0.0+ drop support for Python 2. The codebase uses Python 2-specific syntax (
cStringIO,long,unicode,xrange) throughout multiple files (requestbin/__init__.py,requestbin/filters.py,requestbin/models.py)Remediation: Upgrade to Python 3.8+ and migrate all Python 2 syntax to Python 3 (replace
cStringIOwithio.StringIO, removelong/unicodetype checks, replacexrangewithrange)2. werkzeug.contrib Module Removed
Where affected:
requestbin/__init__.py:42Impact:
from werkzeug.contrib.fixers import ProxyFixwill fail as thewerkzeug.contribmodule was removed in Werkzeug 1.0.ProxyFixwas moved towerkzeug.middleware.proxy_fixRemediation: Change import to
from werkzeug.middleware.proxy_fix import ProxyFix3. request.values Behavior Change for GET Requests
Where affected:
requestbin/models.py:77(self.form_data.append([k, input.values[k]]))Impact: In Werkzeug 2.0+,
request.valuesno longer includesformdata for GET requests. This code iterates overinput.formbut accessesinput.values[k], which may not contain the expected dataRemediation: Change
input.values[k]toinput.form[k]orinput.form.getlist(k)to explicitly access form data4. Timezone-Aware Datetime Values
Where affected:
requestbin/filters.py:80,117andrequestbin/models.py:112(usesdatetime.datetime.utcfromtimestamp()anddatetime.datetime.fromtimestamp())Impact: Werkzeug 2.0+ returns timezone-aware datetime objects with
tzinfo=timezone.utc. The code uses naive datetime objects which may cause comparison or serialization issuesRemediation: Update datetime handling to work with timezone-aware datetime objects or explicitly convert to naive datetimes if needed
All breaking changes by upgrading werkzeug from version 0.9.3 to 3.1.6 (CHANGELOG)
sslmodule instead ofOpenSSLfor the builtin server. OpenSSL contexts are not supported anymore, but insteadssl.SSLContextfrom the stdlib.wrappers.Request.methodis now always uppercase, eliminating inconsistencies of the WSGI environment.mimetypeparameters on request and response classes are now always converted to lowercase.generate_password_hashhave been changed to more secure ones.best_matchfor mime types.response.ageis parsed as atimedelta. Previously, it was incorrectly treated as adatetime.Authorization.qopis a string instead of a set, to comply with RFC 2617.Request.application.get_multion cache clients now returns lists all the time.MultiDictto capture all values for cookies with the same key.cookies[key]returns the first value rather than the last.MapandRulehave amerge_slashesoption to collapse multiple slashes into one, similar to how many HTTP servers behave. This is enabled by default.SharedDataMiddlewaredefaultfallback_mimetypeisapplication/octet-stream. If a filename looks like a text mimetype, theutf-8charset is added to it.datetimevalues are timezone-aware withtzinfo=timezone.utc.RequestandResponseclasses. Using the mixin classes is no longer necessary and will show a deprecation warning.Response.get_json()no longer caches the result, and thecacheparameter is removed.Response.freeze()generates anETagheader if one is not set. Theno_etagparameter is no longer used.Unauthorizedproduces oneWWW-Authenticateheader per value inwww_authenticate, rather than joining them into a single value.default_stream_factoryto match the order used when calling it.send_filesetsconditional=Trueandmax_age=Noneby default.Cache-Controlis set tono-cacheifmax_ageis not set, otherwisepublic.generate_password_hash. Increase PBKDF2 iterations to 260000 from 150000. Increase salt length to 16 from 8.Clientrequest methods always return an instance ofTestResponse. In addition to the normal behavior ofResponse, this class providesrequestwith the request that produced the response, andhistoryto track intermediate responses whenfollow_redirectsis used.__Secureprefixed cookies.LocalProxymatches the current Python data model special methods, including all r-ops, in-place ops, and async.__class__is proxied, so the proxy will look like the object in more cases, includingisinstance. Useissubclass(type(obj), LocalProxy)to check if an object is actually a proxy.LocalusesContextVaron Python 3.7+ instead ofthreading.local.request.valuesdoes not includeformfor GET requests.Map.build, list values do not filter outNoneor collapse to a single value. Passing aMultiDictdoes collapse single items.threadedorprocessesis enabled.append_slash_redirectis 308 instead of 301.Response.autocorrect_location_headeris disabled by default. TheLocationheader URL will remain relative, and exclude the scheme and domain, by default.Request.get_json()will raise a 400BadRequesterror if theContent-Typeheader is notapplication/json./it must set the class variablepart_isolating = False.Request.get_json()will raise a415 Unsupported Media Typeerror if theContent-Typeheader is notapplication/json, instead of a generic 400.part_isolatingdefaults toFalseif itsregexcontains a/.quote_header_valuequotes the empty string.dump_options_headerskipsNonevalues rather than using a bare key.dump_cookieallowsdomainvalues that do not include a dot., and strips off a leading dot.dump_cookiedoes not setpath="/"unnecessarily by default.domainandpathparameters default tolocalhostand/.request.max_content_lengthis set, it is checked immediately when accessing the stream, and while reading from the stream in general, rather than only during form parsing._, as they are ambiguous with dashes-in WSGI.secure_filenamelooks for more Windows reserved file names.generate_password_hashsupports scrypt. Plain hash methods are deprecated, only scrypt and pbkdf2 are supported.generate_password_hashuses scrypt by default.Request.max_form_memory_sizedefaults to 500kB instead of unlimited. Non-file form fields over this size will cause aRequestEntityTooLargeerror.request.cache_controlandresponse.cache_controlhas been significantly adjusted.All breaking changes by upgrading flask-cors from version 3.0.2 to 3.0.9 (CHANGELOG)
always_send=True, and'*'is in the allowed origins, and a request is made without an Origin header, noAccess-Control-Allow-Originsheader will now be returned (previously this header was sent, but this was a bug)All breaking changes by upgrading Flask-Cors from version 3.0.2 to 3.0.9 (CHANGELOG)
always_send=True, and'*'is in the allowed origins, and a request is made without an Origin header, noAccess-Control-Allow-Originsheader will now be returned (previously this header was sent, but this was a bug)✅ 11 CVEs resolved by this upgrade
This PR will resolve the following CVEs:
xmlattrfilter fails to properly sanitize attribute keys, allowing injection of special characters (/,>,=) that enable XSS attacks when user-controlled keys are rendered in XML/HTML attributes.