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

Update validator to remove Node vm dependency #53

Merged
merged 1 commit into from
May 15, 2023

Conversation

mikehw
Copy link
Contributor

@mikehw mikehw commented Feb 8, 2023

Removing vm references and replacing the validation code with a Function eval.

This change should enable the use of fast-redact in browsers and Deno.

Addresses issue #37

Copy link
Collaborator

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these implementations are equivalent. The current implementation runs the code in a completely new V8 context (https://nodejs.org/api/vm.html#what-does-it-mean-to-contextify-an-object). The proposed change runs the code in the same context with access to the parent scope.

I'm interested to hear @davidmarkclements's and @mcollina's views on this.

@mcollina
Copy link
Collaborator

mcollina commented Feb 9, 2023

Why would you do this?

@mikehw
Copy link
Contributor Author

mikehw commented Feb 9, 2023

I would like to use fast-redact in a Deno project, but Deno currently does not support vm.

While the code running has access to the parent scope it should have no side effects, and vm should not be used as a security mechanism per the node documentation. Related Article

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Collaborator

I don't think vm is actually needed here.

@mcollina mcollina merged commit 73679fd into davidmarkclements:main May 15, 2023
renovate bot referenced this pull request in valora-inc/logging May 18, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fast-redact](https://togithub.com/davidmarkclements/fast-redact) |
[`^3.1.2` ->
`^3.2.0`](https://renovatebot.com/diffs/npm/fast-redact/3.1.2/3.2.0) |
[![age](https://badges.renovateapi.com/packages/npm/fast-redact/3.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/fast-redact/3.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/fast-redact/3.2.0/compatibility-slim/3.1.2)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/fast-redact/3.2.0/confidence-slim/3.1.2)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>davidmarkclements/fast-redact</summary>

###
[`v3.2.0`](https://togithub.com/davidmarkclements/fast-redact/releases/tag/v3.2.0)

[Compare
Source](https://togithub.com/davidmarkclements/fast-redact/compare/v3.1.2...v3.2.0)

##### What's Changed

- docs(paths): add a specific call-out for hyphens by
[@&#8203;dncrews](https://togithub.com/dncrews) in
[https://github.com/davidmarkclements/fast-redact/pull/56](https://togithub.com/davidmarkclements/fast-redact/pull/56)
- fix: updated redaction mechanism for wild cards above level 2 by
[@&#8203;gurjotkaur20](https://togithub.com/gurjotkaur20) in
[https://github.com/davidmarkclements/fast-redact/pull/58](https://togithub.com/davidmarkclements/fast-redact/pull/58)
- Update validator to remove Node vm dependency by
[@&#8203;mikehw](https://togithub.com/mikehw) in
[https://github.com/davidmarkclements/fast-redact/pull/53](https://togithub.com/davidmarkclements/fast-redact/pull/53)

##### New Contributors

- [@&#8203;dncrews](https://togithub.com/dncrews) made their first
contribution in
[https://github.com/davidmarkclements/fast-redact/pull/56](https://togithub.com/davidmarkclements/fast-redact/pull/56)
- [@&#8203;gurjotkaur20](https://togithub.com/gurjotkaur20) made their
first contribution in
[https://github.com/davidmarkclements/fast-redact/pull/58](https://togithub.com/davidmarkclements/fast-redact/pull/58)
- [@&#8203;mikehw](https://togithub.com/mikehw) made their first
contribution in
[https://github.com/davidmarkclements/fast-redact/pull/53](https://togithub.com/davidmarkclements/fast-redact/pull/53)

**Full Changelog**:
davidmarkclements/fast-redact@v3.1.2...v3.2.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - "after 8:00 before 23:00 every weekday except on Friday" in
timezone UTC.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/valora-inc/logging).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45My4wIiwidXBkYXRlZEluVmVyIjoiMzUuOTMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants