about summary refs log tree commit diff
path: root/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r--src/libexpr/get-drvs.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index 5342739c53c4..ae9fb0e5ec38 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -3,6 +3,7 @@
 #include "eval-inline.hh"
 
 #include <cstring>
+#include <regex>
 
 
 namespace nix {
@@ -262,6 +263,9 @@ static string addToPath(const string & s1, const string & s2)
 }
 
 
+static std::regex attrRegex("[A-Za-z_][A-Za-z0-9-_+]*");
+
+
 static void getDerivations(EvalState & state, Value & vIn,
     const string & pathPrefix, Bindings & autoArgs,
     DrvInfos & drvs, Done & done,
@@ -286,6 +290,8 @@ static void getDerivations(EvalState & state, Value & vIn,
            precedence). */
         for (auto & i : v.attrs->lexicographicOrder()) {
             Activity act(*logger, lvlDebug, format("evaluating attribute ‘%1%’") % i->name);
+            if (!std::regex_match(std::string(i->name), attrRegex))
+                continue;
             string pathPrefix2 = addToPath(pathPrefix, i->name);
             if (combineChannels)
                 getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done, ignoreAssertionFailures);