Awesome Reviewers

Reviewer · Security

Centralize authorization checks

Authorization and capability checks must use the shared capabilities/permissions services rather than ad-hoc API calls, so behavior stays consistent across the app. Fetch capabilities on-demand (e.g., when a component renders or an action is attempted) instead of caching them once at login, since policies can change mid-session and stale state could...

Instruction

Authorization and capability checks must use the shared capabilities/permissions services rather than ad-hoc API calls, so behavior stays consistent across the app. Fetch capabilities on-demand (e.g., when a component renders or an action is attempted) instead of caching them once at login, since policies can change mid-session and stale state could incorrectly gate or expose actions. Explicitly decide and document the fail behavior for capability checks: prefer fail-open (default to allowed) for low-risk UI affordances to avoid blocking legitimate actions on a failed network call, but ensure any security-sensitive gating (e.g., hiding nav links/routes a user shouldn’t see) is enforced through the permissions helper and its route map, not left as a one-off check. When adding new protected routes or actions, update the centralized permissions map/helper so all gating logic flows through one audited path.

Example pattern:

// Use the shared capabilities service instead of a custom ajax call
async fetchRenewCapability() {
  try {
    const capability = await this.capabilities.fetchPathCapabilities('auth/token/renew-self');
    this.canRenewSelf = capability.canUpdate;
  } catch (e) {
    // fail-open for non-critical UI affordances
    this.canRenewSelf = true;
  }
}

</description> </invoke>