Skip to content
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

Added ability to secure calls via allow_unprotected_calls protocol config flag. #241

Closed
wants to merge 5 commits into from

Conversation

seveirein
Copy link
Contributor

This is a resolution to #239

See that for more information.

…r netrefs ("allow_unprotected_calls")

Whenever you call a netref with rpyc, formerly the call passes through even on the most restrictive
security settings. This is almost necessary, given that blocking __call__ means that every naked function/method
will not be callable, unless augmented by adding _rpyc_getattr_. This commit checks wrapped/bound calls to see
if they are accessible from thier parent __self__ (via their __name__), and allows them.

There are now also _rpyc_class_getattr/_rpyc_class_setattr/_rpyc_class_getattr which are used when the object
being queried is a class. Otherwise their non-class equivalents are still used, and if they raise
AttributeError, the class versions are called (if available).
Defaulting access via getattr/setattr/delattr was broken, and
the tests I was running was only testing new functionality. My bad.
The unit tests run now, and I added test_protected_calls
@coldfix
Copy link
Contributor

coldfix commented Nov 11, 2017

I didn't check in detail so far, but it seems to me that this is quite a big patch for such a small logical semantic change. :/

IMO, the getattr mechanism was already too heavy as is (but maybe that's just the code quality there), and I wouldn't want to add even more complexity. I might have time tomorrow or some time next week to think about how to make it slicker allround.

@seveirein seveirein closed this Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants