Skip to content
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 restricted mode when installing in non-canonical data dir #1815

Merged
merged 1 commit into from Feb 22, 2018

Conversation

shlevy
Copy link
Member

@shlevy shlevy commented Jan 25, 2018

No description provided.

@shlevy shlevy requested a review from edolstra January 25, 2018 14:53
@shlevy
Copy link
Member Author

shlevy commented Feb 2, 2018

Ping

@edolstra
Copy link
Member

edolstra commented Feb 6, 2018

Why does it matter whether the install location is non-canonical? (What's the canonical location anyway?)

@shlevy
Copy link
Member Author

shlevy commented Feb 6, 2018

Canonical as-in canonPath

@shlevy
Copy link
Member Author

shlevy commented Feb 6, 2018

It matters because NIX_PATH lookup canonicalizes the path first, so it's disallowed in restricted mode.

@LnL7
Copy link
Member

LnL7 commented Feb 6, 2018

I think there's a similar problem when $(pwd) is a symlink, or is this related?

@shlevy
Copy link
Member Author

shlevy commented Feb 6, 2018

This is related, yeah.

@shlevy
Copy link
Member Author

shlevy commented Feb 18, 2018

@edolstra ping

@@ -311,7 +311,7 @@ EvalState::EvalState(const Strings & _searchPath, ref<Store> store)
addToSearchPath("nix=" + settings.nixDataDir + "/nix/corepkgs");

if (settings.restrictEval || settings.pureEval) {
allowedPaths = PathSet();
allowedPaths = {canonPath(settings.nixDataDir + "/nix/corepkgs", true)};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the correct fix to do

addToSearchPath("nix=" + canonPath(settings.nixDataDir + "/nix/corepkgs"));

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll switch to that.

@shlevy
Copy link
Member Author

shlevy commented Feb 22, 2018

@edolstra Fixed

@edolstra edolstra merged commit ddbcd01 into NixOS:master Feb 22, 2018
@shlevy shlevy deleted the data-dir-non-canon branch February 22, 2018 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants