Skip to content

fix(oidc-client): always pass prompt=none on background authorize calls - #748

Open
ryanbas21 wants to merge 4 commits into
mainfrom
fix/oidc-client-prompt-none-background
Open

fix(oidc-client): always pass prompt=none on background authorize calls#748
ryanbas21 wants to merge 4 commits into
mainfrom
fix/oidc-client-prompt-none-background

Conversation

@ryanbas21

@ryanbas21 ryanbas21 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Background authorize flows (both standard and PAR) must include prompt=none so the authorization server does not prompt the user for interaction during silent/background token acquisition.

Bug

The standard authorize flow already enforced prompt=none inside createAuthorizeUrlµ (hardcoded). The PAR flow did not — createParAuthorizeUrlµ passed prompt from the caller's options, which meant any background PAR call without an explicit prompt option would silently omit the required parameter.

Fix

In background() (client.store.ts), merge prompt: 'none' into options before delegating to authorizeµ. This is the correct enforcement point: it covers both flow paths (standard and PAR) and mirrors how the OIDC spec expects silent authentication to work.

const bgOptions = options !== undefined ? { ...options, prompt: 'none' as const } : undefined;
const result = await Micro.runPromiseExit(
  authorizeµ(wellknown, config, log, store, bgOptions, useParFlow),
);

Tests

  • Updated existing PAR background test to assert prompt=none in the PAR POST body
  • Added new test: background() always includes prompt=none even when options omit it (covers both PAR-enabled and standard flow paths)

Summary by CodeRabbit

  • Bug Fixes

    • Background authorization requests now consistently include prompt=none for standard and PAR flows.
    • Existing authorization options are preserved while enforcing background request behavior.
  • Tests

    • Added coverage for background authorization with and without supplied options.
    • Added verification that PAR request bodies include the expected prompt value.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Background authorization now enforces prompt=none for standard and PAR flows. Authorization URL creation preserves supplied options. Tests verify the prompt in both flows, and a patch changeset documents the update.

Changes

Background authorization

Layer / File(s) Summary
Enforce background prompt
packages/oidc-client/src/lib/client.store.ts, packages/oidc-client/src/lib/authorize.request.micros.ts, .changeset/oidc-prompt-none-background.md
authorize.background adds prompt=none before authorization. URL creation preserves supplied options. The changeset records the patch release.
Validate standard and PAR flows
packages/oidc-client/src/lib/client.store.test.ts
Tests capture the PAR request body and verify prompt=none for PAR and standard background authorization flows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enforcing prompt=none for background authorization calls.
Description check ✅ Passed The description explains the bug, fix, affected flows, and tests; the optional JIRA Ticket section is not applicable or required.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/oidc-client-prompt-none-background

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.

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9bd12a5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@forgerock/oidc-client Patch
@forgerock/davinci-client Patch
@forgerock/device-client Patch
@forgerock/journey-client Patch
@forgerock/protect Patch
@forgerock/sdk-types Patch
@forgerock/sdk-utilities Patch
@forgerock/iframe-manager Patch
@forgerock/sdk-logger Patch
@forgerock/sdk-oidc Patch
@forgerock/sdk-request-middleware Patch
@forgerock/storage Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nx-cloud

nx-cloud Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 9bd12a5

Command Status Duration Result
nx affected -t build lint test typecheck e2e-ci ❌ Failed 6m 34s View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-08-06 23:25:30 UTC

@ryanbas21
ryanbas21 force-pushed the fix/oidc-client-prompt-none-background branch from 15f8987 to 6f3c67f Compare August 5, 2026 22:34
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.80460% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.64%. Comparing base (eafe277) to head (15f8987).
⚠️ Report is 54 commits behind head on main.

⚠️ Current head 15f8987 differs from pull request most recent head 6f3c67f

Please upload reports for the commit 6f3c67f to get more accurate results.

Files with missing lines Patch % Lines
...kages/davinci-client/src/lib/client.store.utils.ts 90.47% 2 Missing ⚠️
...kages/journey-client/src/lib/client.store.utils.ts 89.47% 2 Missing ⚠️
...ges/sdk-effects/wellknown/src/lib/wellknown.api.ts 0.00% 2 Missing ⚠️
packages/sdk-effects/wellknown/src/index.ts 50.00% 1 Missing ⚠️
packages/sdk-types/src/index.ts 0.00% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (23.64%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #748      +/-   ##
==========================================
+ Coverage   18.07%   23.64%   +5.57%     
==========================================
  Files         155      162       +7     
  Lines       24398    25716    +1318     
  Branches     1203     1660     +457     
==========================================
+ Hits         4410     6081    +1671     
+ Misses      19988    19635     -353     
Files with missing lines Coverage Δ
...ges/davinci-client/src/lib/client.store.effects.ts 49.73% <ø> (ø)
packages/davinci-client/src/lib/client.store.ts 26.15% <100.00%> (+25.87%) ⬆️
packages/journey-client/src/lib/client.store.ts 83.85% <100.00%> (+3.34%) ⬆️
packages/oidc-client/src/lib/client.store.ts 46.63% <100.00%> (+18.92%) ⬆️
packages/oidc-client/src/lib/client.store.utils.ts 65.11% <100.00%> (+4.07%) ⬆️
packages/sdk-types/src/lib/store.types.ts 100.00% <100.00%> (ø)
packages/sdk-effects/wellknown/src/index.ts 50.00% <50.00%> (ø)
packages/sdk-types/src/index.ts 8.33% <0.00%> (-0.76%) ⬇️
...kages/davinci-client/src/lib/client.store.utils.ts 66.66% <90.47%> (+42.93%) ⬆️
...kages/journey-client/src/lib/client.store.utils.ts 94.87% <89.47%> (-5.13%) ⬇️
... and 1 more

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/davinci-client@748

@forgerock/device-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/device-client@748

@forgerock/journey-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/journey-client@748

@forgerock/oidc-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/oidc-client@748

@forgerock/protect

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/protect@748

@forgerock/sdk-types

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-types@748

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-utilities@748

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/iframe-manager@748

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-logger@748

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-oidc@748

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-request-middleware@748

@forgerock/storage

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/storage@748

@forgerock/sdk-wellknown

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-wellknown@748

commit: 15f8987

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/oidc-client/src/lib/client.store.ts`:
- Around line 210-213: Update the background authorization flow around
authorizeµ so bgOptions is always an options object containing prompt: 'none',
while preserving any caller-provided options. Add regression coverage for
authorize.background() without arguments in both PAR and standard authorization
flows.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 40de47a1-7d61-4cc0-a5d3-e6ac03c6c004

📥 Commits

Reviewing files that changed from the base of the PR and between d65f42a and 62c0df5.

📒 Files selected for processing (3)
  • .changeset/oidc-prompt-none-background.md
  • packages/oidc-client/src/lib/client.store.test.ts
  • packages/oidc-client/src/lib/client.store.ts

Comment thread packages/oidc-client/src/lib/client.store.ts Outdated
Comment thread packages/oidc-client/src/lib/client.store.ts Outdated
options !== undefined ? { ...options, prompt: 'none' as const } : undefined;
const result = await Micro.runPromiseExit(
authorizeµ(wellknown, config, log, store, options, useParFlow),
authorizeµ(wellknown, config, log, store, bgOptions, useParFlow),

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.

Can we simplify the code to authorizeµ(wellknown, config, log, store, { ...options, prompt: 'none'}, useParFlow), instead of creating a new bgOptions variable?

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/oidc-client/src/lib/client.store.test.ts (1)

689-773: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Test caller-provided prompt precedence.

Add PAR and standard-flow cases that call background({ prompt: 'login' }). Assert that each outbound request still contains prompt=none. A reversed merge order would pass the current tests because they only omit prompt.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/oidc-client/src/lib/client.store.test.ts` around lines 689 - 773,
The authorize.background() enforcement test only covers omitted prompts; extend
it with PAR and standard-flow calls that provide prompt: 'login', then assert
each outbound request still sends prompt=none. Update the existing test around
authorize.background() and its captured PAR and authorize request assertions,
preserving the current omission cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/oidc-client/src/lib/client.store.test.ts`:
- Around line 689-773: The authorize.background() enforcement test only covers
omitted prompts; extend it with PAR and standard-flow calls that provide prompt:
'login', then assert each outbound request still sends prompt=none. Update the
existing test around authorize.background() and its captured PAR and authorize
request assertions, preserving the current omission cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 02c52d78-d137-410b-b577-493fc4edaa23

📥 Commits

Reviewing files that changed from the base of the PR and between 62c0df5 and b361bfe.

📒 Files selected for processing (2)
  • packages/oidc-client/src/lib/client.store.test.ts
  • packages/oidc-client/src/lib/client.store.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/oidc-client/src/lib/client.store.ts

nx-cloud[bot]

This comment was marked as outdated.

@ryanbas21
ryanbas21 force-pushed the fix/oidc-client-prompt-none-background branch from b361bfe to 08edab1 Compare August 6, 2026 12:12
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@nx-cloud nx-cloud Bot 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.

Nx Cloud has identified a possible root cause for your failed CI:

We classified this failure as an environment issue rather than a code regression. The failing test exercises the interactive PAR redirect login flow, which is unrelated to the background() changes introduced by this PR. The external ForgeBlocks auth server successfully received the PAR request but did not redirect back within the timeout, indicating an external service dependency failure.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

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.

I think we need to enforce prompt: 'none' in the authorizeOptions here as well.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/oidc-client/src/lib/client.store.ts (1)

210-212: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

background() no longer forces prompt=none.

Line 211 passes options straight to authorizeµ. The PR objectives state that background() must merge prompt: 'none' into the options for both the standard and the PAR flow. Without prompt=none, the authorization server can return an interactive login page for the hidden background request. The call then hangs or fails instead of returning login_required. Reviewers raised this point on earlier commits.

🐛 Proposed fix
         const result = await Micro.runPromiseExit(
-          authorizeµ(wellknown, config, log, store, options, useParFlow),
+          authorizeµ(wellknown, config, log, store, { ...options, prompt: 'none' }, useParFlow),
         );

Run the following script to check the related tests and the authorizeµ option handling:

#!/bin/bash
# Find prompt=none expectations in oidc-client tests and the authorizeµ option path.
rg -n -C4 "prompt" --glob 'packages/oidc-client/src/**' -g '*.ts'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/oidc-client/src/lib/client.store.ts` around lines 210 - 212, Update
background() at the authorizeµ invocation to merge prompt: 'none' into the
options before passing them to Micro.runPromiseExit, preserving all existing
options. Ensure this merged option is used for both standard and PAR
authorization flows.
🧹 Nitpick comments (3)
e2e/oidc-suites/src/par.spec.ts (1)

90-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Track the server-side defect before keeping this test skipped.

Add an upstream issue reference and a re-enable condition to this TODO. The skip removes end-to-end coverage for the PAR redirect-login and token flow. The existing unit tests only cover client-side PAR URL construction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/oidc-suites/src/par.spec.ts` around lines 90 - 91, Update the skipped
test declaration for “redirect login with PAR enabled (ParClient)” to include a
reference to the tracked upstream server-side issue and an explicit condition or
TODO mechanism for re-enabling it once that defect is fixed, while preserving
the test’s existing end-to-end coverage and assertions.
packages/oidc-client/src/lib/session.micros.test.ts (1)

206-211: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Failure assertions can be skipped in both migrated test files. The migration from it.effect replaced typed failure assertions with a combined guard that returns early when Micro.causeIsFail is false. A defect (Die) cause still satisfies Micro.exitIsFailure, so the error-field assertions never run and the test passes.

  • packages/oidc-client/src/lib/session.micros.test.ts#L206-L211: add expect(Micro.causeIsFail(exit.cause)).toBe(true) before the early return, and apply the same change to every failure case in the file.
  • packages/oidc-client/src/lib/exchange.utils.test.ts#L97-L104: add expect(Micro.causeIsFail(result.cause)).toBe(true) before the early return, and apply the same change at lines 126-133 and 147-154.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/oidc-client/src/lib/session.micros.test.ts` around lines 206 - 211,
Ensure every failure-case assertion in
packages/oidc-client/src/lib/session.micros.test.ts at lines 206-211 and
throughout the file, plus packages/oidc-client/src/lib/exchange.utils.test.ts at
lines 97-104, 126-133, and 147-154, explicitly expects
Micro.causeIsFail(exit.cause/result.cause) to be true before any early return;
retain the existing typed error-field assertions so defect causes cannot
silently pass.
e2e/mock-api-v2/src/services/session.service.ts (1)

16-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the new session contract and failure paths.

Test successful refreshSession calls and assert that the returned SessionData contains the updated expiry. Test missing-session updateSession calls and missing or expired refreshSession calls. Assert the failure messages and removal of expired sessions. The PR coverage report identifies changed lines without coverage.

Also applies to: 68-68, 81-87, 89-94

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/mock-api-v2/src/services/session.service.ts` around lines 16 - 19, Add
regression tests for the session service contract around refreshSession and
updateSession: verify successful refreshSession returns SessionData with the
updated expiry, missing-session updateSession fails with the expected message,
and missing or expired refreshSession calls fail with the expected messages
while removing expired sessions. Cover the changed branches and declarations
associated with refreshSession, updateSession, and expired-session handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/davinci-client/src/lib/client.store.effects.ts`:
- Around line 189-191: Update the completed-challenge branch handling
PollDispatchResult.data to validate status at runtime: accept only string values
matching an allowed PollingStatus member, and return {_tag: 'error'} for
non-string or unsupported statuses. Remove the unchecked cast in this path and
add tests covering both a non-string status and an unsupported string status.

In `@packages/oidc-client/src/lib/authorize.request.micros.ts`:
- Line 122: Update background() in authorize.request.micros.ts to merge prompt:
'none' into the options passed to both PAR and standard authorization flows,
including when called without arguments, while preserving caller-provided
options otherwise. Update the related assertions in client.store.test.ts to
expect prompt=none and revise .changeset/oidc-prompt-none-background.md
accordingly.

---

Outside diff comments:
In `@packages/oidc-client/src/lib/client.store.ts`:
- Around line 210-212: Update background() at the authorizeµ invocation to merge
prompt: 'none' into the options before passing them to Micro.runPromiseExit,
preserving all existing options. Ensure this merged option is used for both
standard and PAR authorization flows.

---

Nitpick comments:
In `@e2e/mock-api-v2/src/services/session.service.ts`:
- Around line 16-19: Add regression tests for the session service contract
around refreshSession and updateSession: verify successful refreshSession
returns SessionData with the updated expiry, missing-session updateSession fails
with the expected message, and missing or expired refreshSession calls fail with
the expected messages while removing expired sessions. Cover the changed
branches and declarations associated with refreshSession, updateSession, and
expired-session handling.

In `@e2e/oidc-suites/src/par.spec.ts`:
- Around line 90-91: Update the skipped test declaration for “redirect login
with PAR enabled (ParClient)” to include a reference to the tracked upstream
server-side issue and an explicit condition or TODO mechanism for re-enabling it
once that defect is fixed, while preserving the test’s existing end-to-end
coverage and assertions.

In `@packages/oidc-client/src/lib/session.micros.test.ts`:
- Around line 206-211: Ensure every failure-case assertion in
packages/oidc-client/src/lib/session.micros.test.ts at lines 206-211 and
throughout the file, plus packages/oidc-client/src/lib/exchange.utils.test.ts at
lines 97-104, 126-133, and 147-154, explicitly expects
Micro.causeIsFail(exit.cause/result.cause) to be true before any early return;
retain the existing typed error-field assertions so defect causes cannot
silently pass.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7757ba1c-b2e9-4b5c-b6e0-c6f5ae65bde6

📥 Commits

Reviewing files that changed from the base of the PR and between 08edab1 and bbafd97.

📒 Files selected for processing (13)
  • .changeset/oidc-prompt-none-background.md
  • e2e/mock-api-v2/src/services/mock-env-helpers/index.ts
  • e2e/mock-api-v2/src/services/session.service.ts
  • e2e/oidc-suites/src/par.spec.ts
  • packages/davinci-client/src/lib/client.store.effects.test.ts
  • packages/davinci-client/src/lib/client.store.effects.ts
  • packages/oidc-client/src/lib/authorize.request.micros.test.ts
  • packages/oidc-client/src/lib/authorize.request.micros.ts
  • packages/oidc-client/src/lib/authorize.request.utils.test.ts
  • packages/oidc-client/src/lib/client.store.test.ts
  • packages/oidc-client/src/lib/client.store.ts
  • packages/oidc-client/src/lib/exchange.utils.test.ts
  • packages/oidc-client/src/lib/session.micros.test.ts

Comment on lines +189 to +191
if (data['isChallengeComplete'] === true) {
const pollStatus = data['status'];
return pollStatus ? (pollStatus as PollingStatus) : 'error';
const status = data['status'];
return status ? { _tag: 'complete', status: status as PollingStatus } : { _tag: 'error' };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Validate the completed challenge status at runtime.

PollDispatchResult.data is unknown. The truthiness check accepts any non-empty value and casts it to PollingStatus. A response with an unsupported status stops polling and returns an invalid terminal status.

Validate the status type and allowed PollingStatus values. Classify invalid values as error. Add tests for a non-string status and an unsupported string status.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/davinci-client/src/lib/client.store.effects.ts` around lines 189 -
191, Update the completed-challenge branch handling PollDispatchResult.data to
validate status at runtime: accept only string values matching an allowed
PollingStatus member, and return {_tag: 'error'} for non-string or unsupported
statuses. Remove the unchecked cast in this path and add tests covering both a
non-string status and an unsupported string status.

Comment thread packages/oidc-client/src/lib/authorize.request.micros.ts
Background authorize flows (both standard and PAR) must include
prompt=none so the authorization server does not prompt the user
for interaction. The standard flow already enforced this inside
createAuthorizeUrlµ; the PAR flow was not injecting it, meaning
any background PAR call without an explicit prompt option would
silently omit the required parameter.
@ryanbas21
ryanbas21 force-pushed the fix/oidc-client-prompt-none-background branch from bbafd97 to 485e735 Compare August 6, 2026 20:31
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/oidc-client/src/lib/client.store.ts`:
- Around line 210-213: Update the background authorization flow around
authorizeµ so bgOptions is always an options object containing prompt: 'none',
including when authorize.background() is called without arguments. Preserve any
supplied options while enforcing that prompt value, and add coverage for
no-argument background calls in both PAR and standard flows.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 76024ef7-0c5e-4eeb-a4f5-8124849b2370

📥 Commits

Reviewing files that changed from the base of the PR and between d65f42a and 485e735.

📒 Files selected for processing (4)
  • .changeset/oidc-prompt-none-background.md
  • packages/oidc-client/src/lib/authorize.request.micros.ts
  • packages/oidc-client/src/lib/client.store.test.ts
  • packages/oidc-client/src/lib/client.store.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/oidc-client/src/lib/authorize.request.micros.ts

Comment thread packages/oidc-client/src/lib/client.store.ts Outdated
ryanbas21 added a commit that referenced this pull request Aug 6, 2026
Address PR #748 review comments:
- bgOptions always created as object (never undefined) so prompt=none
  is enforced even when background() is called without arguments
- token.get() background renewal also enforces prompt=none via bgAuthorizeOptions
- add no-argument background() regression tests for both PAR and standard flows
Address PR #748 review comments:
- bgOptions always created as object (never undefined) so prompt=none
  is enforced even when background() is called without arguments
- token.get() background renewal also enforces prompt=none via bgAuthorizeOptions
- add no-argument background() regression tests for both PAR and standard flows
@ryanbas21
ryanbas21 force-pushed the fix/oidc-client-prompt-none-background branch from b4409a2 to 9bd12a5 Compare August 6, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants