qiick / laravel-access
Shared authorization core for qiick Laravel products: Gate::before, effective permissions, actor context, and enforced 2FA.
Requires
- php: ^8.3
- illuminate/auth: ^12.0 || ^13.0
- illuminate/contracts: ^12.0 || ^13.0
- illuminate/database: ^12.0 || ^13.0
- illuminate/http: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
- spatie/laravel-permission: ^8.0
Requires (Dev)
- larastan/larastan: ^3.3
- laravel/pint: ^1.30
- nunomaduro/collision: ^8.5
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-mutate: ^4.0
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-develop
- dev-chore/release-0.1.0-beta.1
- dev-docs/access-housekeeping
- dev-fix/principals-configured-model
- dev-docs/dependencies-register
- dev-docs/gate-shadow-warnings
- dev-feat/asserts-roles-schema
- dev-fix/26-principal-created-after-commit
- dev-ci/cancel-superseded-pull-request-runs
- dev-fix/25-group-names-per-organisation
- dev-feat/principal-ceiling
- dev-ci/dependabot
- dev-test/principals-process-concurrency
- dev-feat/legacy-gate-shadow
- dev-ci/mutation-timeout
- dev-chore/release-0.1.0
- dev-feat/principals-schema-assertion
- dev-feat/principal-directory
- dev-feat/principals-schema
- dev-feat/testing-probe-and-direct-check-scanner
- dev-docs/guard-config-nits
- dev-fix/unclassified-guard-is-api
- dev-feat/permission-middleware-and-trait
- dev-fix/team-local-super-admin
- dev-fix/redteam-access-findings
- dev-feat/group-instance-organisation
- dev-feat/two-factor-super-admin-guard
- dev-feat/gate-before-resolver
- dev-feat/adapters
- dev-feat/actor-runtime
- dev-chore/dependabot
- dev-feat/contracts
- dev-chore/scaffold-package
This package is auto-updated.
Last update: 2026-11-25 13:41:42 UTC
README
qiick/laravel-access
Pre-1.0 (
0.x): public APIs may change in any minor. Not on Packagist yet.
Shared authorization core for qiick Laravel products: one Gate::before, the
effective-permission resolver (direct ∪ group roles, soft-deleted groups
excluded), a typed actor context so API actors never get the super-admin pass,
enforced 2FA middleware, the EnsureUserHasPermission route middleware and the
AuthorizesWithPermission FormRequest trait.
Part of the qiick fleet. Binding design:
projects/qiick/packages/laravel-access-design.md in the knowledge base
(overlays: decisions/2026-11-22-laravel-access-package.md,
decisions/2026-11-22-mcp-oauth-and-access-design-answers.md,
decisions/2026-11-20-core-hardening.md).
Status
0.1.0-beta.1 is the first tagged pre-release, for beta adoption in the qiick
products. Public APIs may change in any 0.x release; see
UPGRADING.md. Packagist publishing waits for the
maintainer's go; until then products install it from the tag.
Requirements
- PHP
^8.3 - Illuminate auth / contracts / database / http / support
^12.0 \|\| ^13.0(neverlaravel/framework) spatie/laravel-permission^8.0
Install (when published)
composer require qiick/laravel-access php artisan vendor:publish --tag=access-config
Products must bind RoleCatalog, TwoFactorPolicy, TwoFactorResponder and
AuthorizationResponder, set permission.register_permission_check_method to
false, and call AccessContext::enter() after verifying a credential. See
docs/adoption.md and
docs/reference-contracts.md.
Threat model (short)
| Threat | Mitigation |
|---|---|
| Super-admin elevation through a key, grant or public door | Gate::before step 2 abstains for API actors; Spatie's permission callback off; AC2 |
| Future model-less check on an API path | Step 2 unconditional; permission: middleware and trait give API actors only scopes ∩ the owner's assigned permissions, never super-admin, and deny them when no ApiActorScopeCheck is bound; Policies use the resolver, never $actor->can(<permission>); AC2, AC8, AC9 |
| Forged actor kind | Context bound only after verification; resolver never reads request input; either-signal rule; AC4 |
| Job escaping the key's limits | CarriesActorContext job middleware; AC5 |
| Stale permissions after demotion | fresh use-time checks, event and lifecycle clears, scoped resolver; AC6, AC11 |
| Soft-deleted group still grants | SQL whereNull(deleted_at); C7 |
| Organisation bleed | Team id in the cache key; switchTo() clears; C29 |
| Super-admin overriding a Policy | Step 3 abstains when a Policy exists; AC3 |
| 2FA skipped | API actors exempt but get no Gate pass; exempt list minimal; AC10 |
| Missing binding failing open | Boot check; AC12 |
| Domain logic leaking into the package | Arch test against App\; no domain hook |
| A deleted user keeping a principal, or erasure leaving a principal behind | principals.user_id is ON DELETE RESTRICT, so the database refuses any hard delete of a user with principals; eraseUser() erases, unlinks and deletes the user in one transaction; UserDeletionGuard turns an Eloquent hard delete into UserHasPrincipalsException (a soft delete keeps the row and passes) |
| A principal owned across organisations, or a deactivated owner still counting | Owners must be active and in the same organisation; isActive() walks the owner chain uncached and counts a chain longer than eight (a cycle included) as inactive; deactivation cascades to every owned principal in one transaction and PrincipalDeactivated fires after commit |
| Two principals for one membership, two instance principals of one type, or an organisation-less member | Membership unique index on every engine (P1); with access.principals.organisation_required, the instance singleton index and the organisation CHECK (triggers on SQLite, P2, P3); race-safe forMember() and instance() |
| Principals config drifting from the schema | Testing\AssertsPrincipalsSchema proves the refusals on the product's migrated database; P9 |
| Supply chain | Pinned Actions, composer audit, no lockfile, weekly grouped Dependabot updates into develop (Composer and Actions) |
Development
composer update composer test # Pest composer lint # Pint composer analyse # PHPStan level max
Mutation targets (design §11) run per class at MSI ≥ 95 via
scripts/mutate-per-class.sh in CI. Real-HTTP middleware tests use php -S
(no shell wrapper; torn down in tearDown).
License
MIT. See LICENSE.