Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
11 KiB
11 KiB
Current Authorization Behavior Baseline
- Plan slug:
premium-abac-authorization-kernel - Date captured:
2026-04-21 - Purpose: document current authorization behavior before the authorization-kernel / premium-ABAC overhaul so implementation can validate behavior parity at the end.
Baseline Delta Cross-Links (2026-04-22 Exhaustive Sweep)
- Surgical remediation checkpoint:
ee/docs/plans/2026-04-22-premium-abac-remediation/
- Exhaustive remediation sweep:
ee/docs/plans/2026-04-22-premium-abac-exhaustive-remediation-sweep/PRD.mdee/docs/plans/2026-04-22-premium-abac-exhaustive-remediation-sweep/SCRATCHPAD.mdee/docs/plans/2026-04-22-premium-abac-exhaustive-remediation-sweep/EXHAUSTIVE_SURFACE_INVENTORY.md
- Exhaustive sweep implementation checkpoints:
2507228e1(feat(F001-F010): harden bundle lifecycle integrity and governance)33e72b1a2(feat(F011-F015): harden quote action authorization parity)fbef61405(feat(F016): enforce kernel-backed document URL authorization)7cec52725(feat(F017-F018): enforce document mutation and content auth parity)54facac75(feat(F019): harden document aggregate count surfaces)16acac536(feat(F020-F021): remove document shadow auth filters)596c43d91(feat(F024-F026): harden exhaustive asset auth parity)0384ad23c(feat(F027): harden projectActions parent-project auth)d57083f49(feat(F028-F032): enforce parent-project gating across task/status actions)
Current System Summary
Today the codebase uses:
- Authentication + tenant context
packages/auth/src/lib/getSession.tspackages/auth/src/lib/getCurrentUser.tspackages/auth/src/lib/withAuth.ts
- Core RBAC
server/src/lib/auth/rbac.tspackages/auth/src/lib/rbac.tspackages/tags/src/lib/permissions.ts(duplicate)
- Scattered inline ABAC-like rules
- client-portal board scoping
- manager/delegation rules
- document ownership/client visibility rules
- client-admin relationship checks
- assorted own/assigned/manage checks in feature code
- Dormant policy/DSL scaffolding not used as the primary runtime path
packages/auth/src/lib/policy/PolicyEngine.tspackages/auth/src/actions/policyActions.tsserver/src/lib/policy/PolicyEngine.tsee/server/src/lib/auth/policyEngine.tsee/server/src/lib/auth/policyParser.ts
Known Global Invariants
- RBAC is evaluated as
resource + actionagainst tenant-scoped role/permission data. user_typegates portal behavior (internalvsclient) and MSP/client permission flags.withAuth()authenticates and injects tenant context, but does not automatically enforce a permission.- API key flows usually authenticate as a user+tenant pair, but many API controller paths remain RBAC-only and do not consistently inherit inline ABAC-like checks from server-action/UI paths.
- Existing
policies/DSL scaffolding is not the authoritative runtime path and should not be treated as current production behavior.
Current Behavior by Resource Family
Tickets
Primary files
packages/client-portal/src/actions/client-portal-actions/client-tickets.tspackages/tickets/src/lib/clientPortalVisibility.tspackages/tickets/src/actions/ticketActions.tsserver/src/lib/api/controllers/ApiTicketController.ts
Current behavior
- Client portal ticket access is narrowed by the signed-in user's
contact_id -> client_idrelationship. - Client portal board visibility can be narrowed further through contact-level visibility groups and
applyVisibilityBoardFilter(). - Hidden-board direct access is guarded in client portal flows.
- Internal UI/server-action flows usually rely on RBAC plus feature-owned checks.
- API ticket controllers are largely RBAC-only today and are a likely parity gap.
Important parity risks to preserve/fix
- client-portal board filtering must remain fail-closed.
- direct ticket access, adjacent loaders, and create flows must stay aligned with list filtering.
- API/UI parity likely needs improvement during migration.
Documents
Primary files
server/src/app/api/documents/view/[fileId]/route.tspackages/documents/src/lib/documentPermissionUtils.tspackages/documents/src/actions/documentActions.ts
Current behavior
- Internal users often receive broad access once baseline RBAC passes.
- Client-user document access is heavily relationship-driven:
- own avatar / own linked contact
- same client association
- project-task ownership chain
- contract/client chain
- ticket/contact/client chain
is_client_visiblerequirement for client users in many paths
- Some utility code reasons only about entity-type permissions and may be coarser than route-level checks.
Important parity risks to preserve/fix
- same-tenant avatar/team-avatar behavior must remain intentional.
is_client_visiblesemantics must remain fail-closed for client users.- route-level richness and helper-level coarseness should be normalized.
Time / Timesheets
Primary files
packages/scheduling/src/actions/timeEntryDelegationAuth.tspackages/scheduling/src/actions/timeSheetActions.tspackages/scheduling/src/actions/timeEntryCrudActions.tsserver/src/lib/api/services/TimeEntryService.tsserver/src/lib/api/services/TimeSheetService.ts
Current behavior
- Strong existing relationship model:
- self
- manager of subject
- reports-to chain when enabled
- tenant-wide via
timesheet:read_all
- Approval and reversal flows are gated separately from simple read/write.
- Resource state matters (
approval_status, invoiced/approved restrictions in related domains). - API services have their own behavior and need parity review against server actions.
Important parity risks to preserve/fix
- manager/delegation semantics are a canonical built-in relationship rule and must survive migration unchanged unless explicitly changed.
- self-approval / state-transition guards must remain strict.
Projects
Primary files
packages/projects/src/actions/projectActions.tspackages/projects/src/actions/projectTaskActions.tspackages/projects/src/actions/projectTaskCommentActions.ts
Current behavior
- Many flows are RBAC-first (
project:read,project:update). - Some project/task/comment paths already use ownership-like checks such as own-comment-or-internal-user rules.
- Project and project-task records often imply client scope, team scope, and assignment scope, but those checks are not yet normalized under one common runtime.
Important parity risks to preserve/fix
- preserve existing own-comment semantics.
- map project/client/team/assignment relationships into a shared model without broadening access.
Assets
Primary files
packages/assets/src/actions/assetActions.tspackages/assets/src/actions/assetDocumentActions.ts
Current behavior
- Mostly RBAC-first today.
- Assets intersect with tickets and documents and are likely to need client/team segmentation once remote-support / remote-control style actions are considered.
- Existing actions do not yet appear to use a unified portfolio/assignment narrowing model.
Important parity risks to preserve/fix
- avoid inventing broader asset visibility during migration.
- establish explicit client/team/assignment semantics before layering premium restrictions.
Billing / Quotes / Invoices
Primary files
packages/billing/src/actions/quoteActions.tspackages/billing/src/actions/recurringApprovalBlockers.ts- billing-related API routes and exports under
server/src/app/api/v1/...
Current behavior
- RBAC controls baseline access.
- Important state/relationship guards exist around approval workflows and invoice blockers.
- Quote approval semantics already imply separation-of-duties style requirements.
- Billing data is a likely candidate for future field-level redaction.
Important parity risks to preserve/fix
- preserve approval-state gates and existing blockers.
- do not broaden billing visibility while centralizing behavior.
Client Portal Administration / Client Relationships
Primary files
packages/client-portal/src/actions/client-portal-actions/visibilityGroupActions.tspackages/client-portal/src/lib/clientAuth.tspackages/clients/src/components/contacts/ContactPortalTab.tsx
Current behavior
- Client portal admin privileges are relationship-driven through contact linkage and
is_client_admin. - Same-client enforcement is essential for both read and mutation flows.
- This is a canonical example of built-in relationship logic that must exist in CE+EE, not only in configurable premium overlays.
API Keys / Programmatic Access
Primary files
server/src/lib/api/controllers/ApiBaseController.tsserver/src/lib/auth/apiAuth.tspackages/auth/src/lib/apiAuth.tsserver/src/middleware/express/authMiddleware.ts
Current behavior
- API keys usually authenticate to a user+tenant identity.
- Permission checks are generally RBAC-only.
- Programmatic paths may not consistently inherit the inline ABAC-like restrictions present in server-action/UI flows.
Important parity risks to preserve/fix
- API/UI drift is one of the main reasons to build the kernel.
- future API-key narrowing must be an intersection with user access, never a widening.
Current Dormant / Legacy Policy Scaffolding
Primary files
packages/auth/src/lib/policy/PolicyEngine.tspackages/auth/src/actions/policyActions.tsserver/src/lib/policy/PolicyEngine.tsee/server/src/lib/auth/policyEngine.tsee/server/src/lib/auth/policyParser.tsserver/src/components/settings/security/SecuritySettingsPage.tsxpackages/product-auth-ee/oss/entry.tsxpackages/product-auth-ee/ee/entry.ts
Current behavior
- There is a
policiestable and EE policy-management UI scaffolding. - The parser/DSL is not the authoritative runtime authorization path.
- CE/server/EE implementations have drifted and should be treated as legacy scaffolding for replacement, not extension.
Baseline Validation Focus Areas
The migration should explicitly validate:
- Ticket list/detail/create parity under client/board narrowing.
- Document route/helper parity for ownership/client-visible behavior.
- Time self/manager/read-all semantics.
- Project ownership/assignment/comment semantics.
- Asset segmentation behavior remains no broader than before.
- Billing approval/blocker semantics remain intact.
- API key paths converge toward the same effective narrowing as UI/server-action paths for migrated resources.
- CE keeps built-in behavior through the shared kernel even without configurable bundle management.
- EE configurable overlays only narrow access; they never widen baseline behavior.
Salient Reference Files
packages/auth/src/lib/getSession.tspackages/auth/src/lib/getCurrentUser.tspackages/auth/src/lib/withAuth.tsserver/src/lib/auth/rbac.tspackages/db/src/models/user.tspackages/tickets/src/lib/clientPortalVisibility.tspackages/scheduling/src/actions/timeEntryDelegationAuth.tsserver/src/app/api/documents/view/[fileId]/route.tspackages/client-portal/src/actions/client-portal-actions/visibilityGroupActions.tsserver/src/lib/api/controllers/ApiBaseController.tsserver/src/lib/api/controllers/ApiTicketController.tspackages/auth/src/actions/policyActions.tsee/server/src/lib/auth/policyEngine.tsee/server/src/lib/auth/policyParser.ts