You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement configurable identifiers for access control #142
Access control uses the default function generate_id for creating identifiers for new objects. We need to support configurable parameters for the same. Currently, we are using the default support that foca provides. We need to add parameters as a part of AccessControlConfig in order to give user more accessibility.
Updated the priority: app devs probably don't care too much what the permission resources are called like, and actual users will likely never have to see/deal with them. And IF app devs really want to enforce other naming for the resources (when using the default API and controllers), they can do so via the PUT /permissions/{id} endpoint.
Since #268, generate_id(charset, length) uses secrets.choice and takes plain arguments, so this is now small. We would:
Add security.access_control.id_charset (default: ASCII letters and digits) and id_length (default 6, range 4 to 64), validated in AccessControlConfig, and pass them to generate_id in Adapter.save_policy_line.
Add a unique index on id in the policy collection and retry with a new ID on a duplicate key error (a few attempts), so collisions cannot overwrite rules.
Validate IDs supplied via PUT /permissions/{id} against the same charset and length (400 otherwise).
Acceptance criteria
Config fields with validation and docs.
Tests: generated IDs follow the configured charset/length; duplicate key triggers a retry; invalid PUT IDs yield 400.
Breaking changes PUT /permissions/{id} rejects IDs that do not match the configured charset/length; check existing custom IDs before upgrading.
Activity
uniqueg commentedon Sep 2, 2022
Updated the priority: app devs probably don't care too much what the permission resources are called like, and actual users will likely never have to see/deal with them. And IF app devs really want to enforce other naming for the resources (when using the default API and controllers), they can do so via the
PUT /permissions/{id}endpoint.kushagra189 commentedon Nov 9, 2022
#157
uniqueg commentedon Oct 18, 2026
Refined proposal
Since #268,
generate_id(charset, length)usessecrets.choiceand takes plain arguments, so this is now small. We would:security.access_control.id_charset(default: ASCII letters and digits) andid_length(default 6, range 4 to 64), validated inAccessControlConfig, and pass them togenerate_idinAdapter.save_policy_line.idin the policy collection and retry with a new ID on a duplicate key error (a few attempts), so collisions cannot overwrite rules.PUT /permissions/{id}against the same charset and length (400 otherwise).Acceptance criteria
PUTIDs yield 400.Breaking changes
PUT /permissions/{id}rejects IDs that do not match the configured charset/length; check existing custom IDs before upgrading.Planned PR
4 (
refactor(access-control): tidy permissions API).