Skip to content

compatibility with node --frozen-intrinsics security option #53

@timkuijsten

Description

@timkuijsten

(note: this is a dupe of #50, but with a clear focus on security)

I've started to use the node --frozen-intrinsics option on more and more projects as recommended by the Node.js Security Best Practices because it mitigates the risk of monkey patching.

When trying to run some 3rd party code that depends on depd it fails to start when the option is used:

~/foo $ node --frozen-intrinsics -e 'require("depd")("foo")'
/home/me/foo/node_modules/depd/index.js:268
  var file = callSite.getFileName() || '<anonymous>'
                      ^

TypeError: callSite.getFileName is not a function
    at callSiteLocation (/home/me/foo/node_modules/depd/index.js:268:23)
    at depd (/home/me/foo/node_modules/depd/index.js:109:14)
    at [eval]:1:16
    at runScriptInThisContext (node:internal/vm:143:10)
    at node:internal/process/execution:100:14
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:83:62)
    at evalScript (node:internal/process/execution:114:10)
    at node:internal/main/eval_string:30:3

Node.js v18.20.1

~/foo/node_modules/depd $ npm info

depd@2.0.0 | MIT | deps: none | versions: 17
Deprecate all the things
https://github.com/dougwilson/nodejs-depd#readme

keywords: deprecate, deprecated

dist
.tarball: https://registry.npmjs.org/depd/-/depd-2.0.0.tgz
.shasum: b696163cc757560d09cf22cc8fad1571b79e76df
.integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
.unpackedSize: 27.1 kB

maintainers:
- dougwilson <doug@somethingdoug.com>

dist-tags:
latest: 2.0.0  

published over a year ago by dougwilson <doug@somethingdoug.com>

I was wondering what the current status is for supporting this option?

See also the discussion around the --disallow-code-generation-from-strings security option in #41.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions