{"action":"created","issue":{"url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/109","repository_url":"https://api.github.com/repos/zopefoundation/RestrictedPython","labels_url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/109/comments","events_url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/109/events","html_url":"https://github.com/zopefoundation/RestrictedPython/pull/109","id":323942610,"number":109,"title":"disallow imports from modules starting with '_'","user":{"login":"loechel","id":1766708,"avatar_url":"https://avatars0.githubusercontent.com/u/1766708?v=4","gravatar_id":"","url":"https://api.github.com/users/loechel","html_url":"https://github.com/loechel","followers_url":"https://api.github.com/users/loechel/followers","following_url":"https://api.github.com/users/loechel/following{/other_user}","gists_url":"https://api.github.com/users/loechel/gists{/gist_id}","starred_url":"https://api.github.com/users/loechel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loechel/subscriptions","organizations_url":"https://api.github.com/users/loechel/orgs","repos_url":"https://api.github.com/users/loechel/repos","events_url":"https://api.github.com/users/loechel/events{/privacy}","received_events_url":"https://api.github.com/users/loechel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-17T09:29:46Z","updated_at":"2018-05-17T19:58:39Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/zopefoundation/RestrictedPython/pulls/109","html_url":"https://github.com/zopefoundation/RestrictedPython/pull/109","diff_url":"https://github.com/zopefoundation/RestrictedPython/pull/109.diff","patch_url":"https://github.com/zopefoundation/RestrictedPython/pull/109.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/comments/389990315","html_url":"https://github.com/zopefoundation/RestrictedPython/pull/109#issuecomment-389990315","issue_url":"https://api.github.com/repos/zopefoundation/RestrictedPython/issues/109","id":389990315,"user":{"login":"stephan-hof","id":620934,"avatar_url":"https://avatars3.githubusercontent.com/u/620934?v=4","gravatar_id":"","url":"https://api.github.com/users/stephan-hof","html_url":"https://github.com/stephan-hof","followers_url":"https://api.github.com/users/stephan-hof/followers","following_url":"https://api.github.com/users/stephan-hof/following{/other_user}","gists_url":"https://api.github.com/users/stephan-hof/gists{/gist_id}","starred_url":"https://api.github.com/users/stephan-hof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephan-hof/subscriptions","organizations_url":"https://api.github.com/users/stephan-hof/orgs","repos_url":"https://api.github.com/users/stephan-hof/repos","events_url":"https://api.github.com/users/stephan-hof/events{/privacy}","received_events_url":"https://api.github.com/users/stephan-hof/received_events","type":"User","site_admin":false},"created_at":"2018-05-17T19:58:39Z","updated_at":"2018-05-17T19:58:39Z","author_association":"MEMBER","body":"> For all other cases we deny names starting with _\r\n\r\nThe next explanation is just to ensure that we are on the same page.\r\nUnder all circumstances it must be avoided that a user overrides the RestrictedPython internal functions like  `_write_` or  `_getattr_`\r\n=> It must be impossible that a user can add names starting with underscore to the current scope.\r\n\r\nHowever, importing from a module which starts with an underscore is not a problem at all.\r\nFor example the following import is \"safe\", since the name with the underscore is not added to the scope:\r\n`from _xxx_ import a`\r\n\r\nSo yes, this change adds nothing from a security point of view.\r\n\r\nHaving said this I'm not convinced that we need this change for consistency reasons.\r\nMy main argument would be backward compatibility, because existing code doing this imports would fail now.\r\nKeep in mind that much of the code, executed by RestrictedPython, is out of our control.\r\nThis code is stored in ZODB and probably running there for ages. \r\n\r\nMy second (weaker) argument would be. How far should we go with \"restricting\".\r\nIt's not the job of RestrictedPython to enforce conventions. \r\n\r\nAs a possible compromise I could imagine to leave it as a \"warning/deprecation\".\r\nIf you intend to do so, I would suggest to move the check  from `check_import_names` to `visit_ImportFrom`. Which makes the `isinstance(node, ast.ImportFrom)` obsolete."}}
{"actor":{"display_login":"stephan-hof"}}