Skip to content

feat(resource-policies): add statement evaluator - #6892

Open
TheodoreSpeaks wants to merge 19 commits into
feat/workspace-principalfrom
feat/credential-group-resource-policies
Open

feat(resource-policies): add statement evaluator#6892
TheodoreSpeaks wants to merge 19 commits into
feat/workspace-principalfrom
feat/credential-group-resource-policies

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace credential group grants with statement-based resource policies supporting explicit allow/deny and bounded IAM-style conditions
  • bind persisted execution principals and current workflow authority into credential-use decisions, while keeping actor-owned credential access as a hidden system rule
  • add a raw JSON policy editor plus trigger-owned policy lifecycle and a bounded backfill

Type of Change

  • New feature

Testing

  • bun run lint
  • bun run type-check
  • bun run check:audits
  • bun run check:migrations origin/staging
  • 67 database tests and 221 focused application/workflow tests

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 27, 2026 2:09am

Request Review

@cursor

cursor Bot commented Aug 20, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Changes authorization for managed OAuth credentials and internal executor delegation, including policy evaluation, deployment-version binding, and token issuance. Mis-evaluation could over- or under-grant credential access.

Overview
Replaces enrollment-only Credential Group token checks with stored IAM-style resource policies (allow/deny, principals, flat conditions) plus a hidden actor-own system rule. Admins can edit the full policy as JSON; credential use is policy-gated while listing stays discovery-only.

Adds a required per-group policy lifecycle (create/delete/backfill), optimistic-concurrency admin GET/PUT, and a settings Access tab. Credential use now evaluates credential_groups.credentials.use with explicit-deny precedence.

Threads current workflow (draft vs active deployment version) through executor delegation and child-workflow execution so workflow principals and sim:WorkflowMode conditions bind to the child, not the root. Deployed state APIs now require deploymentVersionId; stale or cross-workspace child authority fails closed.

Reviewed by Cursor Bugbot for commit a01a557. Bugbot is set up for automated code reviews on this repo. Configure here.

@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch from 9995853 to 0c9fb23 Compare August 20, 2026 18:12
@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces credential-group grants with statement-based resource policies and carries workflow execution authority into credential-use decisions.

  • Adds explicit allow/deny policy evaluation with bounded principals and conditions.
  • Adds credential-group workflow-access administration and optimistic revision handling.
  • Adds resource-policy persistence, lifecycle triggers, backfill, and reconciliation.
  • Propagates deployment identity through nested and resumed workflow execution.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/resource-policies/evaluator.ts Implements deterministic explicit-deny, allow, and implicit-deny statement evaluation with registered principal and condition handlers.
apps/sim/lib/credential-groups/application/workflow-access-policy.ts Compiles and evaluates bounded workflow-access policies while retaining actor-owned credential access as a system rule.
apps/sim/lib/credential-groups/application/authorization.ts Connects delegated execution identity and current workflow authority to credential-group policy decisions.
apps/sim/lib/workflows/executor/execution-core.ts Constructs current workflow authority from draft or durable deployment state for downstream authorization.
apps/sim/executor/handlers/workflow/workflow-handler.ts Propagates child workflow identity and deployment version through nested executor delegation.
packages/db/credential-group-resource-policies.ts Adds idempotent policy reconciliation, lifecycle-trigger installation, bounded backfill paging, and invariant validation.
packages/db/migrations/0309_material_blonde_phantom.sql Introduces resource-policy persistence with workspace ownership and one-policy-per-resource uniqueness.
apps/sim/ee/credential-groups/components/credential-group-access.tsx Adds a staged workflow-access editor with optimistic revisions, conflict preservation, and save-time catalog validation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Authenticated principal] --> B[Workspace operation authorization]
  B --> C[Credential group access]
  C --> D[Load resource policy]
  E[Current workflow authority] --> F[Statement evaluator]
  D --> F
  F --> G{Decision}
  G -->|Explicit deny| H[Reject credential use]
  G -->|Allow| I[Resolve credential]
  G -->|Implicit deny| H
  J[Credential group lifecycle] --> K[Policy trigger and backfill]
  K --> D
Loading

Reviews (14): Last reviewed commit: "chore(resource-policies): merge workspac..." | Re-trigger Greptile

Comment thread apps/sim/ee/credential-groups/components/credential-group-access.tsx Outdated
@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch from aaea6ae to 52e3168 Compare August 21, 2026 00:17
@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch 2 times, most recently from 95eafd9 to 9d5f513 Compare August 21, 2026 01:41
@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch 2 times, most recently from c2d891e to 64f547f Compare August 21, 2026 01:53
Comment thread packages/db/migrations/0298_sparkling_hemingway.sql
Comment thread apps/sim/lib/credential-groups/application/manage-access.ts
@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch from 64f547f to eccb03a Compare August 21, 2026 04:47
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

3 issues from previous reviews remain unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit eccb03a. Configure here.

@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/credential-group-resource-policies branch from eccb03a to ede2aba Compare August 21, 2026 05:07
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@TheodoreSpeaks
TheodoreSpeaks requested a review from a team as a code owner August 26, 2026 04:22
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

…eat/credential-group-resource-policies

# Conflicts:
#	design/credential-group-authorization.md
#	design/principal-passing.md
#	design/resource-policies.md
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

# Conflicts:
#	packages/db/migrations/meta/0308_snapshot.json
#	packages/db/migrations/meta/_journal.json
#	packages/db/script-migrations-paused-billing-attribution.test.ts
#	packages/db/script-migrations/index.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant