-
Notifications
You must be signed in to change notification settings - Fork 522
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
fix(builtin): don't allow symlinks to escape or enter bazel managed node_module folders #1800
fix(builtin): don't allow symlinks to escape or enter bazel managed node_module folders #1800
Conversation
88026cc
to
4b648d5
Compare
4b648d5
to
94eeb00
Compare
94eeb00
to
37038c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, I kinda understand. I wish @soldair was available for review but I think it's good.
Would be nice to have that added test coverage but I guess there's integration test coverage coming from some downstream usecase like jest?
# escape and no symlinks may enter | ||
if [ "$(basename ${BAZEL_PATCH_ROOT})" == "execroot" ]; then | ||
# We are in execroot, linker node_modules is in the PWD | ||
export BAZEL_PATCH_GUARDS="${PWD}/node_modules" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this doesn't work if your node_modules is in a subdirectory, which we support - but I think that's what BAZEL_NODE_MODULES_ROOT is doing below? maybe this needs a comment that we do this in a catch-all case where we don't have a BAZEL_NODE_MODULES_ROOT - but then why does that happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BAZEL_NODE_MODULES_ROOT is the path to the external workspace such as npm/node_modules
.
This path is actually the path to the linker symlink node_modules under execroot which should work regardless of where node_modules is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BAZEL_NODE_MODULES_ROOT is always set in templated_args above:
env_vars += """if [[ -z "${BAZEL_NODE_MODULES_ROOT:-}" ]]; then
export BAZEL_NODE_MODULES_ROOT=%s
fi
""" % node_modules_root
so below is just a sanity check
37038c0
to
c1f2f29
Compare
10bd951
to
ceebe1a
Compare
00a4c20
to
23c1500
Compare
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Issue bazel-contrib#1803 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
23c1500
to
330bebf
Compare
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
330bebf
to
3212252
Compare
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
3212252
to
c380f0a
Compare
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
46c0343
to
a5e6da4
Compare
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
a5e6da4
to
e55d3c3
Compare
9773808
to
0209cff
Compare
…ode_module folders
0209cff
to
0c16611
Compare
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
\o sorry for the delay. i somehow missed most of my communication last week |
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
…mmits) Squashed commits: [241a8bc] build: use ts_library macro with common defaults [12b3f3c] build: use @bazel/bazelisk [22792f3] ci: update required status checks [d7dbbab] build: use no-remote-exec tag so test still runs in sandbox Turns out there is a linker bug with no sandbox. [3eeab18] build: run tests depending on webdriver-manager locally [2cf4d32] docs: add bazel jasmine_node_test debug information [c0d3912] build: update to rules_nodejs 1.6.0 [4f0cb97] build: add webdriver-manager update & ngcc to postinstall This is required so that yarn_install can add all generated & downloaded files to the generated bazel filegroups [be1f0ed] ci: use xlarge for bazel tests [27f94da] test: remove non-bazel test setup [d085d5e] build: update yarn lock [3bc6c54] test(@angular/cli): add npm_integration_test [c83a90f] build: add missing npm_package_archive targets [8f72222] test(@angular-devkit/build-ng-packagr): build and test with Bazel [c56b83e] test(@angular-devkit/build-angular): build and test with Bazel [a7e827c] test(@angular-devkit/build-webpack): build and test with Bazel [4e7bcd3] build: use rules_nodejs snapshot Snapshot for bazel-contrib/rules_nodejs#1800, taken from https://github.com/aspect-dev/rules_nodejs-builds/tree/labs. Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths. [4507c05] build: don't copy root package test folders [8b79f9d] fix(@ngtools/webpack): remove internal markers With these in, we can't access the properties from other Bazel targets. [e1bc6e1] fix(@ngtools/webpack): export VirtualFileSystemDecorator type We shouldn't need to export this, but webpack-rollup-loader uses it. [ffce320] refactor: rename toplevel BUILD to BUILD.bazel [90e5429] build: also validade BUILD.bazel files
No description provided.