Skip to content

feat(config-service): split /config/pre-login from authenticated endpoints - #5305

Merged
Yicong-Huang merged 2 commits into
apache:mainfrom
Yicong-Huang:feat/config-pre-login
Jun 1, 2026
Merged

Yicong-Huang merged 2 commits into
apache:mainfrom
Yicong-Huang:feat/config-pre-login

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

config-service no longer broadcasts the full GUI configuration to anonymous callers. The four fields the frontend actually needs before login (localLogin, googleLogin, defaultLocalUser, attributionEnabled) move to a new GET /api/config/pre-login (@PermitAll). GET /api/config/gui and GET /api/config/user-system are now @RolesAllowed("REGULAR", "ADMIN") and only answer authenticated traffic.

On the frontend, GuiConfigService.load() always fetches /config/pre-login at APP_INITIALIZER. When a JWT is already in localStorage (browser reload while logged in), it chains /config/gui + /config/user-system in the same await so the full config is in memory before any post-login component mounts. UserService.handleAccessToken does the same chaining on a fresh login so loginWithExistingToken (which reads config.env.inviteOnly) runs only after the authenticated config has resolved. Expired-token 403s on the post-login fetch are caught so a stale localStorage token cannot block bootstrap — that was the exact failure mode that caused #5025 to revert the earlier eager-401 lockdown.

Any related issues, documentation, discussions?

Closes #5304.

Related: #4901 (eager-401 from JwtAuthFilter), #5025 (revert that broke ConfigService bootstrap last time we attempted a similar lockdown), #5199 (re-applied @RolesAllowed enforcement on the microservices, with @PermitAll opt-out for the two pre-login endpoints).

How was this PR tested?

Added unit tests covering pre-login / gui / user-system access with and without a valid Bearer token, the orchestrator's branching on a stored token, the 403 fallback, and the UserService.handleAccessToken ordering guarantee.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

@github-actions github-actions Bot added feature frontend Changes related to the frontend GUI platform Non-amber Scala service paths labels Jun 1, 2026
@codecov-commenter

codecov-commenter commented Jun 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.92%. Comparing base (a8afdc4) to head (0a2acc4).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5305      +/-   ##
============================================
+ Coverage     49.86%   49.92%   +0.05%     
- Complexity     2415     2416       +1     
============================================
  Files          1052     1052              
  Lines         40764    40780      +16     
  Branches       4355     4356       +1     
============================================
+ Hits          20327    20358      +31     
+ Misses        19224    19210      -14     
+ Partials       1213     1212       -1     
Flag Coverage Δ *Carryforward flag
access-control-service 41.89% <ø> (ø)
agent-service 33.76% <ø> (ø) Carriedforward from 1406d8a
amber 51.97% <ø> (ø) Carriedforward from 1406d8a
computing-unit-managing-service 1.38% <ø> (ø)
config-service 54.68% <100.00%> (+0.71%) ⬆️
file-service 38.42% <ø> (ø)
frontend 42.37% <100.00%> (+0.14%) ⬆️
python 90.80% <ø> (ø) Carriedforward from 1406d8a
workflow-compiling-service 58.39% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang

Copy link
Copy Markdown
Contributor Author

/request-review @bobbai00

cc @Ma77Ball

@Yicong-Huang
Yicong-Huang requested a review from bobbai00 June 1, 2026 05:03

@bobbai00 bobbai00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, works great. LGTM

@Yicong-Huang
Yicong-Huang added this pull request to the merge queue Jun 1, 2026
Merged via the queue into apache:main with commit eb287f3 Jun 1, 2026
35 of 37 checks passed
@Yicong-Huang
Yicong-Huang deleted the feat/config-pre-login branch June 1, 2026 07:34
aicam added a commit to aicam/texera that referenced this pull request Jun 8, 2026
…sers can read inviteOnly

A freshly-registered user is INACTIVE until an admin approves them and
therefore cannot reach the @RolesAllowed("REGULAR", "ADMIN") config
endpoints. The frontend reads the `inviteOnly` flag at exactly that point
to decide whether to show the registration-request form (and notify
admins). Since apache#5305 moved /config/user-system behind a role check, the
flag became unreachable for the very users it targets, so the form never
appeared and no admin notification was sent.

