Skip to content

Add personal access tokens, deployment management, storage profiles and remove MySQL#36

Open
krishna-santosh wants to merge 46 commits into
mainfrom
dev
Open

Add personal access tokens, deployment management, storage profiles and remove MySQL#36
krishna-santosh wants to merge 46 commits into
mainfrom
dev

Conversation

@krishna-santosh

Copy link
Copy Markdown
Member

No description provided.

New migration creating tables for personal access tokens, deployments (triggers/jobs), and storage profiles across all three backends.
Replace simple read/write permission model with fine-grained TokenScope enum supporting site, content, files, schema, webhooks, deployments, and MCP scopes. Add PersonalAccessToken types, encode/decode helpers, and backward-compatible 'read'/'write' aliases. Update authorization model with new Action variants (WebhooksTrigger, Deployments*) and token_hard_denied helper. Extend repository traits with personal token storage interface and implement across all three backends.
…ment

Introduce PersonalTokenActor with scope-based auth enforcement. Support vcms_pat_ token prefix in API auth middleware. Resolve personal token site context via X-VCMS-Site header. Add PAT CRUD (create/list/revoke) service, handler, and /account/tokens routes. Update GraphQL context to pass requested site and scopes. Provide in-memory PAT repository stubs for testing.
Register deployment and storage_profile modules in lib.rs and services. Add deployment and storage profile routes in router. Wire storage profile registration and deployment reconcilation at server startup. Add storage_profile_id to CLI backup create options.
Introduce StorageProfile model, service (CRUD + probe), and HTTP handler. Add storage_profile_id optional column to Site model and include it in all site queries across backends. Assign storage profile on site creation. Expose profile ID in site listing responses. Wire storage profile CRUD and probe routes under /instance/storage-profiles. Update file storage resolution to COALESCE storage profile over legacy storage_provider.
Add DestinationSpec::Profile variant for routing backups through configured storage profiles. Include storage_profile_id in backup and schedule creation payloads. Persist profile ID in backup metadata tables.
Add DeploymentTrigger and DeploymentJob models, service with reconcile_interrupted for crash recovery, HTTP handler, and routes under /sites/{site_id}/deployments. Extend WebhookService with protect/reveal_deployment_config helpers for encrypting deployment URL and headers.
Add list_sites tool returning sites accessible to the authenticated user. Enforce that all site-scoped MCP tools require an explicit site_id parameter (except list_sites). Clean up whitespace (CRLF→LF) and update test assertions to match.
Add API functions and TypeScript types for scoped site tokens, personal access tokens (PAT), storage profiles (CRUD + probe), deployments (triggers, jobs, history), and storage_profile_id on backups and sites.
Add PersonalTokensCard component for creating, listing, and revoking personal access tokens. Integrate into the account page.
…ge profiles

Rebuild storage settings page with storage profile CRUD (create, list, probe, delete). Add storage profile picker to the create-site dialog. Require operator role instead of instance_owner only.
…authorization service

Pass X-VCMS-Site header from GraphQL router to GqlContext for personal token site resolution. Update AuthorizationService to use scope_for_action and PersonalTokenActor for scope-based enforcement.
…backup selector, and update routing

Add deployments management page under site settings. Add MCP configuration page. Add storage profile selector to backup creation form. Update sidebar with new navigation items. Regenerate route tree. Pass role prop to GeneralSection. Update site settings layout and routing.
…ment jobs

Add partial unique index on deployment_jobs to enforce at most one queued or running job per trigger. MySQL uses a generated column approach, Postgres and SQLite use filtered unique indexes.
…oyment service

Extract build_protected_client from deliver_to_url as a reusable method for deployments. Refactor deployment execute_job to use it. Add map_job_insert_error returning 'deployment_in_progress' on unique violation and a unit test for active job uniqueness.
…ns in GraphQL

When a personal token supplies X-VCMS-Site, verify the user has SiteRead access before trusting the header, rather than blindly accepting the requested site.
Swap 'now' and 'storage_profile_id' parameter positions in insert_running and create_schedule to match the actual column order in the backups and backup_schedules tables.
…CT, and indexes

Add ENGINE=InnoDB to storage_profiles CREATE TABLE, add ON DELETE RESTRICT to backup FKs, and add standalone indexes for backup FK columns.
…require_scope

