{"action":"created","issue":{"url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/2494","repository_url":"https://api.github.com/repos/MovingBlocks/Terasology","labels_url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/2494/labels{/name}","comments_url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/2494/comments","events_url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/2494/events","html_url":"https://github.com/MovingBlocks/Terasology/pull/2494","id":180757325,"number":2494,"title":"Whitelist many stream classes","user":{"login":"SoniEx2","id":1779619,"avatar_url":"https://avatars.githubusercontent.com/u/1779619?v=3","gravatar_id":"","url":"https://api.github.com/users/SoniEx2","html_url":"https://github.com/SoniEx2","followers_url":"https://api.github.com/users/SoniEx2/followers","following_url":"https://api.github.com/users/SoniEx2/following{/other_user}","gists_url":"https://api.github.com/users/SoniEx2/gists{/gist_id}","starred_url":"https://api.github.com/users/SoniEx2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoniEx2/subscriptions","organizations_url":"https://api.github.com/users/SoniEx2/orgs","repos_url":"https://api.github.com/users/SoniEx2/repos","events_url":"https://api.github.com/users/SoniEx2/events{/privacy}","received_events_url":"https://api.github.com/users/SoniEx2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MovingBlocks/Terasology/labels/in%20progress","name":"in progress","color":"ededed"},{"url":"https://api.github.com/repos/MovingBlocks/Terasology/labels/Security","name":"Security","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2016-10-03T21:55:58Z","updated_at":"2016-10-10T07:39:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MovingBlocks/Terasology/pulls/2494","html_url":"https://github.com/MovingBlocks/Terasology/pull/2494","diff_url":"https://github.com/MovingBlocks/Terasology/pull/2494.diff","patch_url":"https://github.com/MovingBlocks/Terasology/pull/2494.patch"},"body":"<!-- Thanks for submitting a pull request for Terasology! :-)\r\nPlease fill in some brief details below about the PR.\r\nIf it contains source code please make sure to run Checkstyle on it first\r\nIf you add unit tests we'll love you forever! -->\r\n\r\n### Contains\r\n\r\nAdds many InputStream/OutputStream-related classes to the whitelist.\r\n\r\nThe classes whitelisted in this PR are safe and cannot open files.\r\n\r\nThis makes way for a potential Virtual FS API, and adds support for many libraries which use InputStream and OutputStream.\r\n\r\n### How to test\r\n\r\nNo idea. Custom asset formats maybe?"},"comment":{"url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/comments/252552498","html_url":"https://github.com/MovingBlocks/Terasology/pull/2494#issuecomment-252552498","issue_url":"https://api.github.com/repos/MovingBlocks/Terasology/issues/2494","id":252552498,"user":{"login":"immortius","id":1388872,"avatar_url":"https://avatars.githubusercontent.com/u/1388872?v=3","gravatar_id":"","url":"https://api.github.com/users/immortius","html_url":"https://github.com/immortius","followers_url":"https://api.github.com/users/immortius/followers","following_url":"https://api.github.com/users/immortius/following{/other_user}","gists_url":"https://api.github.com/users/immortius/gists{/gist_id}","starred_url":"https://api.github.com/users/immortius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immortius/subscriptions","organizations_url":"https://api.github.com/users/immortius/orgs","repos_url":"https://api.github.com/users/immortius/repos","events_url":"https://api.github.com/users/immortius/events{/privacy}","received_events_url":"https://api.github.com/users/immortius/received_events","type":"User","site_admin":false},"created_at":"2016-10-10T07:39:37Z","updated_at":"2016-10-10T07:39:37Z","body":"The stream classes themselves look safe to me. I would say a simple use case for adding them is to support introduction of new asset file formats by streams. The important thing is they cannot open or save files, or access the network, in of themselves. If you want to be very careful, the only immediately needed stream is BufferedInputStream, since that is what the asset system makes available to formats.\r\n\r\nOn awt... yeah, could do with a review. Perhaps we should just drop support for awt, although I know this probably affects some world gen code. Alternatively, wrap it, throw in permission checks.\r\n\r\nIf someone is willing to do some work on prompting the user for permission to use a module with non-default api reqs, then Terasology can do the android style \"This module requires File permissions\" thing.\r\n\r\nOn virtual file systems, gestalt-module actually presents an active module environment as a virtual filesystem (via NIO) - Terasology doesn't make this available to modules though.\r\n\r\nOn doing method and constructor level whitelisting... this is sort of possible, but.. ugh. The sandbox system at the moment works through custom classloaders that do not make non-whitelisted classes available to code. This is performant and straight forward. Method level whitelisting... I can think of a couple of approaches, but they are all fairly involved. Probably the least icky is dynamically reviewing module code to ensure it doesn't call disallowed methods, but you'ld have to deal with how this works with inheritance in the mix. It is generally simpler and better to create and expose custom api that wraps the functionality instead. Then you can also use the standard java permissions system to limit method calls."}}
{"actor":{"display_login":"immortius"}}