This was bugging me because in fact should be an error, not ignored.
-- 
Benjamin Grande

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-devel/ZHDNCoNSBgMlYYJp%40personal-mutt.
From 2867bc612cd28c22ea40d4e14ad3e8df6fd90bb9 Mon Sep 17 00:00:00 2001
From: Ben Grande <ben.grand...@gmail.com>
Date: Fri, 26 May 2023 15:12:29 +0000
Subject: [PATCH] parser: Change warning of invalid path to error

Signed-off-by: Ben Grande <ben.grand...@gmail.com>
---
 qrexec/policy/parser.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/qrexec/policy/parser.py b/qrexec/policy/parser.py
index ab50f9e..143f77f 100644
--- a/qrexec/policy/parser.py
+++ b/qrexec/policy/parser.py
@@ -1956,15 +1956,14 @@ class ToposortMixIn:
         if "/" in key and (
             not key.startswith("include/") or key.count("/") > 1
         ):
-            # TODO make this an error, since we shouldn't accept this anyway
-            logging.warning(
-                "ignoring path %r included in %s on line %d; "
-                "expect problems with import order",
-                included_path,
+            raise PolicySyntaxError(
                 filepath,
                 lineno,
+                "invalid path {}, only paths inside the directories {} and "
+                "{}/include are considered".format(
+                    included_path, POLICYPATH, POLICYPATH
+                ),
             )
-            return
 
         self.included_paths[key].add(included_path)
 
-- 
Benjamin Grande <ben.grand...@gmail.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to