-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Don't allow custom build script path to escape package root #12286
Don't allow custom build script path to escape package root #12286
Conversation
r? @epage (rustbot has picked a reviewer for you, use r? to override) |
@weihanglo I tried to follow your suggestions, but it didn't work. Specifically if the build script is outside of package directory, then build_ar_list doesn't even know about it. So I couldn't add the check there. Eventually I found where build field parsing happens, and decided to add the check there. Please let me know if this is an acceptable approach or not. I realize that there could be breakages for existing users who use EDIT: Failure of |
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.
Thanks for the contribution!
Yup your concern is totally valid. It seems to prevent from having any build script outside the package root even for a local build. From my understanding we want the check only when packaging .crate
file.
Specifically if the build script is outside of package directory, then build_ar_list doesn't even know about it. So I couldn't add the check there.
Have you tried this? You should be able to access build scripts and other targets from Target::src_path()
.
pkg.manifest().targets().filter(|t| t.src_path() /* and some logic to check */)
Ping @yerke. Just checking in to see if you are still interested in working on this, or if you had any questions. r? @weihanglo |
☔ The latest upstream changes (presumably #12768) made this pull request unmergeable. Please resolve the merge conflicts. |
Close this in favor of another new active PR #12995 As always, thanks for the contribution, and looking forward to you coming back :) |
What does this PR try to resolve?
Don't allow custom build script path to escape package root.
Specifically the PR:
Fixes 11383
How should we test and review this PR?
This PR is still in the exploration stage and I will add tests after we settle on the general approach.
Additional information
This PR is still in the exploration stage and I want to get feedback from the team on the general approach.