From 570108ac4457cf1c7b3512ed05dad6be4cf40183 Mon Sep 17 00:00:00 2001 From: Saoirse Aronson Date: Thu, 22 Oct 2026 15:04:36 +0200 Subject: [PATCH] Stop using reference equality for bytes match The equals method on `byte[]` performs reference equality rather than structural equality. Instead just delegate to our own equals method, like `Term.Null` and `Term.Date` do. In the current library this check would incorrectly fail: ``` foo(hex:deadbeef); check if foo(hex:deadbeef); ``` --- .../src/main/java/org/eclipse/biscuit/datalog/Term.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/biscuit-core/src/main/java/org/eclipse/biscuit/datalog/Term.java b/biscuit-core/src/main/java/org/eclipse/biscuit/datalog/Term.java index 2d7dfe80..da296cc6 100644 --- a/biscuit-core/src/main/java/org/eclipse/biscuit/datalog/Term.java +++ b/biscuit-core/src/main/java/org/eclipse/biscuit/datalog/Term.java @@ -301,11 +301,9 @@ public byte[] value() { public boolean match(final Term other) { if (other instanceof Variable) { return true; + } else { + return this.equals(other); } - if (other instanceof Bytes) { - return this.value.equals(((Bytes) other).value); - } - return false; } public Bytes(final byte[] value) {