Skip to content
Back to search

dogwood

MarketplaceWorks with Claude CodeGitHub

Reference parser and interpreter for the Dogwood policy language

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/dogwood-policy/dogwood with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/dogwood-policy/dogwood'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/dogwood-policy--dogwood/badge.svg)](/listings/dogwood-policy--dogwood)

HTML

<a href="/listings/dogwood-policy--dogwood"><img src="/api/listings/dogwood-policy--dogwood/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Pretty-print a policy:
dogwood format policy.dw

# Validate a policy against its schemas:
dogwood validate policy.dw --policy-schema schema.cedarschema

# Lower to Cedar and see the output:
dogwood lower policy.dw --policy-schema schema.cedarschema --emit both

# Replay a trace and see verdicts:
dogwood replay policy.dw --policy-schema schema.cedarschema --trace events.log

Worked example

The [`read_after_login`](dogwood-docs/examples/read_after_login/) example permits a Read only if the same user logged in within the last hour:

// policy.dw
@id("read_after_login")
permit (
    principal,
    action == Drupe::Action::"Read",
    resource
)
when temporal {
    formerly within 1h Drupe::Action::"Login"::request{ input.user: context.input.user }
};

Replay it against a trace of three events (login at t=0, read at t=10s, read at t=2h):

$ dogwood replay dogwood-docs/examples/read_after_login/policy.dw \
    --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema \
    --trace dogwood-docs/examples/read_after_login/trace.log

@0 (time point 0): DENY
@10 (time point 1): ALLOW  [rules: 0]
@7200 (time point 2): DENY

The first event is the login itself (no read requested) → DENY. Ten seconds later Alice reads → ALLOW (she logged in recently). Two hours later she tries again → DENY (the login has expired from the 1-hour window).

You can also validate and lower to Cedar:

$ dogwood validate dogwood-docs/examples/read_after_login/policy.dw \
    --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema
OK: validation passed with no errors or warnings.

$ dogwood lower dogwood-docs/examples/read_after_login/policy.dw \
    --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema \
    --emit cedar-policies
@id("read_after_login")
permit(principal, action == Drupe::Action::"Read", resource) when { context.policy_0__temporal_0 };

The lowered Cedar replaces the temporal condition with a `context.*` slot that Dogwood fills at runtime from the event history.

See the [Getting Started guide](dogwood-docs/guide/01-getting-started.md) for full setup instructions and more examples in [`dogwood-docs/examples/`](dogwood-docs/examples/).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 13 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "dogwood",
  3. "owner": {
  4. "name": "Dogwood"
  5. },
  6. "plugins": [
  7. {
  8. "name": "dogwood",
  9. "source": "./",
  10. "description": "Dogwood policy authoring tools: the autoformalize-policies skill (natural language → validated .dw policy, CLI-checked)."
  11. }
  12. ]
  13. }
