Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: use primordials #1217

Closed
cmorten opened this issue Sep 9, 2021 · 3 comments
Closed

suggestion: use primordials #1217

cmorten opened this issue Sep 9, 2021 · 3 comments

Comments

@cmorten
Copy link
Contributor

cmorten commented Sep 9, 2021

Is your feature request related to a problem? Please describe. A clear and
concise description of what the problem is.

The std lib currently (mostly) uses builtin globals straight from the environment. This means that they are vulnerable to overwrites which can cause unexpected behaviours / security issues.

REF:

Describe the solution you'd like A clear and concise description of what you
want to happen.

Following precedent set in Node's std library and Deno core, consider introduce a primordials module to std which can be used, either through import or as a global.

REF:

Describe alternatives you've considered A clear and concise description of
any alternative solutions or features you've considered.

  • Not using primordials - subject to issues stated above
  • "Localised" primordials - each module handcrafts handling of globals it needs rather than from a centralised place

Additional context Add any other context or screenshots about the feature
request here.

REF:

@nayeemrmn
Copy link
Contributor

-1. As I've said in other contexts I think std should be treated as a model user space library. Since it is technically in user space (not built-in unlike Node std), it makes for a good opportunity to have something like that. So IMO we shouldn't do it in std unless we think any serious userland project should.

@bartlomieju
Copy link
Member

I agree with Nayeem. Other factor is that "primordials" are not public code, and we definitely don't want to expose it in any way.

@cmorten
Copy link
Contributor Author

cmorten commented Sep 9, 2021

Cool thanks both for opinions! Seen references in code saying that maybe we should, but no issue (that I could find) to that effect!

This can stand as a reference for anyone else that is curious to this end 😄

Closing as “won’t do” given above justification.

@cmorten cmorten closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants