check-scopes
commandThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
check-scopes
Validates that the DB enumapi_key_scope contains every<resource>:<action> derived fromcoderd/rbac/policy/RBACPermissions.
- Exits 0 when all scopes are present in
coderd/database/dump.sql. - Exits 1 and prints missing values with suggested
ALTER TYPEstatements otherwise.
Usage
Ensure the schema dump is up-to-date, then run the check:
make -B gen/db # forces DB dump regenerationmake lint/check-scopesOr directly:
go run ./tools/check-scopesOptional flags:
-dump path— override path todump.sql(defaultcoderd/database/dump.sql).
Remediation
When the tool reports missing values:
Create a DB migration extending the enum, e.g.:
ALTER TYPE api_key_scope ADD VALUE IF NOT EXISTS 'template:view_insights';Regenerate and re-run:
make -B gen/db && make lint/check-scopesDecide whether each new scope is public (exposed in the catalog) or internal-only.
- If public, add it to the curated map in
coderd/rbac/scopes_catalog.go(externalLowLevel) so it appears in the public catalog and can be requested by users.
- If public, add it to the curated map in
Documentation¶
There is no documentation for this package.