Restore @permitAll on /config/user-system. It only exposes the boolean
inviteOnly flag, which is non-sensitive and already needed pre-activation.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
aicam added a commit to aicam/texera that referenced this pull request Jun 10, 2026
A freshly-registered user is INACTIVE and cannot reach the @RolesAllowed
config endpoints, yet the frontend reads inviteOnly right after registration to
decide whether to show the registration-request form (and notify admins).
apache#5305 moved inviteOnly to /config/user-system (@RolesAllowed), making it
unreachable for exactly those users. Expose the flag on the already-public
@permitAll /config/pre-login instead, without widening any authenticated
endpoint.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Yicong-Huang pushed a commit that referenced this pull request Jun 10, 2026
…VE users see the registration-request form (#5572)

### What changes were proposed in this PR?

#5305 moved `GET /config/user-system` from `@PermitAll` to
`@RolesAllowed("REGULAR", "ADMIN")`. A freshly-registered user is
`INACTIVE`
until admin approval, so they cannot reach `@RolesAllowed` endpoints —
the
request returns 403/401, `inviteOnly` is left undefined on the frontend,
the
registration-request form never appears, and no admin notification email
is
sent. In invite-only deployments, new sign-ups are silently dropped.

Per review feedback (@Yicong-Huang), instead of re-opening the whole
`/config/user-system` endpoint with `@PermitAll`, this PR exposes only
the
`inviteOnly` boolean on the already-public `/config/pre-login` and keeps
`/config/user-system` `@RolesAllowed`. The frontend already loads
`/config/pre-login` anonymously during APP_INITIALIZER, so `inviteOnly`
is now
available before activation without widening the authenticated surface.

<!-- BEFORE & AFTER screenshots to be added. -->

### Any related issues, documentation, discussions?

Resolves #5587

### How was this PR tested?

- Updated `ConfigResourceAuthSpec`: `/config/pre-login` exposes exactly
`{localLogin, googleLogin, defaultLocalUser, attributionEnabled,
inviteOnly}`
anonymously; `/config/user-system` returns 401 + `Bearer` challenge
without a
token and 200 with a valid Bearer token. `sbt ConfigService/test` → 9
passed.
- Verified live on an invite-only deployment: a fresh INACTIVE
registration
reads `inviteOnly: true` from `/config/pre-login`, the
registration-request
  form appears, and the admin notification email is sent, while
  `/config/user-system` still returns 403/401 to anonymous callers.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

---------

(backported from commit 17607c5)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
SarahAsad23 pushed a commit to SarahAsad23/texera that referenced this pull request Jun 10, 2026
…VE users see the registration-request form (apache#5572)

### What changes were proposed in this PR?

apache#5305 moved `GET /config/user-system` from `@PermitAll` to
`@RolesAllowed("REGULAR", "ADMIN")`. A freshly-registered user is
`INACTIVE`
until admin approval, so they cannot reach `@RolesAllowed` endpoints —
the
request returns 403/401, `inviteOnly` is left undefined on the frontend,
the
registration-request form never appears, and no admin notification email
is
sent. In invite-only deployments, new sign-ups are silently dropped.

Per review feedback (@Yicong-Huang), instead of re-opening the whole
`/config/user-system` endpoint with `@PermitAll`, this PR exposes only
the
`inviteOnly` boolean on the already-public `/config/pre-login` and keeps
`/config/user-system` `@RolesAllowed`. The frontend already loads
`/config/pre-login` anonymously during APP_INITIALIZER, so `inviteOnly`
is now
available before activation without widening the authenticated surface.

<!-- BEFORE & AFTER screenshots to be added. -->

### Any related issues, documentation, discussions?

Resolves apache#5587

### How was this PR tested?

- Updated `ConfigResourceAuthSpec`: `/config/pre-login` exposes exactly
`{localLogin, googleLogin, defaultLocalUser, attributionEnabled,
inviteOnly}`
anonymously; `/config/user-system` returns 401 + `Bearer` challenge
without a
token and 200 with a valid Bearer token. `sbt ConfigService/test` → 9
passed.
- Verified live on an invite-only deployment: a fresh INACTIVE
registration
reads `inviteOnly: true` from `/config/pre-login`, the
registration-request
  form appears, and the admin notification email is sent, while
  `/config/user-system` still returns 403/401 to anonymous callers.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
ELin2025 pushed a commit to ELin2025/texera that referenced this pull request Jun 16, 2026
…VE users see the registration-request form (apache#5572)

### What changes were proposed in this PR?

apache#5305 moved `GET /config/user-system` from `@PermitAll` to
`@RolesAllowed("REGULAR", "ADMIN")`. A freshly-registered user is
`INACTIVE`
until admin approval, so they cannot reach `@RolesAllowed` endpoints —
the
request returns 403/401, `inviteOnly` is left undefined on the frontend,
the
registration-request form never appears, and no admin notification email
is
sent. In invite-only deployments, new sign-ups are silently dropped.

Per review feedback (@Yicong-Huang), instead of re-opening the whole
`/config/user-system` endpoint with `@PermitAll`, this PR exposes only
the
`inviteOnly` boolean on the already-public `/config/pre-login` and keeps
`/config/user-system` `@RolesAllowed`. The frontend already loads
`/config/pre-login` anonymously during APP_INITIALIZER, so `inviteOnly`
is now
available before activation without widening the authenticated surface.

<!-- BEFORE & AFTER screenshots to be added. -->

### Any related issues, documentation, discussions?

Resolves apache#5587

### How was this PR tested?

- Updated `ConfigResourceAuthSpec`: `/config/pre-login` exposes exactly
`{localLogin, googleLogin, defaultLocalUser, attributionEnabled,
inviteOnly}`
anonymously; `/config/user-system` returns 401 + `Bearer` challenge
without a
token and 200 with a valid Bearer token. `sbt ConfigService/test` → 9
passed.
- Verified live on an invite-only deployment: a fresh INACTIVE
registration
reads `inviteOnly: true` from `/config/pre-login`, the
registration-request
  form appears, and the admin notification email is sent, while
  `/config/user-system` still returns 403/401 to anonymous callers.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…oints (apache#5305)

### What changes were proposed in this PR?

`config-service` no longer broadcasts the full GUI configuration to
anonymous callers. The four fields the frontend actually needs before
login (`localLogin`, `googleLogin`, `defaultLocalUser`,
`attributionEnabled`) move to a new `GET /api/config/pre-login`
(`@PermitAll`). `GET /api/config/gui` and `GET /api/config/user-system`
are now `@RolesAllowed("REGULAR", "ADMIN")` and only answer
authenticated traffic.

On the frontend, `GuiConfigService.load()` always fetches
`/config/pre-login` at `APP_INITIALIZER`. When a JWT is already in
`localStorage` (browser reload while logged in), it chains `/config/gui`
+ `/config/user-system` in the same await so the full config is in
memory before any post-login component mounts.
`UserService.handleAccessToken` does the same chaining on a fresh login
so `loginWithExistingToken` (which reads `config.env.inviteOnly`) runs
only after the authenticated config has resolved. Expired-token 403s on
the post-login fetch are caught so a stale `localStorage` token cannot
block bootstrap — that was the exact failure mode that caused apache#5025 to
revert the earlier eager-401 lockdown.

### Any related issues, documentation, discussions?

Closes apache#5304.

Related: apache#4901 (eager-401 from `JwtAuthFilter`), apache#5025 (revert that
broke `ConfigService` bootstrap last time we attempted a similar
lockdown), apache#5199 (re-applied `@RolesAllowed` enforcement on the
microservices, with `@PermitAll` opt-out for the two pre-login
endpoints).

### How was this PR tested?

Added unit tests covering pre-login / gui / user-system access with and
without a valid Bearer token, the orchestrator's branching on a stored
token, the 403 fallback, and the `UserService.handleAccessToken`
ordering guarantee.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…VE users see the registration-request form (apache#5572)

### What changes were proposed in this PR?

apache#5305 moved `GET /config/user-system` from `@PermitAll` to
`@RolesAllowed("REGULAR", "ADMIN")`. A freshly-registered user is
`INACTIVE`
until admin approval, so they cannot reach `@RolesAllowed` endpoints —
the
request returns 403/401, `inviteOnly` is left undefined on the frontend,
the
registration-request form never appears, and no admin notification email
is
sent. In invite-only deployments, new sign-ups are silently dropped.

Per review feedback (@Yicong-Huang), instead of re-opening the whole
`/config/user-system` endpoint with `@PermitAll`, this PR exposes only
the
`inviteOnly` boolean on the already-public `/config/pre-login` and keeps
`/config/user-system` `@RolesAllowed`. The frontend already loads
`/config/pre-login` anonymously during APP_INITIALIZER, so `inviteOnly`
is now
available before activation without widening the authenticated surface.

<!-- BEFORE & AFTER screenshots to be added. -->

### Any related issues, documentation, discussions?

Resolves apache#5587

### How was this PR tested?

- Updated `ConfigResourceAuthSpec`: `/config/pre-login` exposes exactly
`{localLogin, googleLogin, defaultLocalUser, attributionEnabled,
inviteOnly}`
anonymously; `/config/user-system` returns 401 + `Bearer` challenge
without a
token and 200 with a valid Bearer token. `sbt ConfigService/test` → 9
passed.
- Verified live on an invite-only deployment: a fresh INACTIVE
registration
reads `inviteOnly: true` from `/config/pre-login`, the
registration-request
  form appears, and the admin notification email is sent, while
  `/config/user-system` still returns 403/401 to anonymous callers.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature frontend Changes related to the frontend GUI platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gate config-service endpoints behind authentication and split out a small pre-login endpoint

3 participants