Import data: from data: should be allowed #53992
Labels
experimental
Issues and PRs related to experimental features.
loaders
Issues and PRs related to ES module loaders
Version
20.15.1 (LTS) up to 22.5.1
Platform
Subsystem
No response
What steps will reproduce the bug?
Minimal reproducible scenario:
Running this without
--experimental-network-imports
works fine (and is expected).However, adding
--experimental-network-imports
throwsERR_NETWORK_IMPORT_DISALLOWED
even though no network import occurs.The issue clearly comes from this code branch which specifically checks for:
data:
protocol in theimport()
statementfile:
protocol in the parent module--experimental-network-imports
Based on the subsequent branch it seems like importing
data:
is supposed to be allowed everywhere (of coursehttp:
andhttps:
sources being only accepted with the flag), and it looks like the case wheredata:
imports from anotherdata:
was overlooked.How often does it reproduce? Is there a required condition?
Consistently reproducible with the steps described above.
What is the expected behavior? Why is that the expected behavior?
The expectation is that the code snippet works with and without
--experimental-network-imports
.What do you see instead?
ERR_NETWORK_IMPORT_DISALLOWED
as per above.Additional information
Importing
data:
from anotherdata:
may not be the most practical use case, but it's rather important from the correctness PoV. I personally don't see any security implications (e.g. as long as there are no relative imports occurring insidedata:
modules — but this issue here appears to be unrelated to those).The text was updated successfully, but these errors were encountered: