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

xmlrpc.client.ServerProxy() should accept a custom SSL context parameter #67149

Closed
desbma mannequin opened this issue Nov 27, 2014 · 7 comments
Closed

xmlrpc.client.ServerProxy() should accept a custom SSL context parameter #67149

desbma mannequin opened this issue Nov 27, 2014 · 7 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@desbma
Copy link
Mannequin

desbma mannequin commented Nov 27, 2014

BPO 22960
Nosy @pitrou, @giampaolo, @tiran, @benjaminp, @alex, @desbma, @dstufft
Files
  • issue22960.diff
  • issue22960-3.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2014-11-30.04:37:20.704>
    created_at = <Date 2014-11-27.20:23:06.510>
    labels = ['type-feature', 'library']
    title = 'xmlrpc.client.ServerProxy() should accept a custom SSL context parameter'
    updated_at = <Date 2014-11-30.11:55:59.449>
    user = 'https://github.com/desbma'

    bugs.python.org fields:

    activity = <Date 2014-11-30.11:55:59.449>
    actor = 'desbma'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-11-30.04:37:20.704>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2014-11-27.20:23:06.510>
    creator = 'desbma'
    dependencies = []
    files = ['37321', '37323']
    hgrepos = []
    issue_num = 22960
    keywords = ['patch']
    message_count = 7.0
    messages = ['231778', '231880', '231882', '231883', '231884', '231885', '231888']
    nosy_count = 9.0
    nosy_names = ['janssen', 'pitrou', 'giampaolo.rodola', 'christian.heimes', 'benjamin.peterson', 'alex', 'python-dev', 'desbma', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22960'
    versions = ['Python 2.7', 'Python 3.5']

    @desbma
    Copy link
    Mannequin Author

    desbma mannequin commented Nov 27, 2014

    When using xmlrpc.server it is possible (despite being intrusive) to use a custom SSL context, ie:

    import ssl
    import xmlrpc.server
    
    rpc_server = xmlrpc.server.SimpleXMLRPCServer(...)
    ssl_context = ssl.SSLContext()
    # setup the context ...
    rpc_server.socket = ssl_context.wrap_socket(rpc_server.socket, ...)

    However it is not possible (unless using some ugly monkey patching, which I am ashamed of writing) to do the same for xmlrpc.client.

    xmlrpc.client.ServerProxy() could accept a context constructor, and pass it to the SafeTransport instance, and then to the http.client.HTTPSConnection instance (https://hg.python.org/cpython/file/3.4/Lib/xmlrpc/client.py#l1338).

    I would allow passing a SSL context more secure than the default one, and thus improve security.

    @desbma desbma mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 27, 2014
    @alex
    Copy link
    Member

    alex commented Nov 30, 2014

    Attached is a patch for 2.7

    @benjaminp
    Copy link
    Contributor

    benjaminp commented Nov 30, 2014

    I suppose I should ask you to write a test. Of course, HTTPS doesn't seem to be tested at all right now (see the attractive "FIXME: mostly untested" comment in SafeTransport.) Maybe, it's easier now, though, using the code in Lib/test/ssl_servers.py?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 30, 2014

    New changeset 62bd574e95d5 by Benjamin Peterson in branch '2.7':
    add context parameter to xmlrpclib.ServerProxy (bpo-22960)
    https://hg.python.org/cpython/rev/62bd574e95d5

    @alex
    Copy link
    Member

    alex commented Nov 30, 2014

    Attached patch fixes it for Python3.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 30, 2014

    New changeset 4b00430388ad by Benjamin Peterson in branch '3.4':
    add context parameter to xmlrpclib.ServerProxy (bpo-22960)
    https://hg.python.org/cpython/rev/4b00430388ad

    New changeset 2a126ce6f83e by Benjamin Peterson in branch 'default':
    merge 3.4 (bpo-22960)
    https://hg.python.org/cpython/rev/2a126ce6f83e

    @desbma
    Copy link
    Mannequin Author

    desbma mannequin commented Nov 30, 2014

    Thank you

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants