PermDock
CLI

scan

List the authorization checks in an existing app that do not go through PermDock - role comparisons, hasRole and hasPermission helpers, CASL abilities, Clerk has() and role claims - as the work left before PermDock decides on its own.

permdock scan reads the source files and lists each line that looks like an authorization check written without PermDock. It runs nothing and changes nothing; a finding is a place to look, not a verdict. Lines that mention permdock are skipped.

permdock scan
permdock scan --src app,lib
permdock scan --pattern "featureFlag\(" --pattern "isBeta"
permdock scan --json
FlagMeaning
--src <dirs>Directories to read, comma-separated; default collect.srcPath, else src
--pattern <regex>An extra regular expression, matched per line and reported as custom, repeatable
KindMatches
role comparisonuser.role === "admin", role !== 'owner'
roles.includesroles.includes(…), role.has(…)
isAdmin flagisAdmin, isOwner, isSuperUser, isStaff
hasRole / hasPermissionhasRole(…), checkPermission(…), requireAccess(…)
CASL abilityability.can(…), ability.cannot(…)
Clerk has()has({ role: … }), has({ permission: … })
JWT role claimclaims["role"], token["user_role"]

With --json, data is [{ file, line, kind, text }]. Move each check to a permission, then run both side by side with shadowMode before enforcing.

Side effects

What each command may change; side effects explains each one.

CommandSide effects
permdock scanNone

Last updated on

On this page