ybelkada HF Staff commited on
Commit
fadca4a
·
verified ·
1 Parent(s): 9992bf6

Harbor format: 1000 cyber_authorization tasks (part 5)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/cedar_authorization-344541266f451abc7160/environment/Dockerfile +1 -0
  2. tasks/cedar_authorization-344541266f451abc7160/instruction.md +31 -0
  3. tasks/cedar_authorization-344541266f451abc7160/solution/reference.json +1 -0
  4. tasks/cedar_authorization-344541266f451abc7160/solution/solve.sh +3 -0
  5. tasks/cedar_authorization-344541266f451abc7160/task.toml +26 -0
  6. tasks/cedar_authorization-344541266f451abc7160/tests/expected.json +1 -0
  7. tasks/cedar_authorization-344541266f451abc7160/tests/grading.py +49 -0
  8. tasks/cedar_authorization-344541266f451abc7160/tests/test.sh +3 -0
  9. tasks/cedar_authorization-344541266f451abc7160/tests/verify.py +14 -0
  10. tasks/cedar_authorization-344541266f451abc7160/validation/openenv.json +1 -0
  11. tasks/cedar_authorization-3446381d91c2258e7aa9/environment/Dockerfile +1 -0
  12. tasks/cedar_authorization-3446381d91c2258e7aa9/instruction.md +31 -0
  13. tasks/cedar_authorization-3446381d91c2258e7aa9/solution/reference.json +1 -0
  14. tasks/cedar_authorization-3446381d91c2258e7aa9/solution/solve.sh +3 -0
  15. tasks/cedar_authorization-3446381d91c2258e7aa9/task.toml +26 -0
  16. tasks/cedar_authorization-3446381d91c2258e7aa9/tests/expected.json +1 -0
  17. tasks/cedar_authorization-3446381d91c2258e7aa9/tests/grading.py +49 -0
  18. tasks/cedar_authorization-3446381d91c2258e7aa9/tests/test.sh +3 -0
  19. tasks/cedar_authorization-3446381d91c2258e7aa9/tests/verify.py +14 -0
  20. tasks/cedar_authorization-3446381d91c2258e7aa9/validation/openenv.json +1 -0
  21. tasks/cedar_authorization-3474d1cba6034fa411e2/environment/Dockerfile +1 -0
  22. tasks/cedar_authorization-3474d1cba6034fa411e2/instruction.md +31 -0
  23. tasks/cedar_authorization-3474d1cba6034fa411e2/solution/reference.json +1 -0
  24. tasks/cedar_authorization-3474d1cba6034fa411e2/solution/solve.sh +3 -0
  25. tasks/cedar_authorization-3474d1cba6034fa411e2/task.toml +26 -0
  26. tasks/cedar_authorization-3474d1cba6034fa411e2/tests/expected.json +1 -0
  27. tasks/cedar_authorization-3474d1cba6034fa411e2/tests/grading.py +49 -0
  28. tasks/cedar_authorization-3474d1cba6034fa411e2/tests/test.sh +3 -0
  29. tasks/cedar_authorization-3474d1cba6034fa411e2/tests/verify.py +14 -0
  30. tasks/cedar_authorization-3474d1cba6034fa411e2/validation/openenv.json +1 -0
  31. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/environment/Dockerfile +1 -0
  32. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/instruction.md +31 -0
  33. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/solution/reference.json +1 -0
  34. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/solution/solve.sh +3 -0
  35. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/task.toml +26 -0
  36. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/expected.json +1 -0
  37. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/grading.py +49 -0
  38. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/test.sh +3 -0
  39. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/verify.py +14 -0
  40. tasks/cedar_authorization-34b7ad3e8e40da1a5edb/validation/openenv.json +1 -0
  41. tasks/cedar_authorization-35a303d84b2392f13637/environment/Dockerfile +1 -0
  42. tasks/cedar_authorization-35a303d84b2392f13637/instruction.md +31 -0
  43. tasks/cedar_authorization-35a303d84b2392f13637/solution/reference.json +1 -0
  44. tasks/cedar_authorization-35a303d84b2392f13637/solution/solve.sh +3 -0
  45. tasks/cedar_authorization-35a303d84b2392f13637/task.toml +26 -0
  46. tasks/cedar_authorization-35a303d84b2392f13637/tests/expected.json +1 -0
  47. tasks/cedar_authorization-35a303d84b2392f13637/tests/grading.py +49 -0
  48. tasks/cedar_authorization-35a303d84b2392f13637/tests/test.sh +3 -0
  49. tasks/cedar_authorization-35a303d84b2392f13637/tests/verify.py +14 -0
  50. tasks/cedar_authorization-35a303d84b2392f13637/validation/openenv.json +1 -0
tasks/cedar_authorization-344541266f451abc7160/environment/Dockerfile ADDED
@@ -0,0 +1 @@
 
 
1
+ FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
tasks/cedar_authorization-344541266f451abc7160/instruction.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Review these authorization requests using Cedar semantics. Evaluate each independently against the same policies and entity snapshot. A matching forbid overrides all permits. With no matching permit the decision is deny. A policy whose evaluation errors is skipped. For an allow list all matching permits as determining; for an explicit deny list all matching forbids; for default deny use an empty list. Include all policy IDs that errored separately. The entity "in" operation includes the entity itself and transitive parents. No authorization schema is applied.
2
+ Return one JSON object with key "results". Its value is an array in request order. Each entry has "request" (the displayed ID), "decision" ("allow" or "deny"), "determining" (array of IDs), and "errors" (array of IDs). Sort each ID array lexicographically.
3
+
4
+ policy0
5
+ permit(
6
+ principal == A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333::"",
7
+ action in [A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Action::"action"],
8
+ resource == A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333::""
9
+ ) when {
10
+ true
11
+ };
12
+
13
+ policy1
14
+ forbid(
15
+ principal in r::r::r::r::r::"",
16
+ action == r::r::r::r::Action::"action",
17
+ resource in r::r::r::r::r::""
18
+ ) when {
19
+ true && ((if "||||||||||||||~|" like "*||*|*|*|*|*" then if false then "||||||||||||||~|" else "||||||||||||||~|" else if false then "||||||||||||||~|" else "||||||||||||||~|") like "|*|*|*|*|*|*") && ((if "||||||||||||||~|" like "|*|*|*|*|*|*" then if false then "||||||||||||||~|" else "||||||||||||||~|" else if false then "||||||||||||||~|" else "||||||||||||||~|") like "|**|*|***")
20
+ };
21
+
22
+ Entities
23
+ [{"attrs":{},"parents":[],"uid":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::L333"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Ro33333"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Roooooo"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::r"}},{"attrs":{"A0":"||||||||||||||~|"},"parents":[],"uid":{"id":"","type":"r::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r::r::wZgY"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}}]
24
+
25
+ Requests
26
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::r"},"request":"R1","resource":{"id":"","type":"r::r::r::r::r"}}
27
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333"},"request":"R2","resource":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333"}}
28
+ {"action":{"id":"action","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Action"},"context":{},"principal":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333"},"request":"R3","resource":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::A333333333333333"}}
29
+ {"action":{"id":"action","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::Action"},"context":{},"principal":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::r"},"request":"R4","resource":{"id":"","type":"A::A::A::A::r::r::r::r::F3OYlW0xI99A92ar0::r"}}
30
+
31
+ Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.
tasks/cedar_authorization-344541266f451abc7160/solution/reference.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-344541266f451abc7160/solution/solve.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ cp /solution/reference.json /tmp/answer.json
tasks/cedar_authorization-344541266f451abc7160/task.toml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/tmp/answer.json"]
3
+
4
+ [task]
5
+ name = "cyber-defense/cedar_authorization-344541266f451abc7160"
6
+
7
+ [metadata.cyber_defense]
8
+ family = "cedar_authorization"
9
+ sealed_task_sha256 = "98bc48df9c071a8557b8b51d1a71864ca99cd850671cf6c39956604ea958db52"
10
+
11
+ [environment]
12
+ docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"
13
+ workdir = "/tmp"
14
+ cpus = 1
15
+ memory_mb = 512
16
+ storage_mb = 2048
17
+ network_mode = "no-network"
18
+
19
+ [agent]
20
+ timeout_sec = 120
21
+ network_mode = "no-network"
22
+
23
+ [verifier]
24
+ timeout_sec = 60
25
+ environment_mode = "separate"
26
+ network_mode = "no-network"
tasks/cedar_authorization-344541266f451abc7160/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-344541266f451abc7160/tests/grading.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared JSON grading contract for the environment and rollout controller."""
2
+
3
+ import hashlib
4
+ import json
5
+ import re
6
+
7
+
8
+ def canonical(value) -> bytes:
9
+ return json.dumps(value, ensure_ascii=False, sort_keys=True,
10
+ separators=(",", ":"), allow_nan=False).encode("utf-8")
11
+
12
+
13
+ def payload_sha256(row: dict) -> str:
14
+ payload = {key: value for key, value in row.items() if key != "task_sha256"}
15
+ return hashlib.sha256(canonical(payload)).hexdigest()
16
+
17
+
18
+ def _object(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise ValueError(f"Duplicate JSON member {key!r}")
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _bad_number(token):
28
+ raise ValueError(f"Non-finite number {token!r}")
29
+
30
+
31
+ def parse_answer(text: str) -> dict:
32
+ if not isinstance(text, str):
33
+ raise ValueError("An answer must be JSON text")
34
+ text = text.strip()
35
+ fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE)
36
+ if fence:
37
+ text = fence.group(1)
38
+ value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number)
39
+ if not isinstance(value, dict):
40
+ raise ValueError("An answer must be a JSON object")
41
+ canonical(value)
42
+ return value
43
+
44
+
45
+ def reward(expected: dict, submitted: object) -> int:
46
+ try:
47
+ return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted))
48
+ except (TypeError, ValueError, RecursionError):
49
+ return 0
tasks/cedar_authorization-344541266f451abc7160/tests/test.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ exec /usr/local/bin/python -I -B -S /tests/verify.py
tasks/cedar_authorization-344541266f451abc7160/tests/verify.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from runpy import run_path
3
+
4
+ contract = run_path('/tests/grading.py')
5
+ expected = contract['parse_answer'](Path('/tests/expected.json').read_text())
6
+ answer = Path('/tmp/answer.json')
7
+ try:
8
+ submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())
9
+ except (OSError, ValueError, RecursionError):
10
+ submitted = None
11
+ value = contract['reward'](expected, submitted)
12
+ log = Path('/logs/verifier')
13
+ log.mkdir(parents=True, exist_ok=True)
14
+ (log / 'reward.txt').write_text(str(value) + '\n')
tasks/cedar_authorization-344541266f451abc7160/validation/openenv.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"profile":"harbor-semantic-v1","requires_credentials":false,"resources":{"cpu":1,"disk_mb":2048,"episode_timeout_s":180,"memory_mb":512},"reward":{"floor_margin":0.1,"oracle_tolerance":0,"range":[0,1]},"reward_key":"reward","types":{"tags":["authorization"]}}
tasks/cedar_authorization-3446381d91c2258e7aa9/environment/Dockerfile ADDED
@@ -0,0 +1 @@
 
 
1
+ FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
tasks/cedar_authorization-3446381d91c2258e7aa9/instruction.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Review these authorization requests using Cedar semantics. Evaluate each independently against the same policies and entity snapshot. A matching forbid overrides all permits. With no matching permit the decision is deny. A policy whose evaluation errors is skipped. For an allow list all matching permits as determining; for an explicit deny list all matching forbids; for default deny use an empty list. Include all policy IDs that errored separately. The entity "in" operation includes the entity itself and transitive parents. No authorization schema is applied.
2
+ Return one JSON object with key "results". Its value is an array in request order. Each entry has "request" (the displayed ID), "decision" ("allow" or "deny"), "determining" (array of IDs), and "errors" (array of IDs). Sort each ID array lexicographically.
3
+
4
+ policy0
5
+ permit(
6
+ principal == r::r::r::r::r::"***((((((((",
7
+ action,
8
+ resource
9
+ ) when {
10
+ true
11
+ };
12
+
13
+ policy1
14
+ forbid(
15
+ principal in T::r::r::r::r3::"",
16
+ action in [T::r::r::r::Action::"action",T::r::r::r::Action::"action"],
17
+ resource
18
+ ) when {
19
+ true
20
+ };
21
+
22
+ Entities
23
+ [{"attrs":{},"parents":[],"uid":{"id":"","type":"T::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"T::r::r::r::r3"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"T::r::r::r::uG"}},{"attrs":{},"parents":[],"uid":{"id":"***((((((((","type":"r::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"T::r::r::r::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}}]
24
+
25
+ Requests
26
+ {"action":{"id":"action","type":"T::r::r::r::Action"},"context":{"L5c":true,"LYY":true,"PcY":{"__entity":{"id":"***((((((((","type":"r::r::r::r::r"}}},"principal":{"id":"","type":"T::r::r::r::r3"},"request":"R1","resource":{"id":"","type":"T::r::r::r::uG"}}
27
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{"L5c":true,"LYY":true,"PcY":{"__entity":{"id":"***((((((((","type":"r::r::r::r::r"}}},"principal":{"id":"","type":"T::r::r::r::r3"},"request":"R2","resource":{"id":"***((((((((","type":"r::r::r::r::r"}}
28
+ {"action":{"id":"action","type":"T::r::r::r::Action"},"context":{"CZZZZZZ33":{"__extn":{"arg":"0000-01-01","fn":"datetime"}},"CZZZZZZZZ":{"__extn":{"arg":"0000-01-01","fn":"datetime"}},"IzzzzTTTCpm":{"__extn":{"arg":"0000-01-01","fn":"datetime"}},"O44444444444":{"__extn":{"arg":"0000-01-01","fn":"datetime"}},"O44p44444333zzzzz":{"__extn":{"arg":"0000-01-01","fn":"datetime"}}},"principal":{"id":"","type":"T::r::r::r::r3"},"request":"R3","resource":{"id":"","type":"T::r::r::r::uG"}}
29
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{"L5c":true,"LYY":true,"PcY":{"__entity":{"id":"***((((((((","type":"r::r::r::r::r"}}},"principal":{"id":"***((((((((","type":"r::r::r::r::r"},"request":"R4","resource":{"id":"***((((((((","type":"r::r::r::r::r"}}
30
+
31
+ Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.
tasks/cedar_authorization-3446381d91c2258e7aa9/solution/reference.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-3446381d91c2258e7aa9/solution/solve.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ cp /solution/reference.json /tmp/answer.json
tasks/cedar_authorization-3446381d91c2258e7aa9/task.toml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/tmp/answer.json"]
3
+
4
+ [task]
5
+ name = "cyber-defense/cedar_authorization-3446381d91c2258e7aa9"
6
+
7
+ [metadata.cyber_defense]
8
+ family = "cedar_authorization"
9
+ sealed_task_sha256 = "763e7791d1bb94943b295fe5c3b10cfe67dcd325cd5a6258bc70fc6ceb083e7a"
10
+
11
+ [environment]
12
+ docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"
13
+ workdir = "/tmp"
14
+ cpus = 1
15
+ memory_mb = 512
16
+ storage_mb = 2048
17
+ network_mode = "no-network"
18
+
19
+ [agent]
20
+ timeout_sec = 120
21
+ network_mode = "no-network"
22
+
23
+ [verifier]
24
+ timeout_sec = 60
25
+ environment_mode = "separate"
26
+ network_mode = "no-network"
tasks/cedar_authorization-3446381d91c2258e7aa9/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-3446381d91c2258e7aa9/tests/grading.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared JSON grading contract for the environment and rollout controller."""
2
+
3
+ import hashlib
4
+ import json
5
+ import re
6
+
7
+
8
+ def canonical(value) -> bytes:
9
+ return json.dumps(value, ensure_ascii=False, sort_keys=True,
10
+ separators=(",", ":"), allow_nan=False).encode("utf-8")
11
+
12
+
13
+ def payload_sha256(row: dict) -> str:
14
+ payload = {key: value for key, value in row.items() if key != "task_sha256"}
15
+ return hashlib.sha256(canonical(payload)).hexdigest()
16
+
17
+
18
+ def _object(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise ValueError(f"Duplicate JSON member {key!r}")
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _bad_number(token):
28
+ raise ValueError(f"Non-finite number {token!r}")
29
+
30
+
31
+ def parse_answer(text: str) -> dict:
32
+ if not isinstance(text, str):
33
+ raise ValueError("An answer must be JSON text")
34
+ text = text.strip()
35
+ fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE)
36
+ if fence:
37
+ text = fence.group(1)
38
+ value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number)
39
+ if not isinstance(value, dict):
40
+ raise ValueError("An answer must be a JSON object")
41
+ canonical(value)
42
+ return value
43
+
44
+
45
+ def reward(expected: dict, submitted: object) -> int:
46
+ try:
47
+ return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted))
48
+ except (TypeError, ValueError, RecursionError):
49
+ return 0
tasks/cedar_authorization-3446381d91c2258e7aa9/tests/test.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ exec /usr/local/bin/python -I -B -S /tests/verify.py
tasks/cedar_authorization-3446381d91c2258e7aa9/tests/verify.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from runpy import run_path
3
+
4
+ contract = run_path('/tests/grading.py')
5
+ expected = contract['parse_answer'](Path('/tests/expected.json').read_text())
6
+ answer = Path('/tmp/answer.json')
7
+ try:
8
+ submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())
9
+ except (OSError, ValueError, RecursionError):
10
+ submitted = None
11
+ value = contract['reward'](expected, submitted)
12
+ log = Path('/logs/verifier')
13
+ log.mkdir(parents=True, exist_ok=True)
14
+ (log / 'reward.txt').write_text(str(value) + '\n')
tasks/cedar_authorization-3446381d91c2258e7aa9/validation/openenv.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"profile":"harbor-semantic-v1","requires_credentials":false,"resources":{"cpu":1,"disk_mb":2048,"episode_timeout_s":180,"memory_mb":512},"reward":{"floor_margin":0.1,"oracle_tolerance":0,"range":[0,1]},"reward_key":"reward","types":{"tags":["authorization"]}}
tasks/cedar_authorization-3474d1cba6034fa411e2/environment/Dockerfile ADDED
@@ -0,0 +1 @@
 
 
1
+ FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
tasks/cedar_authorization-3474d1cba6034fa411e2/instruction.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Review these authorization requests using Cedar semantics. Evaluate each independently against the same policies and entity snapshot. A matching forbid overrides all permits. With no matching permit the decision is deny. A policy whose evaluation errors is skipped. For an allow list all matching permits as determining; for an explicit deny list all matching forbids; for default deny use an empty list. Include all policy IDs that errored separately. The entity "in" operation includes the entity itself and transitive parents. No authorization schema is applied.
2
+ Return one JSON object with key "results". Its value is an array in request order. Each entry has "request" (the displayed ID), "decision" ("allow" or "deny"), "determining" (array of IDs), and "errors" (array of IDs). Sort each ID array lexicographically.
3
+
4
+ policy0
5
+ permit(
6
+ principal in r32333333::"",
7
+ action in [Action::"action"],
8
+ resource == r32333333::""
9
+ ) when {
10
+ true
11
+ };
12
+
13
+ policy1
14
+ forbid(
15
+ principal is mSSSSSS,
16
+ action == Action::"action",
17
+ resource == LYY::""
18
+ ) when {
19
+ true
20
+ };
21
+
22
+ Entities
23
+ [{"attrs":{},"parents":[],"uid":{"id":"","type":"Kww"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"LYY"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"P"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"PDw"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"Pww"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"fww"}},{"attrs":{},"parents":[{"id":"","type":"LYY"}],"uid":{"id":"","type":"mSSSSSS"}},{"attrs":{"mSSSSSS":false,"mSSSSSY":false,"qgggggggg":false},"parents":[],"uid":{"id":"","type":"mgggggg"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r32333333"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r444G444444444"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"Action"}}]
24
+
25
+ Requests
26
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"r32333333"},"request":"R1","resource":{"id":"","type":"r32333333"}}
27
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"r32333333"},"request":"R2","resource":{"id":"","type":"LYY"}}
28
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"mSSSSSS"},"request":"R3","resource":{"id":"","type":"LYY"}}
29
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"mSSSSSS"},"request":"R4","resource":{"id":"","type":"mSSSSSS"}}
30
+
31
+ Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.
tasks/cedar_authorization-3474d1cba6034fa411e2/solution/reference.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-3474d1cba6034fa411e2/solution/solve.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ cp /solution/reference.json /tmp/answer.json
tasks/cedar_authorization-3474d1cba6034fa411e2/task.toml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/tmp/answer.json"]
3
+
4
+ [task]
5
+ name = "cyber-defense/cedar_authorization-3474d1cba6034fa411e2"
6
+
7
+ [metadata.cyber_defense]
8
+ family = "cedar_authorization"
9
+ sealed_task_sha256 = "f9865bd74695d3820c7afd0a42d7b254d489f6defc0e8328a3838ff04519a0eb"
10
+
11
+ [environment]
12
+ docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"
13
+ workdir = "/tmp"
14
+ cpus = 1
15
+ memory_mb = 512
16
+ storage_mb = 2048
17
+ network_mode = "no-network"
18
+
19
+ [agent]
20
+ timeout_sec = 120
21
+ network_mode = "no-network"
22
+
23
+ [verifier]
24
+ timeout_sec = 60
25
+ environment_mode = "separate"
26
+ network_mode = "no-network"
tasks/cedar_authorization-3474d1cba6034fa411e2/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-3474d1cba6034fa411e2/tests/grading.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared JSON grading contract for the environment and rollout controller."""
2
+
3
+ import hashlib
4
+ import json
5
+ import re
6
+
7
+
8
+ def canonical(value) -> bytes:
9
+ return json.dumps(value, ensure_ascii=False, sort_keys=True,
10
+ separators=(",", ":"), allow_nan=False).encode("utf-8")
11
+
12
+
13
+ def payload_sha256(row: dict) -> str:
14
+ payload = {key: value for key, value in row.items() if key != "task_sha256"}
15
+ return hashlib.sha256(canonical(payload)).hexdigest()
16
+
17
+
18
+ def _object(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise ValueError(f"Duplicate JSON member {key!r}")
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _bad_number(token):
28
+ raise ValueError(f"Non-finite number {token!r}")
29
+
30
+
31
+ def parse_answer(text: str) -> dict:
32
+ if not isinstance(text, str):
33
+ raise ValueError("An answer must be JSON text")
34
+ text = text.strip()
35
+ fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE)
36
+ if fence:
37
+ text = fence.group(1)
38
+ value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number)
39
+ if not isinstance(value, dict):
40
+ raise ValueError("An answer must be a JSON object")
41
+ canonical(value)
42
+ return value
43
+
44
+
45
+ def reward(expected: dict, submitted: object) -> int:
46
+ try:
47
+ return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted))
48
+ except (TypeError, ValueError, RecursionError):
49
+ return 0
tasks/cedar_authorization-3474d1cba6034fa411e2/tests/test.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ exec /usr/local/bin/python -I -B -S /tests/verify.py
tasks/cedar_authorization-3474d1cba6034fa411e2/tests/verify.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from runpy import run_path
3
+
4
+ contract = run_path('/tests/grading.py')
5
+ expected = contract['parse_answer'](Path('/tests/expected.json').read_text())
6
+ answer = Path('/tmp/answer.json')
7
+ try:
8
+ submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())
9
+ except (OSError, ValueError, RecursionError):
10
+ submitted = None
11
+ value = contract['reward'](expected, submitted)
12
+ log = Path('/logs/verifier')
13
+ log.mkdir(parents=True, exist_ok=True)
14
+ (log / 'reward.txt').write_text(str(value) + '\n')
tasks/cedar_authorization-3474d1cba6034fa411e2/validation/openenv.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"profile":"harbor-semantic-v1","requires_credentials":false,"resources":{"cpu":1,"disk_mb":2048,"episode_timeout_s":180,"memory_mb":512},"reward":{"floor_margin":0.1,"oracle_tolerance":0,"range":[0,1]},"reward_key":"reward","types":{"tags":["authorization"]}}
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/environment/Dockerfile ADDED
@@ -0,0 +1 @@
 
 
1
+ FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/instruction.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Review these authorization requests using Cedar semantics. Evaluate each independently against the same policies and entity snapshot. A matching forbid overrides all permits. With no matching permit the decision is deny. A policy whose evaluation errors is skipped. For an allow list all matching permits as determining; for an explicit deny list all matching forbids; for default deny use an empty list. Include all policy IDs that errored separately. The entity "in" operation includes the entity itself and transitive parents. No authorization schema is applied.
2
+ Return one JSON object with key "results". Its value is an array in request order. Each entry has "request" (the displayed ID), "decision" ("allow" or "deny"), "determining" (array of IDs), and "errors" (array of IDs). Sort each ID array lexicographically.
3
+
4
+ policy0
5
+ permit(
6
+ principal in r::r::r3::r::WMMMMM::"",
7
+ action in [r::r::r3::r::Action::"action",r::r::r3::r::Action::"action"],
8
+ resource in r::r::r3::r::WMMMMM::""
9
+ ) when {
10
+ true && (if if "1" like "*3*1*10*" then if true then true else true else {"": action} has Euqqqqq.dqqQ.d then {"": action}[""] in {"": r::r::r3::r::jwwwwwwwwwwwwwwww::""}[""] else {"": action}[""] in {"": action}[""]) && ({"": action}[""] in {"": action}[""])
11
+ };
12
+
13
+ policy1
14
+ forbid(
15
+ principal in r::r::r::r::r::"",
16
+ action == r::r::r::r::Action::"action",
17
+ resource in r::r::r::r::r::""
18
+ ) when {
19
+ true && ((if "||" like "|*|*" then if false then "||" else "||" else if false then "||" else "||") like "|*|*") && ("||" like "|*|*")
20
+ };
21
+
22
+ Entities
23
+ [{"attrs":{},"parents":[{"id":"","type":"r::r::r3::r::j3333j3335"}],"uid":{"id":"","type":"r::r::r3::r::WMMMMM"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r3::r::_YlW3333333333"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r3::r::j3333j3335"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r3::r::jwwwwwwwww"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r3::r::jwwwwwwwwwwwwwwww"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r3::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r3::r::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}}]
24
+
25
+ Requests
26
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::r"},"request":"R1","resource":{"id":"|||~|","type":"r::r::r::r::r"}}
27
+ {"action":{"id":"action","type":"r::r::r3::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r3::r::WMMMMM"},"request":"R2","resource":{"id":"","type":"r::r::r3::r::WMMMMM"}}
28
+ {"action":{"id":"action","type":"r::r::r3::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r3::r::_YlW3333333333"},"request":"R3","resource":{"id":"","type":"r::r::r3::r::_YlW3333333333"}}
29
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::r"},"request":"R4","resource":{"id":"","type":"r::r::r::r::r"}}
30
+
31
+ Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/solution/reference.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":[],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/solution/solve.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ cp /solution/reference.json /tmp/answer.json
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/task.toml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/tmp/answer.json"]
3
+
4
+ [task]
5
+ name = "cyber-defense/cedar_authorization-34b7ad3e8e40da1a5edb"
6
+
7
+ [metadata.cyber_defense]
8
+ family = "cedar_authorization"
9
+ sealed_task_sha256 = "7efd990693d12528079247dee48478510fdcb28c2ac9d57acf9461d027dc637e"
10
+
11
+ [environment]
12
+ docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"
13
+ workdir = "/tmp"
14
+ cpus = 1
15
+ memory_mb = 512
16
+ storage_mb = 2048
17
+ network_mode = "no-network"
18
+
19
+ [agent]
20
+ timeout_sec = 120
21
+ network_mode = "no-network"
22
+
23
+ [verifier]
24
+ timeout_sec = 60
25
+ environment_mode = "separate"
26
+ network_mode = "no-network"
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":[],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/grading.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared JSON grading contract for the environment and rollout controller."""
2
+
3
+ import hashlib
4
+ import json
5
+ import re
6
+
7
+
8
+ def canonical(value) -> bytes:
9
+ return json.dumps(value, ensure_ascii=False, sort_keys=True,
10
+ separators=(",", ":"), allow_nan=False).encode("utf-8")
11
+
12
+
13
+ def payload_sha256(row: dict) -> str:
14
+ payload = {key: value for key, value in row.items() if key != "task_sha256"}
15
+ return hashlib.sha256(canonical(payload)).hexdigest()
16
+
17
+
18
+ def _object(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise ValueError(f"Duplicate JSON member {key!r}")
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _bad_number(token):
28
+ raise ValueError(f"Non-finite number {token!r}")
29
+
30
+
31
+ def parse_answer(text: str) -> dict:
32
+ if not isinstance(text, str):
33
+ raise ValueError("An answer must be JSON text")
34
+ text = text.strip()
35
+ fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE)
36
+ if fence:
37
+ text = fence.group(1)
38
+ value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number)
39
+ if not isinstance(value, dict):
40
+ raise ValueError("An answer must be a JSON object")
41
+ canonical(value)
42
+ return value
43
+
44
+
45
+ def reward(expected: dict, submitted: object) -> int:
46
+ try:
47
+ return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted))
48
+ except (TypeError, ValueError, RecursionError):
49
+ return 0
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/test.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ exec /usr/local/bin/python -I -B -S /tests/verify.py
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/tests/verify.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from runpy import run_path
3
+
4
+ contract = run_path('/tests/grading.py')
5
+ expected = contract['parse_answer'](Path('/tests/expected.json').read_text())
6
+ answer = Path('/tmp/answer.json')
7
+ try:
8
+ submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())
9
+ except (OSError, ValueError, RecursionError):
10
+ submitted = None
11
+ value = contract['reward'](expected, submitted)
12
+ log = Path('/logs/verifier')
13
+ log.mkdir(parents=True, exist_ok=True)
14
+ (log / 'reward.txt').write_text(str(value) + '\n')
tasks/cedar_authorization-34b7ad3e8e40da1a5edb/validation/openenv.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"profile":"harbor-semantic-v1","requires_credentials":false,"resources":{"cpu":1,"disk_mb":2048,"episode_timeout_s":180,"memory_mb":512},"reward":{"floor_margin":0.1,"oracle_tolerance":0,"range":[0,1]},"reward_key":"reward","types":{"tags":["authorization"]}}
tasks/cedar_authorization-35a303d84b2392f13637/environment/Dockerfile ADDED
@@ -0,0 +1 @@
 
 
1
+ FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
tasks/cedar_authorization-35a303d84b2392f13637/instruction.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Review these authorization requests using Cedar semantics. Evaluate each independently against the same policies and entity snapshot. A matching forbid overrides all permits. With no matching permit the decision is deny. A policy whose evaluation errors is skipped. For an allow list all matching permits as determining; for an explicit deny list all matching forbids; for default deny use an empty list. Include all policy IDs that errored separately. The entity "in" operation includes the entity itself and transitive parents. No authorization schema is applied.
2
+ Return one JSON object with key "results". Its value is an array in request order. Each entry has "request" (the displayed ID), "decision" ("allow" or "deny"), "determining" (array of IDs), and "errors" (array of IDs). Sort each ID array lexicographically.
3
+
4
+ policy0
5
+ permit(
6
+ principal in r::r::r::r::r::"ttttttttttttttttttt",
7
+ action == r::r::r::r::Action::"action",
8
+ resource == r::r::r::r::r::""
9
+ ) when {
10
+ true && (if if if true then true else true then if true then true else false else principal is r::r::r::r::r then principal is r::r::r::r::r else principal is r::r::r::r::r) && (principal is r::r::r::r::r) && (principal is r::r::r::r::r)
11
+ };
12
+
13
+ policy1
14
+ forbid(
15
+ principal in iYYYYYY4Z44444444::"",
16
+ action in [Action::"action",Action::"action"],
17
+ resource in iYYYYYY4Z44444444::""
18
+ ) when {
19
+ true && [[[[resource, resource], [resource, resource]], [[resource, resource], [resource, resource]]], [[[resource, resource], [resource, resource]], [[resource, resource], [resource, resource]]]].contains(if [[resource, resource], [resource, resource]].contains([resource, resource]) then if false then [[[resource, resource], [resource, resource]], [[resource, resource], [resource, resource]]] else [[[resource, resource], [resource, resource]], [[resource, resource], [resource, resource]]] else [[[resource, resource], [resource, resource]], [[resource, resource], [resource, resource]]]) && (if false then {"": decimal("-441275054312267.7054")} else {"": decimal("-557019330853190.3822")})[""].lessThan(decimal("0.0"))
20
+ };
21
+
22
+ Entities
23
+ [{"attrs":{},"parents":[],"uid":{"id":"","type":"O4444124"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"Tqqqqqqqq"}},{"attrs":{},"parents":[{"id":"","type":"O4444124"},{"id":"","type":"Tqqqqqqqq"}],"uid":{"id":"","type":"iYYYYYY4Z44444444"}},{"attrs":{"H":{"__entity":{"id":"","type":"r::r::r::r::q"}},"O44444444333":true},"parents":[],"uid":{"id":"","type":"r::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}},{"attrs":{"H":{"__entity":{"id":"","type":"r::r::r::r::q"}},"O44444444333":true},"parents":[{"id":"","type":"r::r::r::r::r"}],"uid":{"id":"ttttttttttttttttttt","type":"r::r::r::r::r"}}]
24
+
25
+ Requests
26
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"iYYYYYY4Z44444444"},"request":"R1","resource":{"id":"","type":"r::r::r::r::r"}}
27
+ {"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"ttttttttttttttttttt","type":"r::r::r::r::r"},"request":"R2","resource":{"id":"","type":"r::r::r::r::r"}}
28
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"iYYYYYY4Z44444444"},"request":"R3","resource":{"id":"","type":"r::r::r::r::r"}}
29
+ {"action":{"id":"action","type":"Action"},"context":{},"principal":{"id":"","type":"iYYYYYY4Z44444444"},"request":"R4","resource":{"id":"","type":"iYYYYYY4Z44444444"}}
30
+
31
+ Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.
tasks/cedar_authorization-35a303d84b2392f13637/solution/reference.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":[],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-35a303d84b2392f13637/solution/solve.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ cp /solution/reference.json /tmp/answer.json
tasks/cedar_authorization-35a303d84b2392f13637/task.toml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ artifacts = ["/tmp/answer.json"]
3
+
4
+ [task]
5
+ name = "cyber-defense/cedar_authorization-35a303d84b2392f13637"
6
+
7
+ [metadata.cyber_defense]
8
+ family = "cedar_authorization"
9
+ sealed_task_sha256 = "3a46f432f9de10688f9a01b19705a67f6cce1cd6d11df90dbb85ad55d6a70eda"
10
+
11
+ [environment]
12
+ docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"
13
+ workdir = "/tmp"
14
+ cpus = 1
15
+ memory_mb = 512
16
+ storage_mb = 2048
17
+ network_mode = "no-network"
18
+
19
+ [agent]
20
+ timeout_sec = 120
21
+ network_mode = "no-network"
22
+
23
+ [verifier]
24
+ timeout_sec = 60
25
+ environment_mode = "separate"
26
+ network_mode = "no-network"
tasks/cedar_authorization-35a303d84b2392f13637/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"results":[{"decision":"deny","determining":[],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}
tasks/cedar_authorization-35a303d84b2392f13637/tests/grading.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared JSON grading contract for the environment and rollout controller."""
2
+
3
+ import hashlib
4
+ import json
5
+ import re
6
+
7
+
8
+ def canonical(value) -> bytes:
9
+ return json.dumps(value, ensure_ascii=False, sort_keys=True,
10
+ separators=(",", ":"), allow_nan=False).encode("utf-8")
11
+
12
+
13
+ def payload_sha256(row: dict) -> str:
14
+ payload = {key: value for key, value in row.items() if key != "task_sha256"}
15
+ return hashlib.sha256(canonical(payload)).hexdigest()
16
+
17
+
18
+ def _object(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise ValueError(f"Duplicate JSON member {key!r}")
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _bad_number(token):
28
+ raise ValueError(f"Non-finite number {token!r}")
29
+
30
+
31
+ def parse_answer(text: str) -> dict:
32
+ if not isinstance(text, str):
33
+ raise ValueError("An answer must be JSON text")
34
+ text = text.strip()
35
+ fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE)
36
+ if fence:
37
+ text = fence.group(1)
38
+ value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number)
39
+ if not isinstance(value, dict):
40
+ raise ValueError("An answer must be a JSON object")
41
+ canonical(value)
42
+ return value
43
+
44
+
45
+ def reward(expected: dict, submitted: object) -> int:
46
+ try:
47
+ return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted))
48
+ except (TypeError, ValueError, RecursionError):
49
+ return 0
tasks/cedar_authorization-35a303d84b2392f13637/tests/test.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ exec /usr/local/bin/python -I -B -S /tests/verify.py
tasks/cedar_authorization-35a303d84b2392f13637/tests/verify.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from runpy import run_path
3
+
4
+ contract = run_path('/tests/grading.py')
5
+ expected = contract['parse_answer'](Path('/tests/expected.json').read_text())
6
+ answer = Path('/tmp/answer.json')
7
+ try:
8
+ submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())
9
+ except (OSError, ValueError, RecursionError):
10
+ submitted = None
11
+ value = contract['reward'](expected, submitted)
12
+ log = Path('/logs/verifier')
13
+ log.mkdir(parents=True, exist_ok=True)
14
+ (log / 'reward.txt').write_text(str(value) + '\n')
tasks/cedar_authorization-35a303d84b2392f13637/validation/openenv.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"profile":"harbor-semantic-v1","requires_credentials":false,"resources":{"cpu":1,"disk_mb":2048,"episode_timeout_s":180,"memory_mb":512},"reward":{"floor_margin":0.1,"oracle_tolerance":0,"range":[0,1]},"reward_key":"reward","types":{"tags":["authorization"]}}