GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix TypeError when using subprocess shell=True under strict Java Secu… by akspi · Pull Request #419 · jython/jython Conversation
Stewori
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note: SecurityManager is deprecated for removal. Perhaps, it's premature to address this here, before it's actually removed. Once it's removed and the definitive JDK version of the removal is known, we can add a conditional skip.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
jeff5
reviewed
|
|
|
||
| class MySecurityManager(SecurityManager): | ||
| def checkRead(self, file, context=None): | ||
| if file == "/bin/sh" or file == "cmd.exe" or file.endswith("sh"): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This needs a little more thought. Ok, it's only for the test and we're not proposing a real security manager. But it fails on my Windows machine because file contains "C:\Windows\System32\cmd.exe". And what is the intent of endswith("sh") anyway? So, probably endswith("cmd.exe").
It passes on the Windows CI because we do not enable the subprocess resource. (Seems like an omission right now.)
Fixed like that, and with checkRead printing what file it has be asked about, I find that subprocess._setup_platform() involves looking for an awful lot of files.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| "-c", 1]) | ||
|
|
||
|
|
||
| class SecurityManagerTestCase(unittest.TestCase): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Or on second thoughts, is this maybe happier in test_subprocess_jy.py, where everything is Jython-specific?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list' in subprocess.Popen when using shell=True under strict Java SecurityManager
There was an error while loading. Please reload this page.