Skip to content

Commit

Permalink
Merge pull request #5250 from edolstra/censor-flake-lock
Browse files Browse the repository at this point in the history
Disallow reading flake.lock
  • Loading branch information
edolstra authored Sep 14, 2021
2 parents 1fbaf36 + e559611 commit 2c751c0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libexpr/primops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,11 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va
{
PathSet context;
Path path = state.coerceToPath(pos, *args[0], context);
if (baseNameOf(path) == "flake.lock")
throw Error({
.msg = hintfmt("cannot read '%s' because flake lock files can be out of sync", path),
.errPos = pos
});
try {
state.realiseContext(context);
} catch (InvalidPathError & e) {
Expand Down

0 comments on commit 2c751c0

Please sign in to comment.