Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5897299
feat(opa): classify structured tool policy and human review
nathankw Nov 17, 2026
396dc8b
docs(opa): distinguish structured and legacy shell input fields
nathankw Nov 17, 2026
9f979f7
docs(opa): illustrate local and executor inputs with YAML
nathankw Nov 17, 2026
be9e0cc
docs(opa): show executor settings in Relay plugins.toml
nathankw Nov 17, 2026
3ceed11
docs(opa): explain operation binding and sibling review arguments
nathankw Nov 17, 2026
2810762
docs(opa): simplify execution and input comparison tables
nathankw Nov 17, 2026
7b81a63
feat(opa): configure denials without executable allowlists
nathankw Nov 17, 2026
110decf
docs(config): expose optional shell command deny list
nathankw Nov 17, 2026
83b19ca
refactor(opa): clarify parse completeness and agent feedback
nathankw Nov 17, 2026
112f1d2
refactor(opa): use one authorization status for human review
nathankw Nov 17, 2026
4a95ab8
docs(opa): link command rules and explain wrapper review
nathankw Nov 18, 2026
22cbbb0
fix(opa): reserve human review for explicit policy rules
nathankw Nov 18, 2026
7d66fb0
Merge develop into feat/opa-tool-policy-outcomes
nathankw Nov 18, 2026
e5b3ec8
fix(opa): serialize policy audit records with submissions
nathankw Nov 18, 2026
247beb2
fix(opa): avoid repeated scans of shell option boundaries
nathankw Nov 19, 2026
418341d
feat(opa): expose configured workspace context for structured tools (…
nathankw Nov 19, 2026
d1c4207
Merge develop into feat/opa-tool-policy-outcomes
nathankw Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jobs:
- name: Prepare container
run: |
apt-get update
apt-get install -y --no-install-recommends git nodejs
apt-get install -y --no-install-recommends git nodejs curl
rm -rf /var/lib/apt/lists/*

- name: Checkout
Expand All @@ -202,6 +202,16 @@ jobs:
python -m pip install --upgrade "pip @ https://files.pythonhosted.org/packages/62/36/a3aed958d60531cb442b7ab4596cda7b3621cfb916f8ae1d6769795c7dc1/pip-26.2-py3-none-any.whl#sha256=931c303696af6fa3417112103b1cad26890e5a07eccb5b99783700e33f2b8aad"
uv sync --frozen --extra all

- name: Install pinned OPA for structured policy integration tests
run: |
curl --fail --location --silent --show-error \
https://github.com/open-policy-agent/opa/releases/download/v1.17.0/opa_linux_amd64_static \
--output "$RUNNER_TEMP/opa"
printf '%s %s\n' e83da46804832578e9d9e1733dffbe4d3b5f8cc9c26eb124da9ceea4abfe189f "$RUNNER_TEMP/opa" | sha256sum --check
chmod +x "$RUNNER_TEMP/opa"
printf 'NOMOS_TEST_OPA_BINARY=%s\n' "$RUNNER_TEMP/opa" >> "$GITHUB_ENV"
"$RUNNER_TEMP/opa" test policies

- name: Run local tests with coverage
run: |
mkdir -p reports/junit
Expand Down
8 changes: 8 additions & 0 deletions configs/council.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ opa:
url: "${COUNCIL_OPA_URL:-http://opa:8181}"
decision_path: "${COUNCIL_OPA_DECISION_PATH:-/v1/data/nomos/intent/decision}"
policy_id: "${COUNCIL_OPA_POLICY_ID:-strict-shell}"
# Additional executable basenames forbidden by the local-bash profile.
# Populate with your deployment's reviewed list; exact names, not paths/globs.
# Requires policy_id: local-bash and an explicit shell_tool_arguments binding.
# Empty adds no prohibitions beyond the bundled policy rules.
denied_shell_commands: []
# Optional exact tool -> top-level argument key for a host-declared root.
# Exposes intent.workspace to OPA; does not establish trust or containment.
workspace_arguments: {}
timeout_ms: "${COUNCIL_OPA_TIMEOUT_MS:-500}"
fail_closed: "${COUNCIL_OPA_FAIL_CLOSED:-true}"

Expand Down
8 changes: 8 additions & 0 deletions deploy/kubernetes/nomos/files/council/council.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ opa:
url: "${COUNCIL_OPA_URL:-http://opa:8181}"
decision_path: "${COUNCIL_OPA_DECISION_PATH:-/v1/data/nomos/intent/decision}"
policy_id: "${COUNCIL_OPA_POLICY_ID:-strict-shell}"
# Additional executable basenames forbidden by the local-bash profile.
# Populate with your deployment's reviewed list; exact names, not paths/globs.
# Requires policy_id: local-bash and an explicit shell_tool_arguments binding.
# Empty adds no prohibitions beyond the bundled policy rules.
denied_shell_commands: []
# Optional exact tool -> top-level argument key for a host-declared root.
# Exposes intent.workspace to OPA; does not establish trust or containment.
workspace_arguments: {}
timeout_ms: "${COUNCIL_OPA_TIMEOUT_MS:-500}"
fail_closed: "${COUNCIL_OPA_FAIL_CLOSED:-true}"

Expand Down
117 changes: 115 additions & 2 deletions deploy/kubernetes/nomos/files/policies/intent_filter.rego
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import rego.v1

default allow := false

allow if count(deny) == 0
allow if {
count(deny) == 0
count(human_review) == 0
}

decision := {
"allow": allow,
"decision": policy_outcome,
"reasons": reasons,
"guidance": guidance,
"metadata": {
Expand All @@ -20,7 +24,7 @@ decision := {
},
}

reasons := [reason | deny[reason]]
reasons := array.concat([reason | deny[reason]], [reason | human_review[reason]])

guidance := [item | remediation[item]]

Expand Down Expand Up @@ -49,6 +53,7 @@ valid_policy_ids := {
"strict-shell",
"git-workflow-local",
"read-only-relaxed",
"local-bash",
}

default_git_workflow_words := {
Expand Down Expand Up @@ -236,3 +241,111 @@ remediation contains "Use a public interface for keys/secrets or narrow the targ
some ref in object.get(input.intent, "normalized_path_refs", [])
sensitive_path_match(ref, path)
}

# Hard denial wins over any request for human review. Human approval does not
# override a forbidden operation; policy inspection on replay evaluates again.
policy_outcome := "deny" if count(deny) > 0

else := "requires_human_approval" if count(human_review) > 0

else := "allow"

local_shell_analysis := input.intent.shell_analysis if policy_id == "local-bash"

# Deployment-owned prohibitions are evaluated before automated or human review.
# Matching uses the parsed basename even when the executable has a custom path.
deny contains sprintf("Command %q is forbidden by the configured shell policy.", [command.name]) if {
some command in local_shell_analysis.commands
command.name in object.get(input.council, "opa_denied_shell_commands", [])
}

deny contains "Recursive forced deletion is forbidden." if {
some command in local_shell_analysis.commands
command.name == "rm"
rm_recursive(command.argv)
rm_force(command.argv)
}

rm_recursive(argv) if {
some arg in option_arguments(argv)
arg == "--recursive"
}

rm_recursive(argv) if {
some arg in option_arguments(argv)
regex.match(`^-[^-]*[rR]`, arg)
}

rm_force(argv) if {
"--force" in option_arguments(argv)
}

rm_force(argv) if {
some arg in option_arguments(argv)
regex.match(`^-[^-]*f`, arg)
}

deny contains "Privilege escalation with sudo is forbidden." if {
some command in local_shell_analysis.commands
command.name == "sudo"
}

deny contains "Login-shell user switching is forbidden." if {
some command in local_shell_analysis.commands
command.name == "su"
some arg in command.argv
login_su_option(arg)
}

deny contains "World-writable executable permissions are forbidden." if {
some command in local_shell_analysis.commands
command.name == "chmod"
mode := [arg | some i, arg in command.argv; not startswith(arg, "-"); not earlier_positional(command.argv, i)]
count(mode) > 0
mode[0] in {"777", "0777"}
}

# Agent-facing guidance follows the final policy verdict, not parser success.
# A known prohibition must never invite resubmission or a human override.
remediation contains "This operation is forbidden. Do not retry it or seek human approval to override this denial." if {
policy_id == "local-bash"
policy_outcome == "deny"
}

remediation contains "This operation requires human approval. Do not execute before approval." if {
policy_outcome == "requires_human_approval"
}

human_review contains "Deletion requires human approval." if {
some command in local_shell_analysis.commands
command.name == "rm"
}

human_review contains "User switching requires human approval." if {
some command in local_shell_analysis.commands
command.name == "su"
}

# Option parsing stops at --. Preserve option order and do not interpret a
# filename such as -rf after that delimiter as a destructive option.
option_arguments(argv) := [arg |
some i, arg in argv
arg != "--"
not option_terminated(argv, i)
]

option_terminated(argv, i) if {
some j, value in argv
j < i
value == "--"
}

earlier_positional(argv, i) if {
some j, value in argv
j < i
not startswith(value, "-")
}

login_su_option(arg) if arg in {"-", "--login"}

login_su_option(arg) if regex.match(`^-[^-]*l`, arg)
Loading
Loading