Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .github/workflows/warden.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Warden

permissions:
contents: write
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow grants unnecessary contents: write permission

Medium Severity

The workflow declares contents: write at the top level, but a PR review workflow only needs to read repository contents and post review comments. Granting contents: write allows the workflow (and any actions it invokes, including the third-party getsentry/warden action) to push commits, create/delete branches, and modify repository contents. Narrowing this to contents: read follows the principle of least privilege and limits blast radius if any action is compromised.

Fix in Cursor Fix in Web

pull-requests: write

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
review:
runs-on: ubuntu-latest
env:
WARDEN_MODEL: ${{ secrets.WARDEN_MODEL }}
WARDEN_SENTRY_DSN: ${{ secrets.WARDEN_SENTRY_DSN }}
steps:
- uses: actions/checkout@v4

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.WARDEN_APP_ID }}
private-key: ${{ secrets.WARDEN_PRIVATE_KEY }}

- uses: getsentry/warden@v0
with:
anthropic-api-key: ${{ secrets.WARDEN_ANTHROPIC_API_KEY }}
github-token: ${{ steps.app-token.outputs.token }}
35 changes: 29 additions & 6 deletions warden.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
version = 1

[defaults.output]
[defaults]
failOn = "high"
commentOn = "medium"
reportOn = "medium"
ignorePaths = ["dist/**"]

[[triggers]]
name = "find-bugs"
event = "pull_request"
[[skills]]
name = "notseer"
paths = ["src/**/*.ts"]
ignorePaths = ["src/**/*.test.ts"]

[[skills.triggers]]
type = "pull_request"
actions = ["opened", "synchronize", "reopened"]
skill = "find-bugs"

[[skills]]
name = "security-review"
remote = "getsentry/sentry-skills"
paths = ["src/**/*.ts"]
ignorePaths = ["src/**/*.test.ts"]

[[skills.triggers]]
type = "pull_request"
actions = ["opened", "synchronize", "reopened"]

# TODO: enable once getsentry/warden#144 lands
# [[skills]]
# name = "warden-lint-judge"
# remote = "getsentry/skills"
# scope = "report"
#
# [[skills.triggers]]
# type = "pull_request"
# actions = ["opened", "synchronize", "reopened"]