Skip to content

Evaluate upstream openshell policy lint (OpenShell #5358) versus annotate's lint #109

Open

Description

@ilanh

Upstream added openshell policy lint <file> (ai-openshell/openshell#5358, merged Nov 17 UTC). It validates an authored policy offline, without a gateway, reporting all file-only semantic violations together. It is not in v0.1.9; it first ships in v0.1.10-pre.3.

annotate already validates offline: openshell-policy-schema parsing plus openshell_policy::validate_and_canonicalize_sandbox_policy (validate::gateway_violations), and its own lint adds source-level checks (unannotated calls, directive locations, v0.1.8/v0.1.9 pitfalls).

To decide (evaluation only, no implementation yet):

  • Does policy lint catch anything gateway_violations misses (ambiguity diagnostics, built-in middleware config, encoded-size limit)? Compare on examples/ and the goldens once openshell-next builds against a tag that has it.
  • Should annotate call the upstream crate function behind policy lint (if public) instead of, or in addition to, gateway_violations?
  • Should flow.sh / docs recommend running openshell policy lint on generated policies, or stay complementary and say so in the README?
  • Overlap and wording of messages, so users don't see the same problem twice.

Activity

  1. ilanh commented on Nov 30, 2026

    @ilanh
    OwnerAuthor

    Evaluated against OpenShell v0.1.10 (the first stable tag with openshell policy lint, upstream crates/openshell-cli/src/run.rs::sandbox_policy_lint). The command runs:

    1. parse_sandbox_policy_file (schema, plus the new rejection of endpoint_settings in YAML files);
    2. the encoded size limit (MAX_AUTHORED_POLICY_SIZE, 256 KiB);
    3. find_endpoint_ambiguities: endpoints that can match the same request but disagree on connection or parsing metadata (protocol, TLS, enforcement and so on);
    4. config validation for built-in openshell/* middlewares (openshell-supervisor-middleware-builtins);
    5. validate_and_canonicalize_authored_policy: the gateway validator, reserved _provider_ keys and credential-binding structure.

    What annotate's gateway_violations missed before: steps 2, 3, 4 and part of 5. Step 3 was a real gap. Two directives on one host:port with different protocol= (split with rule=) produced a policy that annotate accepted but the gateway and policy lint reject ("conflicting metadata: protocol"). This matters more since #5274: only the selected route's protocol can authorize a request.

    #115 makes gateway_violations call steps 1, 3 and 5, which are public in openshell-policy. 5 already covers the size limit (2). Step 4 is left out because it needs the supervisor middleware crate, and annotate generates no middlewares. Messages are OpenShell's own text. annotate's duplicate _provider_ check was removed, so nothing is reported twice. README now suggests running openshell policy lint on generated policies when the CLI is installed.

    Open question: whether annotate should also run openshell policy lint itself in scripts/flow.sh, or whether that stays a docs recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions