-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
validate that callback request "outputs" field matches callback #1546
Conversation
@@ -125,7 +125,7 @@ def validate_output_spec(output, output_spec, Output): | |||
for outi, speci in zip(output, output_spec): | |||
speci_list = speci if isinstance(speci, (list, tuple)) else [speci] | |||
for specij in speci_list: | |||
if Output(specij["id"], specij["property"]) != outi: | |||
if not Output(specij["id"], specij["property"]) == outi: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really hoping this is the last Py2 bug I have to fix 🤦
We implemented __eq__
for dependencies but in Py2
There are no implied relationships among the comparison operators. The truth of
x==y
does not imply thatx!=y
is false.
whereas in Py3
For
__ne__()
, by default it delegates to__eq__()
and inverts the result
A cross-site-scripting (XSS) vulnerability exists when it is possible for an attacker to use a web server's public interface to send arbitrary code to another user. This is commonly done by "injecting" the malicious code into a request to the server. In some cases, this code can then be served up to another user when they make a subsequent request to the server, possibly compromising the security of that user's session for the original attacker's benefit. One way to test whether or not a web application is vulnerable to a XSS attack is to see if it is possible to get the server to respond to a request containing arbitrary code with that same code. If this is seen to occur, then there is potentially a XSS vulnerability, if the server can be coaxed in sending this arbitrary code in a form where it can be executed by the browser. Along with malicious actors, professional penetration testers are likely to perform this test if they have engaged to evaluate Dash's security by a potential customer of the Dash Enterprise platform. In the context of Dash, the test for XSS vulnerabilities described above might lead to the perception that Dash is vulnerable to this kind of attack. This is because as we currently do not validate the content of a callback function's This is noticeable in the This ensures that Dash is currently architected, a user's session will never execute any potentially malicious code that is injected into a callback function's In the interest of making sure that the perception of Dash's security aligns with the reality, this PR introduces an additional This additional steps means that any arbitrary text that is not related to a properly registered callback that is injected into the How This PR Was Tested: In order to make sure that the
Combined with the fact that this test passes in the CI build of this branch, I have high confidence that the current PR adequately addresses the underlying issue. 💃🏿 Very nice work @alexcjohnson, I learned a ton by looking at this code. |
When a callback request comes in, it has two somewhat redundant fields:
output
andoutputs
. The former is the stringified callback ID, the latter a dict {id, property} or list of such dicts (potentially nested in case of multi-element pattern-matching wildcards). We look up the callback using onlyoutput
, but then in the response we incorporate the values inoutputs
. We don't believe this is an actual security issue but it looks like it could be one because malicious content inserted inoutputs
will come back unmodified. This PR removes the perception of a problem by ensuringoutputs
contains only component IDs and props allowed byoutput
(andoutput
we know is valid because it's required to match a known callback).Contributor Checklist
CHANGELOG.md