File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
resources/fixtures/issue69 Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 12
12
13
13
public class OpaTest {
14
14
static Path wasmFile ;
15
+ static Path issue69WasmFile ;
15
16
16
17
@ BeforeAll
17
18
public static void beforeAll () throws Exception {
18
19
wasmFile = OpaCli .compile ("base" , "opa/wasm/test/allowed" ).resolve ("policy.wasm" );
20
+ issue69WasmFile = OpaCli .compile ("issue69" , "authz/allow" ).resolve ("policy.wasm" );
19
21
}
20
22
21
23
@ Test
@@ -92,4 +94,16 @@ public void highLevelAPI() throws Exception {
92
94
policy .input ("{\" user\" : \" alice\" }" );
93
95
Assertions .assertFalse (Utils .getResult (policy .evaluate ()).asBoolean ());
94
96
}
97
+
98
+ @ Test
99
+ public void issue69 () throws Exception {
100
+ var policy = OpaPolicy .builder ().withPolicy (issue69WasmFile ).build ();
101
+ policy .data ("" );
102
+
103
+ policy .input ("{\" method\" :\" GET\" }" );
104
+ Assertions .assertTrue (Utils .getResult (policy .evaluate ()).asBoolean ());
105
+
106
+ policy .input ("{\" method\" :\" POST\" }" );
107
+ Assertions .assertFalse (Utils .getResult (policy .evaluate ()).asBoolean ());
108
+ }
95
109
}
Original file line number Diff line number Diff line change
1
+ package authz
2
+
3
+ import rego.v1
4
+
5
+ default allow := false
6
+
7
+ allow if {
8
+ input.method == " GET"
9
+ }
You can’t perform that action at this time.
0 commit comments