Add TokenScopes to GrpcAuthContext, decode scopes from access token HMAC payload, determine can_write from any write-scope presence, and replace coarse can_read/require_read/require_write with require_scope(TokenScope).
Replace require_read()/require_write() calls with require_scope(TokenScope::*) across all gRPC service implementations to enforce fine-grained token scopes.
Introduce site_key_scopes() helper that returns the full scope list for read or write access, and update create_site_and_token to accept a scopes array instead of a permission string.
Switch gRPC test token creation from the 'permission' field to the 'scopes' field using site_key_scopes.
Replace the 'permission' field with 'scopes' using site_key_scopes in all GraphQL integration tests.
Replace the 'permission' field with 'scopes' using site_key_scopes in all REST integration tests. Update assertions to check for scopes presence instead of the permission string.
Add mcp_call_site_tool wrapper that injects site_id into tool
call arguments, and update create_test_collection/create_test_entry
fixtures to accept a site_id parameter.
Update all MCP integration tests to use mcp_call_site_tool instead
of bare mcp_call_tool, passing the captured site_id so that tools
receive the required site_id argument.
Replace references to vcms_site_* tokens with generic 'VCMS access
token' in doc comments, reflecting that vcms_pat_* tokens are now
also accepted.
Update MCP proxy section to describe that both vcms_site_* and
vcms_pat_* tokens with the mcp.use scope are accepted.
Change error assertion from 'MCP requires a vcms_site_* access token'
to 'MCP requires a VCMS access token', consistent with vcms_pat_*
token support.
Flip test assertion from expecting list_sites to be absent to
expecting it to be available, reflecting the new list_sites tool.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 125 files, which is 25 over the limit of 100.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 845c08ab-df97-43b7-a937-5b9aa3225b71

📥 Commits

Reviewing files that changed from the base of the PR and between 35e3625 and cbeef1d.

📒 Files selected for processing (143)
  • .coderabbit.yaml
  • .github/workflows/ci.yml
  • AGENTS.md
  • CLAUDE.md
  • README.md
  • apps/backend/Cargo.toml
  • apps/backend/migrations/mysql/20260501000000_initial_schema.sql
  • apps/backend/migrations/mysql/20260530000000_add_files_mime_type_index.sql
  • apps/backend/migrations/mysql/20260610000000_auth_rbac.sql
  • apps/backend/migrations/mysql/20260611000000_add_perf_indexes.sql
  • apps/backend/migrations/mysql/20260616000000_roles_v2.sql
  • apps/backend/migrations/mysql/20260617000000_backups.sql
  • apps/backend/migrations/mysql/20260618000000_search_index_queue.sql
  • apps/backend/migrations/mysql/20260619000000_instance_settings.sql
  • apps/backend/migrations/mysql/20260620000000_webhook_enabled.sql
  • apps/backend/migrations/postgres/20260721000000_tokens_deployments_storage.sql
  • apps/backend/migrations/sqlite/20260721000000_tokens_deployments_storage.sql
  • apps/backend/project.json
  • apps/backend/src/config.rs
  • apps/backend/src/database/backend.rs
  • apps/backend/src/database/mod.rs
  • apps/backend/src/database/pool.rs
  • apps/backend/src/error.rs
  • apps/backend/src/graphql/context.rs
  • apps/backend/src/graphql/mutation/collection.rs
  • apps/backend/src/graphql/mutation/entry.rs
  • apps/backend/src/graphql/mutation/file.rs
  • apps/backend/src/graphql/mutation/mod.rs
  • apps/backend/src/graphql/query/mod.rs
  • apps/backend/src/grpc/interceptor.rs
  • apps/backend/src/grpc/services/admin_site.rs
  • apps/backend/src/grpc/services/admin_webhook.rs
  • apps/backend/src/grpc/services/collection.rs
  • apps/backend/src/grpc/services/entry.rs
  • apps/backend/src/grpc/services/file.rs
  • apps/backend/src/grpc/services/singleton.rs
  • apps/backend/src/handlers/access_token_handler.rs
  • apps/backend/src/handlers/backup_handler.rs
  • apps/backend/src/handlers/deployment_handler.rs
  • apps/backend/src/handlers/settings_handler.rs
  • apps/backend/src/handlers/site_handler.rs
  • apps/backend/src/handlers/storage_profile_handler.rs
  • apps/backend/src/lib.rs
  • apps/backend/src/main.rs
  • apps/backend/src/mcp/auth.rs
  • apps/backend/src/mcp/resources/site_schema.rs
  • apps/backend/src/mcp/server.rs
  • apps/backend/src/mcp/tools/collection.rs
  • apps/backend/src/mcp/tools/entry.rs
  • apps/backend/src/mcp/tools/file.rs
  • apps/backend/src/mcp/tools/singleton.rs
  • apps/backend/src/mcp/tools/site.rs
  • apps/backend/src/mcp/tools/webhook.rs
  • apps/backend/src/mcp/transports/stdio.rs
  • apps/backend/src/middleware/api_auth.rs
  • apps/backend/src/middleware/auth.rs
  • apps/backend/src/middleware/site_resolver.rs
  • apps/backend/src/models/access_token.rs
  • apps/backend/src/models/authorization.rs
  • apps/backend/src/models/deployment.rs
  • apps/backend/src/models/site.rs
  • apps/backend/src/models/storage_profile.rs
  • apps/backend/src/repository/mod.rs
  • apps/backend/src/repository/mysql/access_token.rs
  • apps/backend/src/repository/mysql/collection.rs
  • apps/backend/src/repository/mysql/entry.rs
  • apps/backend/src/repository/mysql/file.rs
  • apps/backend/src/repository/mysql/mod.rs
  • apps/backend/src/repository/mysql/session.rs
  • apps/backend/src/repository/mysql/site.rs
  • apps/backend/src/repository/mysql/user.rs
  • apps/backend/src/repository/mysql/webhook.rs
  • apps/backend/src/repository/postgres/access_token.rs
  • apps/backend/src/repository/postgres/file.rs
  • apps/backend/src/repository/postgres/site.rs
  • apps/backend/src/repository/sqlite/access_token.rs
  • apps/backend/src/repository/sqlite/file.rs
  • apps/backend/src/repository/sqlite/site.rs
  • apps/backend/src/repository/traits.rs
  • apps/backend/src/router/access_tokens.rs
  • apps/backend/src/router/deployments.rs
  • apps/backend/src/router/graphql.rs
  • apps/backend/src/router/instance.rs
  • apps/backend/src/router/mod.rs
  • apps/backend/src/server.rs
  • apps/backend/src/services/access_token.rs
  • apps/backend/src/services/authorization.rs
  • apps/backend/src/services/backup/meta.rs
  • apps/backend/src/services/backup/mod.rs
  • apps/backend/src/services/backup/scheduler.rs
  • apps/backend/src/services/backup/schema.rs
  • apps/backend/src/services/deployment.rs
  • apps/backend/src/services/error.rs
  • apps/backend/src/services/mod.rs
  • apps/backend/src/services/search/queue.rs
  • apps/backend/src/services/settings.rs
  • apps/backend/src/services/site.rs
  • apps/backend/src/services/storage_profile.rs
  • apps/backend/src/services/webhook.rs
  • apps/backend/src/test_helpers.rs
  • apps/backend/tests/common/fixtures.rs
  • apps/backend/tests/common/grpc.rs
  • apps/backend/tests/common/mcp.rs
  • apps/backend/tests/common/server.rs
  • apps/backend/tests/common/test_db.rs
  • apps/backend/tests/graphql/auth_tests.rs
  • apps/backend/tests/graphql/collections_tests.rs
  • apps/backend/tests/graphql/entries_tests.rs
  • apps/backend/tests/graphql/files_tests.rs
  • apps/backend/tests/graphql/sites_tests.rs
  • apps/backend/tests/graphql/webhooks_tests.rs
  • apps/backend/tests/mcp/collection_tests.rs
  • apps/backend/tests/mcp/entry_tests.rs
  • apps/backend/tests/mcp/file_tests.rs
  • apps/backend/tests/mcp/protocol_tests.rs
  • apps/backend/tests/mcp/resource_tests.rs
  • apps/backend/tests/mcp/singleton_tests.rs
  • apps/backend/tests/mcp/site_tests.rs
  • apps/backend/tests/mcp/stdio_proxy_tests.rs
  • apps/backend/tests/mcp/webhook_tests.rs
  • apps/backend/tests/rest/access_tokens_tests.rs
  • apps/backend/tests/rest/collections_tests.rs
  • apps/backend/tests/rest/files_tests.rs
  • apps/backend/tests/rest/main.rs
  • apps/backend/tests/rest/storage_profiles_tests.rs
  • apps/dashboard/src/components/account/personal-tokens-card.tsx
  • apps/dashboard/src/components/backups/backups-section.tsx
  • apps/dashboard/src/components/sidebar/app-sidebar.tsx
  • apps/dashboard/src/components/site-settings/general-section.tsx
  • apps/dashboard/src/lib/api.ts
  • apps/dashboard/src/routeTree.gen.ts
  • apps/dashboard/src/routes/_admin/_shell/account.tsx
  • apps/dashboard/src/routes/_admin/_shell/index.tsx
  • apps/dashboard/src/routes/_admin/_shell/settings.tsx
  • apps/dashboard/src/routes/_admin/_shell/settings/storage.tsx
  • apps/dashboard/src/routes/_admin/sites.$siteId/deployments.tsx
  • apps/dashboard/src/routes/_admin/sites.$siteId/settings.tsx
  • apps/dashboard/src/routes/_admin/sites.$siteId/settings/index.tsx
  • apps/dashboard/src/routes/_admin/sites.$siteId/settings/mcp.tsx
  • apps/web/src/components/landing/database-section.tsx
  • apps/web/src/components/landing/features-section.tsx
  • docker-compose.test.yml
  • package.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@velopulent velopulent deleted a comment from coderabbitai Bot Jul 24, 2026
@velopulent velopulent deleted a comment from coderabbitai Bot Jul 24, 2026
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