feat(permissions): folder rbac - #7762
Conversation
… that have folder rbac permissions
…w if an action is available
…ect admin verification for folder rbac on permissions
…ere is a RBAC permission on the folder
|
💬 Discussion in Slack: #pr-review-infisical-7762-feat-permissions-folder-rbac Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel. |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 9387832 | Triggered | Generic Password | e1776a6 | backend/scripts/dev-folder-rbac.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
|
| Filename | Overview |
|---|---|
| backend/src/services/folder-permission/folder-permission-service.ts | Implements folder-grant CRUD and actor listings with project-scoped folder resolution, Manage Access checks, target eligibility checks, and transactional cache-version invalidation. |
| backend/src/services/folder-permission/folder-permission-dal.ts | Adds project- and organization-scoped user and identity roster queries, including group-derived access and active administrator exclusion. |
| backend/src/ee/services/permission/permission-service.ts | Integrates cached folder-scoped grants into project ability construction and adds project-wide fingerprint invalidation. |
| backend/src/ee/services/permission/folder-roles.ts | Defines cumulative folder access tiers and exact-path deny rules that replace relevant base-role permissions. |
| backend/src/ee/services/permission/permission-fns.ts | Adds folder-grant fetching, active-grant filtering, fingerprinting, and path-conditioned CASL rule construction. |
| backend/src/db/migrations/20260817120000_folder-scoped-additional-privileges.ts | Extends additional privileges with folder and role fields, referential integrity, and actor-per-folder uniqueness constraints. |
| backend/src/server/routes/v1/project-membership-router.ts | Exposes validated JWT-only user folder-access CRUD and listing endpoints. |
| backend/src/server/routes/v1/identity-project-membership-router.ts | Exposes validated user and identity-token APIs for machine-identity folder-access CRUD and listing. |
| frontend/src/pages/secret-manager/OverviewPage/components/FolderAccessSheet/FolderAccessSheet.tsx | Adds the primary folder-access roster UI with searching, actor-type merging, tier editing, temporary access, and revocation. |
| frontend/src/hooks/api/folderAccess/mutations.tsx | Implements folder-grant mutations and invalidates roster, secret, dashboard, and project-permission queries after successful changes. |
Reviews (1): Last reviewed commit: "fix: add manage-access check on folder m..." | Re-trigger Greptile
PR overviewThis pull request introduces folder-level role-based access control, including folder permission handling for users whose project access is derived through groups. Three security issues have been addressed, with one remaining. Folder grants can persist after a user loses their final group-derived project access, allowing those permissions to reactivate if the user is later re-added to the project without a new folder grant. Exploitation depends on the user subsequently regaining project membership. Open issues (1)
Fixed/addressed: 3 · PR risk: 4/10 |
API changesThe breaking changes reported earlier are resolved as of |
| target: TFolderGrantActor, | ||
| folderPermissionDAL: Pick<TFolderPermissionDALFactory, "hasProjectAccess"> | ||
| ) => { | ||
| const hasAccess = await folderPermissionDAL.hasProjectAccess({ |
There was a problem hiding this comment.
Low: Group-derived grants reactivate after project re-entry
This permits grants to actors whose only project access comes through a group, but those grants are stored against the actor and project rather than a membership. The group-removal flows do not delete these rows, so an attacker removed from their final project group can regain the old folder access automatically if they are later added back to the project, without an administrator granting that folder access again. When group removal eliminates an actor's final direct or group-derived access to a project, delete their folder-scoped grants and invalidate the folder-permission cache.
There was a problem hiding this comment.
veria-ai this was fixed
… and switch the way that the manage folder access verification is happening
…s not going to break)
Context
This introduces a new permission into the system, the RBAC for folders. More info on the design doc.
Screenshots
Steps to verify the change
There are several scenarios, so my recommendation is to create a folder with: secrets, dynamic secrets, rotations, imports and (if you want) honey tokens. Use an account which is project admin and another account that you can keep changing their permissions, so it is easier to validate how the permissions are being evaluated.
Scenario 1: The user has folder RBAC permission in two different folders
Scenario 2: Check the cache is working correctly
DEBUG=knex:queryon the .env)Scenario 3: Delete folders with RBAC as a member user
Scenario 4: Move folders with RBAC as a member user
Scenario 5: Project admins don't show on the rbac sheet
Scenario 6: Check all the defined permissions defined
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).