-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: HTTPRequest fails when processing input text records that need tainting and their position is after file type records #1095
Comments
Jordi Puiggené wrote at 2023-1-18 02:39 -0800:
A `TypeError: can't pickle cStringIO.StringO objects` is raised when `ZPublisher` processes a request input record with a value that contains a character that needs to be tainted (e.g. "<") and when a record from "file" type has been processed previously.
Tainting is an old security feature for DTML: when form data or cookies
are accessed implicitly via the request object,
they are (HTML) quoted on DTML rendering if they contain unsafe characters.
The tainting logic is incredibly complex and your bug report
reveals one of its holes. I have tried to streamline it in
"#648", but this is not
yet merged (and might have the same problem you have observed).
Page templates no longer rely on tainting logic; they quote by
default and unquoted rendering must be called for explicitly (and
this hopefully is not done for things involving user input).
If you do not process untrusted user input with DTML objects,
you could disable the tainting logic giving the envvar
"ZOPE_DTML_REQUEST_AUTOQUOTE" e.g. the value "0".
This should avoid the bug you have reported.
Note that Zope's management interface (--> "ZMI") partially still uses DTML.
Thus, if you disable tainting, you likely must restrict the use
of large parts of the ZMI to trusted users.
A good starting point would be to restrict the permission
`View management screens` (or similarly spelled) to `Manager`.
|
Merged
Sure, let me try |
Excellent! 🎊 it works properly now. Thank you very much @d-maurer for your fast response, we really appreciate it! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BUG/PROBLEM REPORT / FEATURE REQUEST
A
TypeError: can't pickle cStringIO.StringO objects
is raised whenZPublisher
processes a request input record with a value that contains a character that needs to be tainted (e.g. "<") and when a record from "file" type has been processed previously.When a value from a record should be tainted,
ZPublisher
does it, but it also does adeepcopy
of the records processed earlier here:Zope/src/ZPublisher/HTTPRequest.py
Lines 725 to 726 in 53d8f7e
deepcopy
cannot do the job and the following traceback arises:As a result, the base error screen from plone "We’re sorry, but there seems to be an error…" is rendered, but without any error or traceback information.
What I did:
Tried to submit a form made of the following:
What I expect to happen:
No traceback, records are processed correctly
What actually happened:
PDB session
What version of Python and Zope/Addons I am using:
The text was updated successfully, but these errors were encountered: