Harbor format: 1000 cyber_authorization tasks (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- tasks/cedar_authorization-248be0325907b508a77a/environment/DockerfileAdded+1
- tasks/cedar_authorization-248be0325907b508a77a/instruction.mdAdded+31
- tasks/cedar_authorization-248be0325907b508a77a/solution/reference.jsonAdded+1
- tasks/cedar_authorization-248be0325907b508a77a/solution/solve.shAdded+3
- tasks/cedar_authorization-248be0325907b508a77a/task.tomlAdded+26
- tasks/cedar_authorization-248be0325907b508a77a/tests/expected.jsonAdded+1
- tasks/cedar_authorization-248be0325907b508a77a/tests/grading.pyAdded+49
- tasks/cedar_authorization-248be0325907b508a77a/tests/test.shAdded+3
- tasks/cedar_authorization-248be0325907b508a77a/tests/verify.pyAdded+14
- tasks/cedar_authorization-248be0325907b508a77a/validation/openenv.jsonAdded+1
- tasks/cedar_authorization-25a4b9f7565d170d2c85/environment/DockerfileAdded+1
- tasks/cedar_authorization-25a4b9f7565d170d2c85/instruction.mdAdded+31
- tasks/cedar_authorization-25a4b9f7565d170d2c85/solution/reference.jsonAdded+1
- tasks/cedar_authorization-25a4b9f7565d170d2c85/solution/solve.shAdded+3
- tasks/cedar_authorization-25a4b9f7565d170d2c85/task.tomlAdded+26
- tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/expected.jsonAdded+1
- tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/grading.pyAdded+49
- tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/test.shAdded+3
- tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/verify.pyAdded+14
- tasks/cedar_authorization-25a4b9f7565d170d2c85/validation/openenv.jsonAdded+1
- tasks/cedar_authorization-25ac3ef22c533e1dd384/environment/DockerfileAdded+1
- tasks/cedar_authorization-25ac3ef22c533e1dd384/instruction.mdAdded+31
- tasks/cedar_authorization-25ac3ef22c533e1dd384/solution/reference.jsonAdded+1
- tasks/cedar_authorization-25ac3ef22c533e1dd384/solution/solve.shAdded+3
- tasks/cedar_authorization-25ac3ef22c533e1dd384/task.tomlAdded+26
- tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/expected.jsonAdded+1
- tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/grading.pyAdded+49
- tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/test.shAdded+3
- tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/verify.pyAdded+14
- tasks/cedar_authorization-25ac3ef22c533e1dd384/validation/openenv.jsonAdded+1
- tasks/cedar_authorization-25acf07b6a632c0438fc/environment/DockerfileAdded+1
- tasks/cedar_authorization-25acf07b6a632c0438fc/instruction.mdAdded+31
- tasks/cedar_authorization-25acf07b6a632c0438fc/solution/reference.jsonAdded+1
- tasks/cedar_authorization-25acf07b6a632c0438fc/solution/solve.shAdded+3
- tasks/cedar_authorization-25acf07b6a632c0438fc/task.tomlAdded+26
- tasks/cedar_authorization-25acf07b6a632c0438fc/tests/expected.jsonAdded+1
- tasks/cedar_authorization-25acf07b6a632c0438fc/tests/grading.pyAdded+49
- tasks/cedar_authorization-25acf07b6a632c0438fc/tests/test.shAdded+3
- tasks/cedar_authorization-25acf07b6a632c0438fc/tests/verify.pyAdded+14
- tasks/cedar_authorization-25acf07b6a632c0438fc/validation/openenv.jsonAdded+1
- tasks/cedar_authorization-26667d947850e4de7fd5/environment/DockerfileAdded+1
- tasks/cedar_authorization-26667d947850e4de7fd5/instruction.mdAdded+31
- tasks/cedar_authorization-26667d947850e4de7fd5/solution/reference.jsonAdded+1
- tasks/cedar_authorization-26667d947850e4de7fd5/solution/solve.shAdded+3
- tasks/cedar_authorization-26667d947850e4de7fd5/task.tomlAdded+26
- tasks/cedar_authorization-26667d947850e4de7fd5/tests/expected.jsonAdded+1
- tasks/cedar_authorization-26667d947850e4de7fd5/tests/grading.pyAdded+49
- tasks/cedar_authorization-26667d947850e4de7fd5/tests/test.shAdded+3
- tasks/cedar_authorization-26667d947850e4de7fd5/tests/verify.pyAdded+14
- tasks/cedar_authorization-26667d947850e4de7fd5/validation/openenv.jsonAdded+1
1FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b12345678910111213141516171819202122232425262728293031Review 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.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.
policy0permit( principal in LYg::LYY::a::"**", action == LYg::LYY::Action::"action", resource in LYg::LYY::a::"**") when { true && (true || ((principal in principal) || (LYg::LYY::a::"" in LYg::LYY::a::"**")))};
policy1forbid( principal in B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r::"", action == B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::Action::"action", resource in B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r::"") when { true && ((-6727636073941130590) < (-6727627277848107360)) && ((-6727636073947290974) < 48115491182498)};
Entities[{"attrs":{},"parents":[],"uid":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::D"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"}},{"attrs":{},"parents":[],"uid":{"id":"**","type":"LYg::LYY::a"}},{"attrs":{},"parents":[],"uid":{"id":"DDD","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"LYg::LYY::Action"}}]
Requests{"action":{"id":"action","type":"LYg::LYY::Action"},"context":{},"principal":{"id":"**","type":"LYg::LYY::a"},"request":"R1","resource":{"id":"**","type":"LYg::LYY::a"}}{"action":{"id":"action","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::Action"},"context":{},"principal":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"},"request":"R2","resource":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"}}{"action":{"id":"action","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::Action"},"context":{},"principal":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"},"request":"R3","resource":{"id":"**","type":"LYg::LYY::a"}}{"action":{"id":"action","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::Action"},"context":{},"principal":{"id":"**","type":"LYg::LYY::a"},"request":"R4","resource":{"id":"","type":"B::A::A::r::r::r::r::r::S3OYlX0xI99Ar0000::r"}}
Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}123#!/bin/shset -eucp /solution/reference.json /tmp/answer.json1234567891011121314151617181920212223242526schema_version = "1.3"artifacts = ["/tmp/answer.json"]
[task]name = "cyber-defense/cedar_authorization-248be0325907b508a77a"
[metadata.cyber_defense]family = "cedar_authorization"sealed_task_sha256 = "20d978fabc2b8c53075bf25fe32df322154d6d42e77ea85e6e3b34cd89c2cc97"
[environment]docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"workdir = "/tmp"cpus = 1memory_mb = 512storage_mb = 2048network_mode = "no-network"
[agent]timeout_sec = 120network_mode = "no-network"
[verifier]timeout_sec = 60environment_mode = "separate"network_mode = "no-network"1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"""Shared JSON grading contract for the environment and rollout controller."""
import hashlibimport jsonimport re
def canonical(value) -> bytes: return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
def payload_sha256(row: dict) -> str: payload = {key: value for key, value in row.items() if key != "task_sha256"} return hashlib.sha256(canonical(payload)).hexdigest()
def _object(pairs): result = {} for key, value in pairs: if key in result: raise ValueError(f"Duplicate JSON member {key!r}") result[key] = value return result
def _bad_number(token): raise ValueError(f"Non-finite number {token!r}")
def parse_answer(text: str) -> dict: if not isinstance(text, str): raise ValueError("An answer must be JSON text") text = text.strip() fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE) if fence: text = fence.group(1) value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number) if not isinstance(value, dict): raise ValueError("An answer must be a JSON object") canonical(value) return value
def reward(expected: dict, submitted: object) -> int: try: return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted)) except (TypeError, ValueError, RecursionError): return 0123#!/bin/shset -euexec /usr/local/bin/python -I -B -S /tests/verify.py1234567891011121314from pathlib import Pathfrom runpy import run_path
contract = run_path('/tests/grading.py')expected = contract['parse_answer'](Path('/tests/expected.json').read_text())answer = Path('/tmp/answer.json')try: submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())except (OSError, ValueError, RecursionError): submitted = Nonevalue = contract['reward'](expected, submitted)log = Path('/logs/verifier')log.mkdir(parents=True, exist_ok=True)(log / 'reward.txt').write_text(str(value) + '\n')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"]}}1FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b12345678910111213141516171819202122232425262728293031Review 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.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.
policy0permit( principal in r::r::r::"NNN", action in [r::r::Action::"action",r::r::Action::"action"], resource is r::r::r) when { true && (r::r::r::"NNN" in r::r::r::"NNN")};
policy1forbid( principal in r::r::n::r::a::"", action in [r::r::n::r::Action::"action",r::r::n::r::Action::"action"], resource in r::r::n::r::a::"") when { true && (if if [[true]].contains([false, true]) then {"": ""} == {"": ""} else {"": ""} == {"": ""} then {"": {"": ""}} == {"": {"": ""}} else {"": {"": ""}} == {"": {"": ""}}) && ({"": {"": {}}} == {"": {"": {}}})};
Entities[{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::n::r::a"}},{"attrs":{},"parents":[],"tags":{"":{}},"uid":{"id":"NNN","type":"r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::n::r::Action"}}]
Requests{"action":{"id":"action","type":"r::r::Action"},"context":{},"principal":{"id":"NNN","type":"r::r::r"},"request":"R1","resource":{"id":"","type":"r::r::r"}}{"action":{"id":"action","type":"r::r::n::r::Action"},"context":{},"principal":{"id":"NNN","type":"r::r::r"},"request":"R2","resource":{"id":"","type":"r::r::n::r::a"}}{"action":{"id":"action","type":"r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r"},"request":"R3","resource":{"id":"","type":"r::r::r"}}{"action":{"id":"action","type":"r::r::n::r::Action"},"context":{},"principal":{"id":"","type":"r::r::n::r::a"},"request":"R4","resource":{"id":"","type":"r::r::n::r::a"}}
Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}123#!/bin/shset -eucp /solution/reference.json /tmp/answer.json1234567891011121314151617181920212223242526schema_version = "1.3"artifacts = ["/tmp/answer.json"]
[task]name = "cyber-defense/cedar_authorization-25a4b9f7565d170d2c85"
[metadata.cyber_defense]family = "cedar_authorization"sealed_task_sha256 = "4c5d9e2af1e09d9ef0987c1df36968857ca604ecb7b6d741aca31d453c7b7f2e"
[environment]docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"workdir = "/tmp"cpus = 1memory_mb = 512storage_mb = 2048network_mode = "no-network"
[agent]timeout_sec = 120network_mode = "no-network"
[verifier]timeout_sec = 60environment_mode = "separate"network_mode = "no-network"1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"""Shared JSON grading contract for the environment and rollout controller."""
import hashlibimport jsonimport re
def canonical(value) -> bytes: return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
def payload_sha256(row: dict) -> str: payload = {key: value for key, value in row.items() if key != "task_sha256"} return hashlib.sha256(canonical(payload)).hexdigest()
def _object(pairs): result = {} for key, value in pairs: if key in result: raise ValueError(f"Duplicate JSON member {key!r}") result[key] = value return result
def _bad_number(token): raise ValueError(f"Non-finite number {token!r}")
def parse_answer(text: str) -> dict: if not isinstance(text, str): raise ValueError("An answer must be JSON text") text = text.strip() fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE) if fence: text = fence.group(1) value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number) if not isinstance(value, dict): raise ValueError("An answer must be a JSON object") canonical(value) return value
def reward(expected: dict, submitted: object) -> int: try: return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted)) except (TypeError, ValueError, RecursionError): return 0123#!/bin/shset -euexec /usr/local/bin/python -I -B -S /tests/verify.py1234567891011121314from pathlib import Pathfrom runpy import run_path
contract = run_path('/tests/grading.py')expected = contract['parse_answer'](Path('/tests/expected.json').read_text())answer = Path('/tmp/answer.json')try: submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())except (OSError, ValueError, RecursionError): submitted = Nonevalue = contract['reward'](expected, submitted)log = Path('/logs/verifier')log.mkdir(parents=True, exist_ok=True)(log / 'reward.txt').write_text(str(value) + '\n')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"]}}1FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b12345678910111213141516171819202122232425262728293031Review 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.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.
policy0permit( principal == r::r::r::r::r::"***((((((((", action, resource) when { true};
policy1forbid( principal in r::r::r::r::wZ1g::"", action == r::r::r::r::Action::"action", resource in r::r::r::r::wZ1g::"") when { true && ((if "||||||||||||~|" like "|*|*|*|*|*|*" then if false then "||||||||||||~|" else "||||||||||||~|" else if false then "||||||||||||~|" else "||||||||||||~|") like "|*|*|*|*|*|*") && ((if "||||||||||||~|" like "*||**|*|*|*|" then "||||||||||||~|" else "||||||||||||~|") like "*|*|*|*|*|*|")};
Entities[{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r::r::g31000000"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r::r::wZ1g"}},{"attrs":{},"parents":[],"uid":{"id":"***((((((((","type":"r::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}},{"attrs":{},"parents":[],"uid":{"id":"|","type":"r::r::r::r::r"}}]
Requests{"action":{"id":"action","type":"r::r::r::r::Action"},"context":{"L5c":false,"LYY":false,"PcY":{"__entity":{"id":"***((((((((","type":"r::r::r::r::r"}}},"principal":{"id":"***((((((((","type":"r::r::r::r::r"},"request":"R1","resource":{"id":"***((((((((","type":"r::r::r::r::r"}}{"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::wZ1g"},"request":"R2","resource":{"id":"***((((((((","type":"r::r::r::r::r"}}{"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::wZ1g"},"request":"R3","resource":{"id":"","type":"r::r::r::r::wZ1g"}}{"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"}}
Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R4"}]}123#!/bin/shset -eucp /solution/reference.json /tmp/answer.json1234567891011121314151617181920212223242526schema_version = "1.3"artifacts = ["/tmp/answer.json"]
[task]name = "cyber-defense/cedar_authorization-25ac3ef22c533e1dd384"
[metadata.cyber_defense]family = "cedar_authorization"sealed_task_sha256 = "f7a935131c8032a9a00b68ad88816c19fd194862fea9e01ecae3d784365b4d65"
[environment]docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"workdir = "/tmp"cpus = 1memory_mb = 512storage_mb = 2048network_mode = "no-network"
[agent]timeout_sec = 120network_mode = "no-network"
[verifier]timeout_sec = 60environment_mode = "separate"network_mode = "no-network"1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":[],"errors":[],"request":"R2"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R3"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R4"}]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"""Shared JSON grading contract for the environment and rollout controller."""
import hashlibimport jsonimport re
def canonical(value) -> bytes: return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
def payload_sha256(row: dict) -> str: payload = {key: value for key, value in row.items() if key != "task_sha256"} return hashlib.sha256(canonical(payload)).hexdigest()
def _object(pairs): result = {} for key, value in pairs: if key in result: raise ValueError(f"Duplicate JSON member {key!r}") result[key] = value return result
def _bad_number(token): raise ValueError(f"Non-finite number {token!r}")
def parse_answer(text: str) -> dict: if not isinstance(text, str): raise ValueError("An answer must be JSON text") text = text.strip() fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE) if fence: text = fence.group(1) value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number) if not isinstance(value, dict): raise ValueError("An answer must be a JSON object") canonical(value) return value
def reward(expected: dict, submitted: object) -> int: try: return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted)) except (TypeError, ValueError, RecursionError): return 0123#!/bin/shset -euexec /usr/local/bin/python -I -B -S /tests/verify.py1234567891011121314from pathlib import Pathfrom runpy import run_path
contract = run_path('/tests/grading.py')expected = contract['parse_answer'](Path('/tests/expected.json').read_text())answer = Path('/tmp/answer.json')try: submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())except (OSError, ValueError, RecursionError): submitted = Nonevalue = contract['reward'](expected, submitted)log = Path('/logs/verifier')log.mkdir(parents=True, exist_ok=True)(log / 'reward.txt').write_text(str(value) + '\n')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"]}}1FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b12345678910111213141516171819202122232425262728293031Review 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.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.
policy0permit( principal is r::r33::r::r::r333333311 in r::r33::r::r::r333333311::"|||||||", action in [r::r33::r::r::Action::"action"], resource == r::r33::r::r::r333333311::"|||||||") when { true};
policy1forbid( principal in r::r::r::r::m::"", action, resource) when { true && (r::r::r::r::r::"" in r::r::r::r::r::"")};
Entities[{"attrs":{},"parents":[{"id":"|","type":"r::r33::r::r::r333333311"},{"id":"|||||~|||||x","type":"r::r33::r::r::slW33zzzzzzzzz"}],"uid":{"id":"","type":"r::r33::r::r::slW33zzzzzzzzz"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r::r::m"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"r::r::r::r::r"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r33::r::r::Action"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"r::r::r::r::Action"}},{"attrs":{},"parents":[{"id":"|||||~|||||x","type":"r::r33::r::r::slW33zzzzzzzzz"}],"uid":{"id":"|","type":"r::r33::r::r::r333333311"}},{"attrs":{},"parents":[{"id":"|","type":"r::r33::r::r::r333333311"},{"id":"|||||~|||||x","type":"r::r33::r::r::slW33zzzzzzzzz"}],"uid":{"id":"|||||||","type":"r::r33::r::r::r333333311"}},{"attrs":{},"parents":[],"uid":{"id":"|||||~|||||x","type":"r::r33::r::r::slW33zzzzzzzzz"}}]
Requests{"action":{"id":"action","type":"r::r33::r::r::Action"},"context":{},"principal":{"id":"|||||||","type":"r::r33::r::r::r333333311"},"request":"R1","resource":{"id":"|||||||","type":"r::r33::r::r::r333333311"}}{"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::m"},"request":"R2","resource":{"id":"|||||||","type":"r::r33::r::r::r333333311"}}{"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"|||||||","type":"r::r33::r::r::r333333311"},"request":"R3","resource":{"id":"|||||||","type":"r::r33::r::r::r333333311"}}{"action":{"id":"action","type":"r::r::r::r::Action"},"context":{},"principal":{"id":"","type":"r::r::r::r::m"},"request":"R4","resource":{"id":"","type":"r::r::r::r::m"}}
Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}123#!/bin/shset -eucp /solution/reference.json /tmp/answer.json1234567891011121314151617181920212223242526schema_version = "1.3"artifacts = ["/tmp/answer.json"]
[task]name = "cyber-defense/cedar_authorization-25acf07b6a632c0438fc"
[metadata.cyber_defense]family = "cedar_authorization"sealed_task_sha256 = "50ed7aacb1ef10172f6191671f47511cbffffd9046c6255d0c9004cd1009be01"
[environment]docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"workdir = "/tmp"cpus = 1memory_mb = 512storage_mb = 2048network_mode = "no-network"
[agent]timeout_sec = 120network_mode = "no-network"
[verifier]timeout_sec = 60environment_mode = "separate"network_mode = "no-network"1{"results":[{"decision":"allow","determining":["policy0"],"errors":[],"request":"R1"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":["policy1"],"errors":[],"request":"R4"}]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"""Shared JSON grading contract for the environment and rollout controller."""
import hashlibimport jsonimport re
def canonical(value) -> bytes: return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
def payload_sha256(row: dict) -> str: payload = {key: value for key, value in row.items() if key != "task_sha256"} return hashlib.sha256(canonical(payload)).hexdigest()
def _object(pairs): result = {} for key, value in pairs: if key in result: raise ValueError(f"Duplicate JSON member {key!r}") result[key] = value return result
def _bad_number(token): raise ValueError(f"Non-finite number {token!r}")
def parse_answer(text: str) -> dict: if not isinstance(text, str): raise ValueError("An answer must be JSON text") text = text.strip() fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE) if fence: text = fence.group(1) value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number) if not isinstance(value, dict): raise ValueError("An answer must be a JSON object") canonical(value) return value
def reward(expected: dict, submitted: object) -> int: try: return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted)) except (TypeError, ValueError, RecursionError): return 0123#!/bin/shset -euexec /usr/local/bin/python -I -B -S /tests/verify.py1234567891011121314from pathlib import Pathfrom runpy import run_path
contract = run_path('/tests/grading.py')expected = contract['parse_answer'](Path('/tests/expected.json').read_text())answer = Path('/tmp/answer.json')try: submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())except (OSError, ValueError, RecursionError): submitted = Nonevalue = contract['reward'](expected, submitted)log = Path('/logs/verifier')log.mkdir(parents=True, exist_ok=True)(log / 'reward.txt').write_text(str(value) + '\n')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"]}}1FROM docker.io/library/python@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b12345678910111213141516171819202122232425262728293031Review 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.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.
policy0permit( principal, action in [Action::"",Action::""], resource is a) when { true && (!(!(!false))) && (!(!(!false)))};
policy1forbid( principal in g::a::"", action in [g::Action::"action"], resource in g::a::"") when { true && (((false == false) == (false == false)) || ((false == false) == (false == false))) && (((false == false) == (false == false)) == ((false == false) == (false == false)))};
Entities[{"attrs":{},"parents":[],"uid":{"id":"","type":"Action"}},{"attrs":{},"parents":[],"uid":{"id":"","type":"a"}},{"attrs":{"g1c":{"__extn":{"arg":"2097865012305276206ms","fn":"duration"}},"tg9":false},"parents":[],"uid":{"id":"","type":"g::a"}},{"attrs":{},"parents":[],"uid":{"id":"action","type":"g::Action"}}]
Requests{"action":{"id":"action","type":"g::Action"},"context":{},"principal":{"id":"","type":"g::a"},"request":"R1","resource":{"id":"","type":"g::a"}}{"action":{"id":"","type":"Action"},"context":{},"principal":{"id":"","type":"a"},"request":"R2","resource":{"id":"","type":"a"}}{"action":{"id":"action","type":"g::Action"},"context":{},"principal":{"id":"","type":"a"},"request":"R3","resource":{"id":"","type":"a"}}{"action":{"id":"","type":"Action"},"context":{},"principal":{"id":"","type":"g::a"},"request":"R4","resource":{"id":"","type":"g::a"}}
Save your final JSON response to /tmp/answer.json. Harbor grades the contents of this file.1{"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}123#!/bin/shset -eucp /solution/reference.json /tmp/answer.json1234567891011121314151617181920212223242526schema_version = "1.3"artifacts = ["/tmp/answer.json"]
[task]name = "cyber-defense/cedar_authorization-26667d947850e4de7fd5"
[metadata.cyber_defense]family = "cedar_authorization"sealed_task_sha256 = "6683dbffc4fdb596d3338bd3c65b4f906732d488b2f07e47595063531598b94a"
[environment]docker_image = "public.ecr.aws/docker/library/python@sha256:05a994d2344eb364cc186910f4fc8786a38215f39f00d0acc25bff33a08f4177"workdir = "/tmp"cpus = 1memory_mb = 512storage_mb = 2048network_mode = "no-network"
[agent]timeout_sec = 120network_mode = "no-network"
[verifier]timeout_sec = 60environment_mode = "separate"network_mode = "no-network"1{"results":[{"decision":"deny","determining":["policy1"],"errors":[],"request":"R1"},{"decision":"allow","determining":["policy0"],"errors":[],"request":"R2"},{"decision":"deny","determining":[],"errors":[],"request":"R3"},{"decision":"deny","determining":[],"errors":[],"request":"R4"}]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849"""Shared JSON grading contract for the environment and rollout controller."""
import hashlibimport jsonimport re
def canonical(value) -> bytes: return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
def payload_sha256(row: dict) -> str: payload = {key: value for key, value in row.items() if key != "task_sha256"} return hashlib.sha256(canonical(payload)).hexdigest()
def _object(pairs): result = {} for key, value in pairs: if key in result: raise ValueError(f"Duplicate JSON member {key!r}") result[key] = value return result
def _bad_number(token): raise ValueError(f"Non-finite number {token!r}")
def parse_answer(text: str) -> dict: if not isinstance(text, str): raise ValueError("An answer must be JSON text") text = text.strip() fence = re.fullmatch(r"```(?:json)?\s*\n(.*?)\n```", text, flags=re.DOTALL | re.IGNORECASE) if fence: text = fence.group(1) value = json.loads(text, object_pairs_hook=_object, parse_constant=_bad_number) if not isinstance(value, dict): raise ValueError("An answer must be a JSON object") canonical(value) return value
def reward(expected: dict, submitted: object) -> int: try: return int(isinstance(submitted, dict) and canonical(expected) == canonical(submitted)) except (TypeError, ValueError, RecursionError): return 0123#!/bin/shset -euexec /usr/local/bin/python -I -B -S /tests/verify.py1234567891011121314from pathlib import Pathfrom runpy import run_path
contract = run_path('/tests/grading.py')expected = contract['parse_answer'](Path('/tests/expected.json').read_text())answer = Path('/tmp/answer.json')try: submitted = None if answer.is_symlink() else contract['parse_answer'](answer.read_text())except (OSError, ValueError, RecursionError): submitted = Nonevalue = contract['reward'](expected, submitted)log = Path('/logs/verifier')log.mkdir(parents=True, exist_ok=True)(log / 'reward.txt').write_text(str(value) + '\n')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-248be0325907b508a77a/environment/DockerfileAdded+1
tasks/cedar_authorization-248be0325907b508a77a/instruction.mdAdded+31
tasks/cedar_authorization-248be0325907b508a77a/solution/reference.jsonAdded+1
tasks/cedar_authorization-248be0325907b508a77a/solution/solve.shAdded+3
tasks/cedar_authorization-248be0325907b508a77a/task.tomlAdded+26
tasks/cedar_authorization-248be0325907b508a77a/tests/expected.jsonAdded+1
tasks/cedar_authorization-248be0325907b508a77a/tests/grading.pyAdded+49
tasks/cedar_authorization-248be0325907b508a77a/tests/test.shAdded+3
tasks/cedar_authorization-248be0325907b508a77a/tests/verify.pyAdded+14
tasks/cedar_authorization-248be0325907b508a77a/validation/openenv.jsonAdded+1
tasks/cedar_authorization-25a4b9f7565d170d2c85/environment/DockerfileAdded+1
tasks/cedar_authorization-25a4b9f7565d170d2c85/instruction.mdAdded+31
tasks/cedar_authorization-25a4b9f7565d170d2c85/solution/reference.jsonAdded+1
tasks/cedar_authorization-25a4b9f7565d170d2c85/solution/solve.shAdded+3
tasks/cedar_authorization-25a4b9f7565d170d2c85/task.tomlAdded+26
tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/expected.jsonAdded+1
tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/grading.pyAdded+49
tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/test.shAdded+3
tasks/cedar_authorization-25a4b9f7565d170d2c85/tests/verify.pyAdded+14
tasks/cedar_authorization-25a4b9f7565d170d2c85/validation/openenv.jsonAdded+1
tasks/cedar_authorization-25ac3ef22c533e1dd384/environment/DockerfileAdded+1
tasks/cedar_authorization-25ac3ef22c533e1dd384/instruction.mdAdded+31
tasks/cedar_authorization-25ac3ef22c533e1dd384/solution/reference.jsonAdded+1
tasks/cedar_authorization-25ac3ef22c533e1dd384/solution/solve.shAdded+3
tasks/cedar_authorization-25ac3ef22c533e1dd384/task.tomlAdded+26
tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/expected.jsonAdded+1
tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/grading.pyAdded+49
tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/test.shAdded+3
tasks/cedar_authorization-25ac3ef22c533e1dd384/tests/verify.pyAdded+14
tasks/cedar_authorization-25ac3ef22c533e1dd384/validation/openenv.jsonAdded+1
tasks/cedar_authorization-25acf07b6a632c0438fc/environment/DockerfileAdded+1
tasks/cedar_authorization-25acf07b6a632c0438fc/instruction.mdAdded+31
tasks/cedar_authorization-25acf07b6a632c0438fc/solution/reference.jsonAdded+1
tasks/cedar_authorization-25acf07b6a632c0438fc/solution/solve.shAdded+3
tasks/cedar_authorization-25acf07b6a632c0438fc/task.tomlAdded+26
tasks/cedar_authorization-25acf07b6a632c0438fc/tests/expected.jsonAdded+1
tasks/cedar_authorization-25acf07b6a632c0438fc/tests/grading.pyAdded+49
tasks/cedar_authorization-25acf07b6a632c0438fc/tests/test.shAdded+3
tasks/cedar_authorization-25acf07b6a632c0438fc/tests/verify.pyAdded+14
tasks/cedar_authorization-25acf07b6a632c0438fc/validation/openenv.jsonAdded+1
tasks/cedar_authorization-26667d947850e4de7fd5/environment/DockerfileAdded+1
tasks/cedar_authorization-26667d947850e4de7fd5/instruction.mdAdded+31
tasks/cedar_authorization-26667d947850e4de7fd5/solution/reference.jsonAdded+1
tasks/cedar_authorization-26667d947850e4de7fd5/solution/solve.shAdded+3
tasks/cedar_authorization-26667d947850e4de7fd5/task.tomlAdded+26
tasks/cedar_authorization-26667d947850e4de7fd5/tests/expected.jsonAdded+1
tasks/cedar_authorization-26667d947850e4de7fd5/tests/grading.pyAdded+49
tasks/cedar_authorization-26667d947850e4de7fd5/tests/test.shAdded+3
tasks/cedar_authorization-26667d947850e4de7fd5/tests/verify.pyAdded+14
tasks/cedar_authorization-26667d947850e4de7fd5/validation/openenv.jsonAdded+1