README.md · README · 230 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Dogwood
  2. Dogwood is a governance language designed for AI agents and their tools. It
  3. supports [Cedar](https://www.cedarpolicy.com/) policies and adds temporal
  4. conditions (`since`, `formerly`, `once`, aggregations) to look back over an
  5. agent's recent events.
  6. ```text
  7. permit(principal, action, resource)
  8. when { context.input.amount < 1000 }
  9. when formerly within 1h {
  10. Action::"Approve"::request{ approver: context.input.approver }
  11. };
  12. ```
  13. This repository contains a **reference interpreter** for the language for the
  14. purpose of understanding the semantics of the language, with simple examples of
  15. the kinds of policies Dogwood supports. This reference interpreter is **NOT**
  16. intended for production use. Please see the end of this document for a list
  17. of important limitations of the interpreter.
  18. 📖 **[Read the full documentation →](https://dogwood-policy.github.io/dogwood/index.html)**
  19. ## Key features
  20. - **Cedar-derived syntax** — familiar `permit`/`forbid` with `when`/`unless`
  21. - **Temporal conditions** — express "since login," "formerly approved," rate
  22. limits, and windowed aggregations over an event history
  23. - **Information providers** — computed facts (Rhai scripts) injected at
  24. evaluation time as guardrail context fields
  25. - **Compile-to-Cedar** — policies lower to standard Cedar; the temporal and
  26. provider fields become `context.*` slots filled at runtime
  27. - **Pluggable backends** — swap the policy engine (local Cedar or a remote
  28. policy store) and the temporal engine (in-memory or database-backed)
  29. independently
  30. ## Repository layout
  31. | Path | Description |
  32. |------|-------------|
  33. | [`dogwood-syntax/`](dogwood-syntax/README.md) | Shared policy grammar and lossless concrete syntax |
  34. | [`dogwood-language/`](dogwood-language/README.md) | The core Rust library — parser, interpreter, lowering, and API |
  35. | [`dogwood-formatter/`](dogwood-formatter/README.md) | Source-preserving pretty-printer for Dogwood policies |
  36. | [`dogwood-docs/guide/`](dogwood-docs/guide/README.md) | The language guide (syntax, schemas, temporal expressions, providers, formal spec) |
  37. | [`dogwood-cli/`](dogwood-docs/guide/12-cli.md) | The `dogwood` CLI (validate, lower, replay, explain) |
  38. | [`dogwood-docs/examples/`](dogwood-docs/examples/) | Runnable example policies with traces and expected output |
  39. | [`dogwood-language/configuration/`](dogwood-language/configuration/README.md) | Starter action schemas and event schemas |
  40. ## Quick start
  41. ```bash
  42. # Pretty-print a policy:
  43. dogwood format policy.dw
  44. # Validate a policy against its schemas:
  45. dogwood validate policy.dw --policy-schema schema.cedarschema
  46. # Lower to Cedar and see the output:
  47. dogwood lower policy.dw --policy-schema schema.cedarschema --emit both
  48. # Replay a trace and see verdicts:
  49. dogwood replay policy.dw --policy-schema schema.cedarschema --trace events.log
  50. ```
  51. ### Worked example
  52. The [`read_after_login`](dogwood-docs/examples/read_after_login/) example
  53. permits a Read only if the same user logged in within the last hour:
  54. ```text
  55. // policy.dw
  56. @id("read_after_login")
  57. permit (
  58. principal,
  59. action == Drupe::Action::"Read",
  60. resource
  61. )
  62. when temporal {
  63. formerly within 1h Drupe::Action::"Login"::request{ input.user: context.input.user }
  64. };
  65. ```
  66. Replay it against a trace of three events (login at t=0, read at t=10s, read at
  67. t=2h):
  68. ```bash
  69. $ dogwood replay dogwood-docs/examples/read_after_login/policy.dw \
  70. --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema \
  71. --trace dogwood-docs/examples/read_after_login/trace.log
  72. @0 (time point 0): DENY
  73. @10 (time point 1): ALLOW [rules: 0]
  74. @7200 (time point 2): DENY
  75. ```
  76. The first event is the login itself (no read requested) → DENY. Ten seconds
  77. later Alice reads → ALLOW (she logged in recently). Two hours later she tries
  78. again → DENY (the login has expired from the 1-hour window).
  79. You can also validate and lower to Cedar:
  80. ```bash
  81. $ dogwood validate dogwood-docs/examples/read_after_login/policy.dw \
  82. --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema
  83. OK: validation passed with no errors or warnings.
  84. $ dogwood lower dogwood-docs/examples/read_after_login/policy.dw \
  85. --policy-schema dogwood-docs/examples/read_after_login/schema.cedarschema \
  86. --emit cedar-policies
  87. @id("read_after_login")
  88. permit(principal, action == Drupe::Action::"Read", resource) when { context.policy_0__temporal_0 };
  89. ```
  90. The lowered Cedar replaces the temporal condition with a `context.*` slot that
  91. Dogwood fills at runtime from the event history.
  92. See the [Getting Started guide](dogwood-docs/guide/01-getting-started.md) for
  93. full setup instructions and more examples in
  94. [`dogwood-docs/examples/`](dogwood-docs/examples/).
  95. ## Using Dogwood as a Rust library
  96. Add the crate to your `Cargo.toml`:
  97. ```toml
  98. [dependencies]
  99. dogwood-language = { git = "https://github.com/dogwood-policy/dogwood.git" }
  100. ```
  101. See the [library README](dogwood-language/README.md) for the API overview and
  102. the [API and Workflow guide](dogwood-docs/guide/07-api-and-workflow.md) for
  103. detailed usage.
  104. ## AI agent integration
  105. This repo ships agent skills that let AI coding assistants author Dogwood
  106. policies from natural-language requirements. See
  107. [AGENTS-README.md](AGENTS-README.md) for setup across Claude Code, Codex CLI,
  108. Cursor, Copilot, and others.
  109. ## Security considerations when using the reference interpreter
  110. As mentioned above, the reference interpreter provided here is **NOT** intended
  111. to be used directly as an authorization engine for enforcing Dogwood policies.
  112. The purpose is to provide a way to test and evaluate the semantics of Dogwood
  113. policies.
  114. A production-ready authorization engine needs to deal with several concerns
  115. not addressed by the reference interpreter, including but not limited to:
  116. - **Event timestamp integrity.** The interpreter preserves supplied timestamps
  117. and does not validate them. Test authors must deliberately choose the
  118. observation sequence and supply strictly increasing timestamps. Accepting an
  119. input does not establish that it satisfies the supported timestamp contract.
  120. Production systems should enforce that contract and use a trusted time source.
  121. - **Event authentication.** The reference interpreter does not provide any kind
  122. of authentication on events. A production implementation should bind the
  123. authenticated caller identity as the principal before submitting events to an
  124. engine.
  125. - **Event field consistency.** Fields needed by both temporal predicates
  126. AND Cedar conditions must be supplied to both the `logged` bag
  127. (`.field()`) and the `request_context` bag (`.request_context()`).
  128. Supplying only one silently weakens either temporal or Cedar checks.
  129. - **Action naming consistency.** Events must use the same qualified action
  130. format as the policies (e.g., `"{ServiceName}::Action::Transfer"` not just
  131. `"Transfer"`). A mismatch causes temporal predicates to silently not
  132. match while Cedar may still authorize the action.
  133. - **Trace management.** The built-in `InMemoryTemporalEngine` has no eviction or
  134. size cap. Production deployments handling sustained event volume should
  135. consider strategies for bounding and managing store size. Additionally, because
  136. the reference interpreter is purely in memory, its trace is lost after
  137. crash/restart. A production deployment ought to manage traces in a durable or
  138. fault-tolerant way. Keep in mind that depending on the nature of your policies,
  139. requests/events may contain sensitive data, so some method of protecting and
  140. purging that data ought to be used.
  141. - **The `net` feature.** When enabled, provider scripts can make outbound
  142. HTTP requests via `http_get`. This function performs NO host or IP
  143. validation — it will connect to any address the URL specifies, including
  144. internal/private endpoints (169.254.169.254, 127.0.0.1, RFC-1918).
  145. Never construct the URL authority from untrusted event fields. See the
  146. provider guide for the safe pattern.
  147. - **Policy validation.** Always run `Validator::validate()` on lowered policies
  148. before authorizing. Skipping validation may allow policies with degenerate
  149. windows, unresolved references, type mismatches etc. that behave unexpectedly
  150. at runtime.
  151. - **Audit logging.** Dogwood returns decisions but does not log them. A
  152. production implementation should use some form of logging around
  153. `is_authorized()` for compliance and forensics.
  154. - **Multi-tenancy.** By default, an authorizer instance monitors one event
  155. history, with no isolation or partitioning between principals. The `pin`
  156. feature in the interpreter implements a rewriting pass that causes policies to
  157. be interpreted *as if* they were partitioned along the pinned key fields.
  158. However, this does not mean that an evaluation engine necessarily stores the
  159. event history in a partitioned way. A production deployment must consider and
  160. implement the appropriate level of isolation for their needs, and separate
  161. authorizer instances and event storage mechanisms may be warranted.
  162. - **Rhai script sandboxing.** Provider scripts run in Rhai's embedded
  163. interpreter with no CPU/memory limits configured by default. A malicious or
  164. buggy provider script could infinite-loop or allocate unbounded memory,
  165. starving the authorizer. Production deployments should configure Rhai's
  166. `max_operations` / `max_call_levels` limits or run providers with a timeout.
  167. - **Error message information leakage.** Error messages from the
  168. compiler/validator include policy content, field names, and type details. In a
  169. multi-tenant deployment where policies are authored by different parties,
  170. returning raw error details to one tenant could reveal another tenant's policy
  171. structure if policies are co-loaded. Production systems should sanitize or gate
  172. error output appropriately.
  173. ## Contributing
  174. See [CONTRIBUTING.md](CONTRIBUTING.md).
  175. ## Security
  176. See [SECURITY.md](SECURITY.md).
  177. ## License
  178. This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.