bug(bug): Sandbox loaded files in execution spec
Currently when we use the @file:abc.js annotation in a file like foo.md, and try to access it in bar.md we succeed. The expected behaviour is that all files defined in foo.md should be local to that file and sandboxed for that tests defined in foo.md. Those file should never be accessible from bar.md or any other file.
/bounty 50$
~~## 💎 $50 bounty • Tailcall Inc.~~
~~### Steps to solve:~~
~~1. Start working: Comment /attempt #1570 with your implementation plan~~
~~2. Submit work: Create a pull request including /claim #1570 in the PR body to claim the bounty~~
~~3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts~~
~~🙏 Thank you for contributing to tailcallhq/tailcall!~~ ~~🧐 Checkout our guidelines before you get started.~~
| Attempt | Started (GMT+0) | Solution |
|---|---|---|
| 🔴 @ssddOnTop | Mar 27, 2024, 9:09:04 AM | WIP |
| 🔴 @webbdays | Mar 27, 2024, 1:09:03 PM | WIP |
~~/attempt~~
Cancelling my attempt
Implement access control system , you could enforce a rule that files included via [@file ] annotations can only be accessed from the same directory. Ensure that the runtime environment enforces these access restrictions.
Currently when we use the
@file:abc.jsannotation in a file likefoo.md, and try to access it inbar.mdwe succeed. The expected behaviour is that all files defined infoo.mdshould be local to that file and sandboxed for that tests defined infoo.md. Those file should never be accessible frombar.mdor any other file.
In b/w which files Where we can see this behaviour? in current tests.
we can access in any other files?
got it.
thread_local! {
// Practically only one JS runtime is created because CHANNEL_RUNTIME is single threaded.
// TODO: that is causing issues in `execution_spec` tests because the runtime
// is initialized only once and that implementation will be reused by all the tests
static LOCAL_RUNTIME: RefCell<OnceCell<LocalRuntime>> = const { RefCell::new(OnceCell::new()) };
}
There are two options:
- define separate new scope other than global every time for each script.
- clear global scope everytime.
dropping.
it needs knowledge on v8
Anyone working on this?
Feel free to create a thread on discord to discuss or get clarifications.
Action required: Issue inactive for 30 days. Status update or closure in 7 days.
Issue closed after 7 days of inactivity.