parse-asn1 icon indicating copy to clipboard operation
parse-asn1 copied to clipboard

Error

Open lcalhoun-scs opened this issue 1 year ago • 5 comments

This is using an outdated version asn1.js where there is an error Can't resolve 'vm' in \node_modules\parse-asn1\node_modules\asn1.js\lib\asn1

lcalhoun-scs avatar Aug 28 '24 19:08 lcalhoun-scs

Can you provide a repro, so I can see this error myself? Locally for me, node_modules/asn1.js/lib/asn1.js doesn't have any vm requires, and vm is a node core module so it wouldn't ever try to be resolved in any node version.

ljharb avatar Aug 28 '24 20:08 ljharb

@ljharb check for node_modules/parse-asn1/node_modules/asn1.js/lib/api.js

This is a regression, see my comment here https://github.com/browserify/parse-asn1/issues/39

cnemo-cenic avatar Apr 25 '25 21:04 cnemo-cenic

Yes, it means that bundlers for CSP-enforced targets still have the problem of using eval.

If the relevant asn1.js fix can be backported to v4, or v5's engines can be widened to match v4's, then we can fix this easily.

ljharb avatar Apr 25 '25 22:04 ljharb

I think the fix can be backported, although I am no export on backwards compatibility and am not sure the actual change would still retain compatibility with the node version / es version targets you want to support.

This was the change in question: https://github.com/indutny/asn1.js/commit/21a603758fdb9467b7d566040568f3c5283e6914

cnemo-cenic avatar Apr 25 '25 22:04 cnemo-cenic

I think it's very backportable - but that's up to @indutny, not me.

ljharb avatar Apr 26 '25 05:04 ljharb