-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(webapp): consolidate auth path + add comprehensive auth tests #3499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matt-aitken
wants to merge
93
commits into
main
Choose a base branch
from
rbac-packages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
c2a3168
Initial commit of RBAC split setup
matt-aitken cf73bae
Verdaccio publish
matt-aitken 1f18764
Every change will republish when in dev
matt-aitken 5c910d8
RBAC/plugin updates
matt-aitken e90a5a9
Update RBAC plugin interface: authenticateBearer/Session, drop Prisma…
matt-aitken 048217e
JWT/realtime token integration: publicJWT subject, jwt metadata, allo…
matt-aitken 5250410
Lazy loading of plugin
matt-aitken 4a1f36d
RBAC: force-fallback flag + env var + e2e fallback wiring (TRI-8715)
matt-aitken 5555496
RBAC: API auth e2e coverage — action + PAT + edge cases (TRI-8716)
matt-aitken d575f7a
RBAC: resource-scoped JWT e2e coverage (TRI-8716 follow-up)
matt-aitken 46a4e3a
RBAC: pre-migration JWT behaviour tests for TRI-8719 risks (TRI-8716)
matt-aitken 045ae6f
RBAC plugin: array resources + action alias wrapper (TRI-8719 Phase A)
matt-aitken e38028b
RBAC: migrate apiBuilder to rbac.authenticateBearer + ability.can (TR…
matt-aitken 6288459
RBAC: dashboardLoader / dashboardAction + migrate admin pages (TRI-8717)
matt-aitken 54c3934
RBAC plugin: authenticateAuthorize* accepts array resources
matt-aitken 9d9b078
RBAC tests: shared-container test harness for the comprehensive auth …
matt-aitken b291856
RBAC plugin: Result types on mutation methods + OSS fallback (TRI-8747)
matt-aitken 235316e
RBAC: split dashboardBuilder so client-bundle imports resolve
matt-aitken 0353106
Code comments/formatting
matt-aitken a6fd008
Batch added resource
matt-aitken e58d9e3
Batch add resource
matt-aitken f713b17
RBAC: Teams page UI — role dropdowns, plan-aware disabling, manage ga…
matt-aitken 63d9fc3
Delete API batches
matt-aitken 70e56d8
RBAC: auto-assign system roles on org create + invite accept (TRI-8854)
matt-aitken 280e955
RBAC: PAT creation flow with role selection (TRI-8749)
matt-aitken a172569
Use defaultValue instead of lots of useState
matt-aitken 8003aab
RBAC tests: PAT auth comprehensive matrix (TRI-8741)
matt-aitken 3c9722e
RBAC tests: dashboard session auth for admin pages (TRI-8742)
matt-aitken bb51ced
RBAC tests: cross-cutting auth edge cases (TRI-8743)
matt-aitken ad60d26
RBAC tests: waitpoint completions + input streams (TRI-8740)
matt-aitken 4f515a8
RBAC tests: trigger task routes (TRI-8733)
matt-aitken bd584a5
RBAC tests: run lists (TRI-8736)
matt-aitken 5a24e9c
RBAC tests: run mutations — cancel + idempotencyKeys.reset (TRI-8735)
matt-aitken c81dce2
RBAC tests: run resource routes — multi-key (TRI-8734)
matt-aitken 93eb9d1
RBAC tests: batch retrieve + realtime (TRI-8737)
matt-aitken e396a04
RBAC tests: prompts (TRI-8738)
matt-aitken 22ab2c1
RBAC tests: deployments + query (TRI-8739)
matt-aitken 9199b49
RBAC tests: unblock e2e.full harness; all 162 tests pass (TRI-8731)
matt-aitken f755a49
RBAC tests: parameterise RBAC_FORCE_FALLBACK in testcontainers (TRI-8…
matt-aitken e45d201
RBAC tests: extract projectCreated to break platform.v3.server cycle …
matt-aitken 85411e9
Latest lockfile… although it'll probably get conflicted again
matt-aitken 1724119
RBAC: Roles page (TRI-8880)
matt-aitken 9806adb
RBAC: drop upfront UserRole inserts from org-creation and invite flows
matt-aitken 26e4a18
RBAC: scrub "enterprise" / "OSS" / cloud-side references from comments
matt-aitken 9c33822
RBAC: scrub enterprise reference from rbac-force-fallback server-chan…
matt-aitken 70741ee
RBAC: drop Wildcards group from Roles page client-side mapping
matt-aitken 3281a70
RBAC: extend Permission + RbacResource for CASL conditional rules (TR…
matt-aitken 6a26e13
RBAC: rework Roles page as a permission × role comparison Table (TRI-…
matt-aitken 241ad84
RBAC: flex Roles page header + cell content horizontally with gap-1
matt-aitken 66cfcb8
RBAC: left-align Roles page role columns (header + cells)
matt-aitken a4be47a
RBAC: shrink-to-content sizing for non-Description columns on Roles page
matt-aitken 37f259d
RBAC: revert column shrink-to-content sizing on Roles page
matt-aitken 152fe72
RBAC: render conditional cells as plain dimmed text (no tick + badge)
matt-aitken 21d742e
RBAC: invite flow role picker via OrgMemberInvite.rbacRoleId (TRI-8892)
matt-aitken c61a748
Tightened up comments and log an error for failed role assignments
matt-aitken 89079a5
RBAC: rbac.systemRoleIds() instead of duplicating role-id constants
matt-aitken 6008f59
RBAC: give upgrade-link rows a value so Ariakit handles the click
matt-aitken a5684ed
RBAC: preserve render prop in SelectItem outside Combobox context
matt-aitken e1a1961
Fixed role link
matt-aitken 2f89f90
RBAC: replace systemRoleIds() with systemRoles() catalogue
matt-aitken d511975
RBAC: address PR review — batch trigger AND, fallback resilience, pic…
matt-aitken 081f644
Consolidate plugin changesets into a single patch entry
matt-aitken 40f33d6
Tighten plugin changeset description
matt-aitken 34872bb
Consolidate server-changes into a single entry
matt-aitken 04a3cc4
Hide the Roles page for non-cloud
matt-aitken 749fcd2
Hardcode legacy OrgMember.role=MEMBER on invite
matt-aitken 74cbef2
Invite picker: allow at-or-below the inviter's own role
matt-aitken caade5d
Remove unneeded comment
matt-aitken f0d2c0d
Plugin: getUserRoles(userIds, orgId) batch lookup
matt-aitken fc445f8
Plugin owns permission display groups
matt-aitken cc4680b
Improved the team layout
matt-aitken 8ea973c
Not enough permissions tooltip
matt-aitken 70aa227
dashboardLoader/Action can access the context data
matt-aitken cd8f3d2
Sessions routes: post-RBAC apiBuilder shape + preserve superScopes se…
matt-aitken 34be809
Plugin: authenticatePat for cap-and-floor PAT auth (TRI-9087)
matt-aitken 048b87b
ci: align e2e-webapp-auth-full pnpm pin with root packageManager
matt-aitken 878b91f
test(webapp): exclude *.e2e.full.test.ts from unit-test glob
matt-aitken bd40eb4
Address PR review: fallback grace window + multi-table query AND + UX
matt-aitken af527b2
test(webapp): every-table semantics for /api/v1/query
matt-aitken 94b4c2c
apiBuilder: require explicit anyResource() / everyResource() at multi…
matt-aitken 92b0494
Address Devin review: 4 RBAC auth path fixes
matt-aitken 5897682
core: move sanitizeBranchName + isValidGitBranchName to @trigger.dev/…
matt-aitken 876aa76
core/plugins/auth boundary: define slim AuthenticatedEnvironment, eli…
matt-aitken 29e7633
lockfile updates for @trigger.dev/core dep on plugins
matt-aitken 90616fc
lockfile (cont)
matt-aitken 4d7689a
e2e-webapp-auth-full.yml: SHA-pin actions, drop persisted credentials
matt-aitken dd41a92
Address Devin review: Decimal coercion + replica plumbing + check-exp…
matt-aitken d7c0329
test(webapp): stop createInMemoryTracing from registering OTel globally
matt-aitken d42d00d
test(testcontainers): fix assertNonNullable — drop the require("vites…
matt-aitken c70d755
fix(rbac,webapp): pass userId through plugin context, drop session-co…
matt-aitken b9fcb1f
fix(test/utils/tracing): disable OTel globals before re-registering i…
matt-aitken 2674417
fix(webapp): normalize PAT/OAT environments through the same toAuthen…
matt-aitken 9f987ae
fix(webapp): backwards-compat for type-level scope on runs list + tig…
matt-aitken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/core": patch | ||
| --- | ||
|
|
||
| Add `sanitizeBranchName` and `isValidGitBranchName` exports under `@trigger.dev/core/v3/utils/gitBranch`. These were previously webapp-internal but are now shared with the RBAC fallback's branch-aware authentication path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/plugins": patch | ||
| --- | ||
|
|
||
| The public interfaces for a plugin system. Initially consolidated authentication and authorization interfaces. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| name: "🛡️ E2E Tests: Webapp Auth (full)" | ||
|
|
||
| # Comprehensive RBAC auth test suite — see TRI-8731. Runs separately from | ||
| # the smoke e2e-webapp.yml because it covers every route family with a | ||
| # pass/fail matrix and would otherwise dominate per-PR CI time. | ||
| # | ||
| # Triggered: | ||
| # - Manually via workflow_dispatch. | ||
| # - Nightly via schedule. | ||
| # - On pull requests touching auth-relevant files only (paths filter). | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: "0 4 * * *" # 04:00 UTC daily | ||
| pull_request: | ||
| paths: | ||
| - "apps/webapp/app/services/routeBuilders/**" | ||
| - "apps/webapp/app/services/rbac.server.ts" | ||
| - "apps/webapp/app/services/apiAuth.server.ts" | ||
| - "apps/webapp/app/services/personalAccessToken.server.ts" | ||
| - "apps/webapp/app/services/sessionStorage.server.ts" | ||
| - "apps/webapp/app/routes/api.v*.**" | ||
| - "apps/webapp/app/routes/realtime.v*.**" | ||
| - "apps/webapp/test/**/*.e2e.full.test.ts" | ||
| - "apps/webapp/test/setup/global-e2e-full-setup.ts" | ||
| - "apps/webapp/test/helpers/sharedTestServer.ts" | ||
| - "apps/webapp/test/helpers/seedTestSession.ts" | ||
| - "apps/webapp/vitest.e2e.full.config.ts" | ||
| - "internal-packages/rbac/**" | ||
| - "packages/plugins/**" | ||
| - ".github/workflows/e2e-webapp-auth-full.yml" | ||
|
|
||
| jobs: | ||
| e2eAuthFull: | ||
| name: "🛡️ E2E Auth Tests (full)" | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| env: | ||
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| steps: | ||
| - name: 🔧 Disable IPv6 | ||
| run: | | ||
| sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 | ||
| sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 | ||
| sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 | ||
|
|
||
| - name: 🔧 Configure docker address pool | ||
| run: | | ||
| CONFIG='{ | ||
| "default-address-pools" : [ | ||
| { | ||
| "base" : "172.17.0.0/12", | ||
| "size" : 20 | ||
| }, | ||
| { | ||
| "base" : "192.168.0.0/16", | ||
| "size" : 24 | ||
| } | ||
| ] | ||
| }' | ||
| mkdir -p /etc/docker | ||
| echo "$CONFIG" | sudo tee /etc/docker/daemon.json | ||
|
|
||
| - name: 🔧 Restart docker daemon | ||
| run: sudo systemctl restart docker | ||
|
|
||
| - name: ⬇️ Checkout repo | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| # Don't leave the GITHUB_TOKEN in .git/config — this job | ||
| # doesn't need to push and the persisted creds would be | ||
| # readable from any subsequent step (zizmor/artipacked). | ||
| persist-credentials: false | ||
|
|
||
| - name: ⎔ Setup pnpm | ||
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 | ||
| with: | ||
| version: 10.33.2 | ||
|
|
||
| - name: ⎔ Setup node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 20.20.0 | ||
| cache: "pnpm" | ||
|
|
||
| - name: 🐳 Login to DockerHub | ||
| if: ${{ env.DOCKERHUB_USERNAME }} | ||
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| - name: 🐳 Skipping DockerHub login (no secrets available) | ||
| if: ${{ !env.DOCKERHUB_USERNAME }} | ||
| run: echo "DockerHub login skipped because secrets are not available." | ||
|
|
||
| - name: 🐳 Pre-pull testcontainer images | ||
| if: ${{ env.DOCKERHUB_USERNAME }} | ||
| run: | | ||
| docker pull postgres:14 | ||
| docker pull redis:7.2 | ||
| docker pull testcontainers/ryuk:0.11.0 | ||
|
|
||
| - name: 📥 Download deps | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: 📀 Generate Prisma Client | ||
| run: pnpm run generate | ||
|
|
||
| - name: 🏗️ Build Webapp | ||
| run: pnpm run build --filter webapp | ||
|
|
||
| - name: 🛡️ Run Webapp Full Auth E2E Tests | ||
| run: cd apps/webapp && pnpm exec vitest run --config vitest.e2e.full.config.ts --reporter=default | ||
| env: | ||
| WEBAPP_TEST_VERBOSE: "1" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: improvement | ||
| --- | ||
|
|
||
| Webapp now supports a plugin system. Initially consolidates authentication and authorization paths. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.