{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/696","repository_url":"https://api.github.com/repos/svaarala/duktape","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/696/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/696/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/696/events","html_url":"https://github.com/svaarala/duktape/issues/696","id":150610108,"number":696,"title":"API call to require() module","user":{"login":"fatcerberus","id":4097841,"avatar_url":"https://avatars.githubusercontent.com/u/4097841?v=3","gravatar_id":"","url":"https://api.github.com/users/fatcerberus","html_url":"https://github.com/fatcerberus","followers_url":"https://api.github.com/users/fatcerberus/followers","following_url":"https://api.github.com/users/fatcerberus/following{/other_user}","gists_url":"https://api.github.com/users/fatcerberus/gists{/gist_id}","starred_url":"https://api.github.com/users/fatcerberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatcerberus/subscriptions","organizations_url":"https://api.github.com/users/fatcerberus/orgs","repos_url":"https://api.github.com/users/fatcerberus/repos","events_url":"https://api.github.com/users/fatcerberus/events{/privacy}","received_events_url":"https://api.github.com/users/fatcerberus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/svaarala/duktape/labels/api","name":"api","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-04-24T00:23:56Z","updated_at":"2016-04-24T22:31:00Z","closed_at":null,"body":"I propose an API call which would do the equivalent of `require(\"foo\")` and push the exports object onto the stack.  In minisphere 4.0 I want to move to a more modular core API like Node.js has and it would be useful to be able to access core modules from C code."},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/214052550","html_url":"https://github.com/svaarala/duktape/issues/696#issuecomment-214052550","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/696","id":214052550,"user":{"login":"fatcerberus","id":4097841,"avatar_url":"https://avatars.githubusercontent.com/u/4097841?v=3","gravatar_id":"","url":"https://api.github.com/users/fatcerberus","html_url":"https://github.com/fatcerberus","followers_url":"https://api.github.com/users/fatcerberus/followers","following_url":"https://api.github.com/users/fatcerberus/following{/other_user}","gists_url":"https://api.github.com/users/fatcerberus/gists{/gist_id}","starred_url":"https://api.github.com/users/fatcerberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatcerberus/subscriptions","organizations_url":"https://api.github.com/users/fatcerberus/orgs","repos_url":"https://api.github.com/users/fatcerberus/repos","events_url":"https://api.github.com/users/fatcerberus/events{/privacy}","received_events_url":"https://api.github.com/users/fatcerberus/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T22:31:00Z","updated_at":"2016-04-24T22:31:00Z","body":"Okay, let's stop using the word \"untrusted\" because that's a loaded term - despite what I said above I'm not actually concerned with security in this case.  My concern is more practical.  What it comes down to is that native code and Ecmascript may be written by different people.  Each one is a black box from the perspective of the other, mediated by a scripting language where monkey-patching is encouraged.  So to answer your question above:\r\n\r\n> Would the same apply to Ecmascript code which is part of the engine/platform? If not, why not? :)\r\n\r\nNo, it would not.  If `JSON.parse` has been monkey-patched by Ecmascript code, then the Ecmascript code can deal with the fallout.  The native code, in the general case, cannot--and in fact has no way of even knowing the rug was pulled out from under it."}}