This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
Update dependency MechanicalSoup to v1 [SECURITY] #190
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.
This PR contains the following updates:
==0.11.0
->==1.3.0
GitHub Vulnerability Alerts
CVE-2023-34457
Summary
A malicious web server can read arbitrary files on the client using a
<input type="file" ...>
inside HTML form.Details
This affects the extremely common pattern of form submission:
The problem is with the code in
browser.Browser.get_request_kwargs
:The file path is taken from the bs4 tag "value" attribute. However, this path will default to whatever the server sends. So if a malicious web server were to send something like:
then upon
.submit_selected()
the mechanicalsoup browser will happily send over the contents of your SSH private key.PoC
Suggested patch
Impact
All users of MechanicalSoup's form submission are affected, unless they took very specific (and manual) steps to reset HTML form field values.
Release Notes
MechanicalSoup/MechanicalSoup (MechanicalSoup)
v1.3.0
: Version 1.3.0Compare Source
Breaking changes
To prevent malicious web servers from reading arbitrary files from the client, files must now be opened explicitly by the user in order to upload their contents in form submission. For example, instead of:
you would now use:
This remediates CVE-2023-34457. Our thanks to @e-c-d for reporting and helping to fix the vulnerability!
Main changes
Added support for Python 3.11.
Allow submitting a form with no submit element. This can be achieved by passing
submit=False
toStatefulBrowser.submit_selected
. Thanks @alexreg! [#480]v1.2.0
: Version 1.2.0Compare Source
Main changes
Added support for Python 3.10.
Added support for HTML form-associated elements (i.e. input elements that are associated with a form by a
form
attribute, but are not a child element of the form). [#380]Bug fixes
v1.1.0
: Version 1.1.0Compare Source
Main changes
Dropped support for EOL Python versions: 2.7 and 3.5.
Increased minimum version requirement for requests from 2.0 to 2.22.0 and beautifulsoup4 from 4.4 to 4.7.
Use encoding from the HTTP request when no HTML encoding is specified. [#355]
Added the
put
method to theBrowser
class. This is a light wrapper aroundrequests.Session.put
. [#359]Don't override
Referer
headers passed in by the user. [#364]StatefulBrowser
methodsfollow_link
anddownload_link
now support passing a dictionary of keyword arguments torequests
, viarequests_kwargs
. For symmetry, they also support passing Beautiful Soup args in asbs4_kwargs
, although any excess**kwargs
are sent to Beautiful Soup as well, just as they were previously. [#368]Many thanks to the contributors who made this release possible!
v1.0.0
: Version 1.0.0Compare Source
This is the last release that will support Python 2.7. Thanks to the many contributors that made this release possible!
Main changes:
Added support for Python 3.8 and 3.9.
StatefulBrowser
has new propertiespage
,form
, andurl
, which can be used in place of the methodsget_current_page
,get_current_form
andget_url
respectively (e.g. the newx.page
is equivalent tox.get_current_page()
). These methods may be deprecated in a future release. [#175]StatefulBrowser.form
will raise anAttributeError
instead of returningNone
if no form has been selected yet. Note thatStatefulBrowser.get_current_form()
still returnsNone
for backward compatibility.Bug fixes
Decompose
<select>
elements with the same name when adding a new input element to a form. [#297]The
params
anddata
kwargs passed tosubmit
will now properly be forwarded to the underlying request for GET methods (whereas previouslyparams
was being overwritten bydata
). [#343]v0.12.0
: Version 0.12.0Compare Source
Main changes:
Changes in official python version support: added 3.7 and dropped 3.4.
Added ability to submit a form without updating
StatefulBrowser
internal state:submit_selected(..., update_state=False)
. This means you get a response from the form submission, but your browser stays on the same page. Useful for handling forms that result in a file download or open a new tab.Bug fixes
Improve handling of form enctype to behave like a real browser. [#242]
HTML
type
attributes are no longer required to be lowercase. [#245]Form controls with the
disabled
attribute will no longer be submitted to improve compliance with the HTML standard. If you were relying on this bug to submit disabled elements, you can still achieve this by deleting thedisabled
attribute from the element in theForm
object directly. [#248]When a form containing a file input field is submitted without choosing a file, an empty filename & content will be sent just like in a real browser. [#250]
<option>
tags without avalue
attribute will now use their text as the value. [#252]The optional
url_regex
argument tofollow_link
anddownload_link
was fixed so that it is no longer ignored. [#256]Allow duplicate submit elements instead of raising a LinkNotFoundError. [#264]
Our thanks to the many new contributors in this release!
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.