graaljs
graaljs copied to clipboard
Fetch implementation
Implementation of https://fetch.spec.whatwg.org/
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). The following contributors of this PR have not signed the OCA:
- PR author: @KaindlJulian
- [email protected] (@KaindlJulian)
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.
When singing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.
You are missing to put the name "Response" into the global scope. Have a look at JSRealm.setupGlobals
. This way, there are builtins for Response
but JavaScript does not know what to do when you search for Response
on the global object.
I am not sure this is the whole error, I would expect just a ReferenceError
to emerge from that, but let's check.
This is a great feature. Just some suggestions for security, in a SaaS or PaaS situation, Graal could be used to run JS code fron untrusted sources i.e. the SaaS clients. To help with this it would be great to be able to intercept the following from Java:
- Domain Name / IP / DNS - This is to requests to internal IP/Domains can be blocked or logged
- Before a request is sent - So requests can be validated or modified, For example, Being able to securely add credential headers or block a requests if it's malicious
- After a response has been received but before passed to JS - So responses can be tracked, cached or modified before being passed to JS
Some examples of useful events can be found here: https://square.github.io/okhttp/4.x/okhttp/okhttp3/-event-listener/
This will allow platforms to better secure network access that comes from their platforms.