Skip to content

Fix: AUTHORIZED_ACCESS is now returned as a privilege - #755

Merged
Gcolon021 merged 1 commit into
mainfrom
fix/authorized-access-privilege-on-login
Sep 1, 2026
Merged

Fix: AUTHORIZED_ACCESS is now returned as a privilege#755
Gcolon021 merged 1 commit into
mainfrom
fix/authorized-access-privilege-on-login

Conversation

@Gcolon021

Copy link
Copy Markdown
Contributor

No description provided.

@Gcolon021 Gcolon021 changed the title fix: read AUTHORIZED_ACCESS from PSAMA instead of inferring it Fix: AUTHORIZED_ACCESS is now returned as a privilege Sep 1, 2026
@Gcolon021 Gcolon021 self-assigned this Sep 1, 2026
@Gcolon021 Gcolon021 added bug Something isn't working enhancement New feature or request and removed enhancement New feature or request labels Sep 1, 2026
@dbmi-svc-checkmarx

dbmi-svc-checkmarx commented Sep 1, 2026

Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details3da3067b-7b12-4ccc-a5a2-56dfe0ebabac

Great job! No new security vulnerabilities introduced in this pull request


Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

@Gcolon021
Gcolon021 force-pushed the fix/authorized-access-privilege-on-login branch 3 times, most recently from 587fa74 to 820bd22 Compare September 1, 2026 15:58
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 2058d991-85e8-4212-a723-43ecf960dfc1


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JamesPeck

Copy link
Copy Markdown
Collaborator

Can you add some tests for the actual auth guards, not just nav? I get its not exactly your fault there are no tests but I think we probably should have some. analyze/+layout.ts:16 has no test at all, and in layout.test.ts the (authorized) guard only ever passes through the PIC_SURE_ANY_QUERY arm. The success case uses QUERY, the redirect case uses [] which fails both arms, so if the AUTHORIZED_ACCESS value were wrong that suite stays green.

One case with privileges: ['AUTHORIZED_ACCESS'] asserting no redirect would be fine. Not a blocker.

getUser pushed a synthetic AUTHORIZED_ACCESS onto the privilege list whenever
/user/me returned any name containing PRIV_MANAGED_. PSAMA stopped minting
per-study privileges when study authorization moved to user_consents, so the
substring never matched for users created since, and the explorer and analysis
routes disappeared for them while older accounts kept working off stale rows.

The name now arrives for real: the auth migration hangs AUTHORIZED_ACCESS off
MANUAL_ROLE_AUTH_ACCESS, which every authenticated user already holds. Drop the
inference and the PRIV_MANAGED prefix it relied on.

Cover the four route guards, each OR of two privilege names, with one case per
arm. Testing a single arm cannot detect the other holding a name PSAMA does not
send, which is how this shipped: the authorized guard was only ever reached
through PIC_SURE_ANY_QUERY, its negative case passed [] and so failed both arms
at once, and the analyze, dataset and admin guards had no tests at all. The
authorized layout test also mocked the privilege enum with invented values
(PRIV_QUERY, PRIV_AUTHORIZED_ACCESS), supplying both the name the code checks
and the name the fixture provides; it now uses the real enum.

test:vitest filtered to tests/unit and tests/component, so nothing under
src/routes ran in CI, including the only existing guard test. Add src/routes.

Deploy after the migration has run. Until then no user receives the name and
the routes stay hidden for everyone rather than just for new accounts.
@Gcolon021
Gcolon021 force-pushed the fix/authorized-access-privilege-on-login branch from 820bd22 to d763bcc Compare September 1, 2026 18:06
@Gcolon021
Gcolon021 merged commit b05ee06 into main Sep 1, 2026
13 checks passed
@Gcolon021
Gcolon021 deleted the fix/authorized-access-privilege-on-login branch September 1, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants