Skip to content

Commit c52d77e

Browse files
committed
ensure policies are empty
1 parent 091a309 commit c52d77e

File tree

1 file changed

+10
-0
lines changed
  • src/main/java/org/biscuitsec/biscuit/token/builder/parser

1 file changed

+10
-0
lines changed

src/main/java/org/biscuitsec/biscuit/token/builder/parser/Parser.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ public static Either<Map<Integer, List<Error>>, Block> datalog(long index, Strin
179179
Tuple5<List<Fact>, List<Rule>, List<Check>, List<Scope>, List<Policy>> components =
180180
result.get();
181181

182+
if (!components._5.isEmpty()) {
183+
return Either.left(
184+
Map.of(
185+
-1, // we don't have a line number for policies
186+
List.of(
187+
new Error(
188+
s,
189+
"Policies must be empty but found " + components._5.size() + " policies"))));
190+
}
191+
182192
components._1.forEach(blockBuilder::addFact);
183193
components._2.forEach(blockBuilder::addRule);
184194
components._3.forEach(blockBuilder::addCheck);

0 commit comments

Comments
 (0)