Repository navigation
Feat/oauth2 keyclock cicd setup (WIP) - #8554
abhishekp-bruno wants to merge 21 commits into
Conversation
…tate handling logic
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds OAuth2 Playwright E2E coverage for authorization-code and implicit flows, cross-platform Keycloak setup and test actions, reusable OAuth2 fixtures, and Linux, macOS, and Windows workflow jobs. ChangesOAuth2 E2E Test Infrastructure
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Playwright as OAuth2 E2E tests
participant Bruno as Bruno Electron
participant Keycloak
Playwright->>Bruno: Start OAuth2 request
Bruno->>Keycloak: Request authorization with state
Keycloak-->>Playwright: Return code or access token
Playwright->>Bruno: Send callback deep link
Bruno-->>Playwright: Report success or state mismatch
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (10)
.github/actions/auth/oauth2/macos/setup-keycloak/action.yml (2)
55-56: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
$RUNNER_TEMPfor keycloak.log path.The log file path also uses
/tmp— should be$RUNNER_TEMPfor the same consistency reasons.♻️ Proposed fix
- > /tmp/keycloak.log 2>&1 & + > "$RUNNER_TEMP/keycloak.log" 2>&1 &🤖 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 @.github/actions/auth/oauth2/macos/setup-keycloak/action.yml around lines 55 - 56, The Keycloak startup command is writing its log to /tmp instead of the runner temp directory. Update the nohup invocation in setup-keycloak/action.yml to use $RUNNER_TEMP for the kc.sh start-dev output redirection, keeping the logging path consistent with the rest of the action; locate the change in the startup command that launches kc.sh.
46-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
$RUNNER_TEMPinstead of hardcoded/tmp.Same as the Linux action — prefer
$RUNNER_TEMPfor consistency with the Windows action and GitHub Actions conventions.♻️ Proposed fix
- curl -fsSL -o /tmp/keycloak.zip \ + curl -fsSL -o "$RUNNER_TEMP/keycloak.zip" \ "https://github.com/keycloak/keycloak/releases/download/${KEYCLOAK_VERSION}/keycloak-${KEYCLOAK_VERSION}.zip" - unzip -q /tmp/keycloak.zip -d /tmp - KC_HOME="/tmp/keycloak-${KEYCLOAK_VERSION}" + unzip -q "$RUNNER_TEMP/keycloak.zip" -d "$RUNNER_TEMP" + KC_HOME="$RUNNER_TEMP/keycloak-${KEYCLOAK_VERSION}"🤖 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 @.github/actions/auth/oauth2/macos/setup-keycloak/action.yml around lines 46 - 49, The Keycloak setup steps in the macOS action currently write to hardcoded /tmp paths, which should be replaced with $RUNNER_TEMP for consistency with the other actions and GitHub Actions conventions. Update the download, unzip, and KC_HOME assignment in the setup flow so the temporary archive and extracted directory are placed under $RUNNER_TEMP, using the same approach as the Linux and Windows setup logic..github/actions/auth/oauth2/linux/setup-keycloak/action.yml (2)
46-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
$RUNNER_TEMPinstead of hardcoded/tmp.The Windows action correctly uses
$env:RUNNER_TEMP, but Linux and macOS hardcode/tmp. While they typically resolve to the same path on GitHub runners,$RUNNER_TEMPis the documented temp directory and ensures consistency across platforms.♻️ Proposed fix
- curl -fsSL -o /tmp/keycloak.zip \ + curl -fsSL -o "$RUNNER_TEMP/keycloak.zip" \ "https://github.com/keycloak/keycloak/releases/download/${KEYCLOAK_VERSION}/keycloak-${KEYCLOAK_VERSION}.zip" - unzip -q /tmp/keycloak.zip -d /tmp - KC_HOME="/tmp/keycloak-${KEYCLOAK_VERSION}" + unzip -q "$RUNNER_TEMP/keycloak.zip" -d "$RUNNER_TEMP" + KC_HOME="$RUNNER_TEMP/keycloak-${KEYCLOAK_VERSION}"🤖 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 @.github/actions/auth/oauth2/linux/setup-keycloak/action.yml around lines 46 - 49, The Keycloak setup step still hardcodes the temporary directory with /tmp instead of using the runner-provided temp location. Update the Linux/macOS action logic in the Keycloak download/extract flow to use RUNNER_TEMP consistently, matching the Windows setup and keeping the temp zip, unzip target, and KC_HOME construction based on that variable.
37-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffLinux and macOS setup-keycloak actions are identical — consolidate.
This file is byte-for-byte identical to
.github/actions/auth/oauth2/macos/setup-keycloak/action.yml. Any fix or update must be applied to both, risking drift. Consider extracting the shared logic into a common composite action invoked by both platform-specific wrappers.🤖 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 @.github/actions/auth/oauth2/linux/setup-keycloak/action.yml around lines 37 - 68, The Linux setup-keycloak workflow duplicates the macOS version byte-for-byte, so updates must be made in two places and can drift. Extract the shared Keycloak setup logic from the “Download and start Keycloak” step into a common composite action, then have both platform-specific wrappers invoke that shared action. Keep the wrapper-specific files minimal and ensure any future changes to the Keycloak download/start/wait flow happen only in the shared action..github/actions/auth/oauth2/macos/run-oauth2-e2e-tests/action.yml (1)
6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd
set -euo pipefailfor consistency with Linux.The Linux run step includes
set -euo pipefailbut the macOS step does not. Whilenpm runpropagates exit codes, adding it ensures consistent error handling across all platform actions.♻️ Proposed fix
run: | + set -euo pipefail + npm run test:e2e:auth:oauth2🤖 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 @.github/actions/auth/oauth2/macos/run-oauth2-e2e-tests/action.yml around lines 6 - 9, The macOS OAuth2 E2E test step in the action’s run block is missing the same strict shell settings used by the Linux step. Update the Run OAuth2 E2E tests step in the oauth2 macOS action to include set -euo pipefail before npm run test:e2e:auth:oauth2 so error handling matches across platforms and the shell behavior is consistent..github/workflows/tests-linux.yml (1)
157-157: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winSet
persist-credentials: falseon checkout for security hardeningThe
actions/checkout@v6step defaults topersist-credentials: true, leaving the GitHub token in.git/config. Since these jobs only run tests, addpersist-credentials: falseto reduce credential exposure risk. This matches the existing pattern across other jobs, so consider applying it repo-wide.🔒 Suggested fix
steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v6 + with: + persist-credentials: false🤖 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 @.github/workflows/tests-linux.yml at line 157, Add security hardening to the existing actions/checkout@v6 step by setting persist-credentials to false so the GitHub token is not left in .git/config. Update the checkout step in the tests-linux workflow, and apply the same change anywhere else in the repo where checkout is used for test-only jobs to keep the pattern consistent.Source: Linters/SAST tools
.github/workflows/tests-windows.yml (1)
149-149: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winSet
persist-credentials: falseon checkout for security hardeningSame as the Linux and macOS recommendations — add
persist-credentials: falseto reduce credential exposure.🔒 Suggested fix
steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v6 + with: + persist-credentials: false🤖 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 @.github/workflows/tests-windows.yml at line 149, The checkout step in the Windows workflow should be hardened by disabling credential persistence. Update the existing actions/checkout usage in the workflow to include persist-credentials: false, matching the security setup already used in the Linux and macOS workflows. Ensure the change is applied to the checkout step itself so credentials are not retained after the job runs.Source: Linters/SAST tools
.github/workflows/tests-macos.yml (1)
141-141: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winSet
persist-credentials: falseon checkout for security hardeningSame as the Linux recommendation — add
persist-credentials: falseto reduce credential exposure.🔒 Suggested fix
steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v6 + with: + persist-credentials: false🤖 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 @.github/workflows/tests-macos.yml at line 141, The checkout step in the macOS workflow is missing the security hardening setting, so update the existing actions/checkout usage to disable credential persistence. Adjust the checkout configuration in the tests-macos workflow by setting persist-credentials to false on the same checkout step, matching the Linux workflow’s hardening approach.Source: Linters/SAST tools
tests/auth/oauth2/oauth2-state-validation.spec.ts (2)
263-268: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUncomment or remove the commented-out
test.stepwrapper.The
test.step('start the authorization code flow', ...)wrapper is commented out in test 3 (lines 263-268) but active in all other tests. This reduces report readability and creates an inconsistency. Either wrap the steps in atest.steplike the other tests do, or remove the commented-out lines.♻️ Proposed fix
- // await test.step('start the authorization code flow', async () => { + await test.step('start the authorization code flow', async () => { await stubOpenExternal(app); await installCallbackCapture(app); await clickGetAccessToken(page, 'AuthCodeUserSuppliedState'); await waitForAuthorizationStarted(app); - // }); + });🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts` around lines 263 - 268, The authorization code flow block in oauth2-state-validation.spec.ts has a commented-out test.step wrapper, unlike the other tests. Update the test around the clickGetAccessToken, stubOpenExternal, installCallbackCapture, and waitForAuthorizationStarted calls to either restore the test.step('start the authorization code flow', ...) wrapper or remove the commented wrapper entirely so the structure is consistent.
152-152: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove dead code:
STATE_NONCE_HEX_LENGTHand the commented-out nonce-length assertion.
STATE_NONCE_HEX_LENGTH(line 152) is only referenced in the commented-out assertion on line 160. If the nonce-length check is intentionally disabled, remove both the constant and the comment to avoid confusion. If the check should be active, uncomment it and remove the contradictorytoBeassertions in the user-supplied state tests instead.♻️ Proposed cleanup
const STATE_NONCE_HEX_LENGTH = 32; - -/** `state` Bruno sent on the authorization URL (stored internally as expectedState). */ -const getIssuedState = async (app: ElectronApplication): Promise<string> => { - const authUrl = await getCapturedAuthUrl(app); - expect(authUrl, 'authorization URL should have been opened').toBeTruthy(); - const state = stateFromAuthorizationUrl(authUrl as string); - expect(state, 'issued state should be present on the authorization URL').toBeTruthy(); - // expect((state as string).length).toBeGreaterThanOrEqual(STATE_NONCE_HEX_LENGTH); - return state as string; -}; +// (Remove STATE_NONCE_HEX_LENGTH if the nonce-length check is intentionally disabled)Also applies to: 160-160
🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts` at line 152, Remove the dead nonce-length test code in oauth2-state-validation.spec.ts: the STATE_NONCE_HEX_LENGTH constant and the commented-out nonce-length assertion are only used together, so delete both if the check is intentionally disabled. If nonce validation should remain active, update the state validation test logic in the oauth2 state spec to re-enable the assertion and make the user-supplied state tests consistent by removing any contradictory toBe expectations.
🤖 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 @.github/actions/auth/oauth2/windows/setup-keycloak/action.yml:
- Around line 75-79: The failure path in the Keycloak readiness check uses
Write-Error, which stops execution before the log tail is printed because
$ErrorActionPreference is Stop. Update the error handling in the setup-keycloak
action script so the not-ready branch in the readiness check prints the failure
message and the last log lines with Write-Host (or equivalent non-terminating
output), then explicitly exits with code 1. Keep the change localized to the
Keycloak startup wait logic so the log output is always reached when readiness
fails.
---
Nitpick comments:
In @.github/actions/auth/oauth2/linux/setup-keycloak/action.yml:
- Around line 46-49: The Keycloak setup step still hardcodes the temporary
directory with /tmp instead of using the runner-provided temp location. Update
the Linux/macOS action logic in the Keycloak download/extract flow to use
RUNNER_TEMP consistently, matching the Windows setup and keeping the temp zip,
unzip target, and KC_HOME construction based on that variable.
- Around line 37-68: The Linux setup-keycloak workflow duplicates the macOS
version byte-for-byte, so updates must be made in two places and can drift.
Extract the shared Keycloak setup logic from the “Download and start Keycloak”
step into a common composite action, then have both platform-specific wrappers
invoke that shared action. Keep the wrapper-specific files minimal and ensure
any future changes to the Keycloak download/start/wait flow happen only in the
shared action.
In @.github/actions/auth/oauth2/macos/run-oauth2-e2e-tests/action.yml:
- Around line 6-9: The macOS OAuth2 E2E test step in the action’s run block is
missing the same strict shell settings used by the Linux step. Update the Run
OAuth2 E2E tests step in the oauth2 macOS action to include set -euo pipefail
before npm run test:e2e:auth:oauth2 so error handling matches across platforms
and the shell behavior is consistent.
In @.github/actions/auth/oauth2/macos/setup-keycloak/action.yml:
- Around line 55-56: The Keycloak startup command is writing its log to /tmp
instead of the runner temp directory. Update the nohup invocation in
setup-keycloak/action.yml to use $RUNNER_TEMP for the kc.sh start-dev output
redirection, keeping the logging path consistent with the rest of the action;
locate the change in the startup command that launches kc.sh.
- Around line 46-49: The Keycloak setup steps in the macOS action currently
write to hardcoded /tmp paths, which should be replaced with $RUNNER_TEMP for
consistency with the other actions and GitHub Actions conventions. Update the
download, unzip, and KC_HOME assignment in the setup flow so the temporary
archive and extracted directory are placed under $RUNNER_TEMP, using the same
approach as the Linux and Windows setup logic.
In @.github/workflows/tests-linux.yml:
- Line 157: Add security hardening to the existing actions/checkout@v6 step by
setting persist-credentials to false so the GitHub token is not left in
.git/config. Update the checkout step in the tests-linux workflow, and apply the
same change anywhere else in the repo where checkout is used for test-only jobs
to keep the pattern consistent.
In @.github/workflows/tests-macos.yml:
- Line 141: The checkout step in the macOS workflow is missing the security
hardening setting, so update the existing actions/checkout usage to disable
credential persistence. Adjust the checkout configuration in the tests-macos
workflow by setting persist-credentials to false on the same checkout step,
matching the Linux workflow’s hardening approach.
In @.github/workflows/tests-windows.yml:
- Line 149: The checkout step in the Windows workflow should be hardened by
disabling credential persistence. Update the existing actions/checkout usage in
the workflow to include persist-credentials: false, matching the security setup
already used in the Linux and macOS workflows. Ensure the change is applied to
the checkout step itself so credentials are not retained after the job runs.
In `@tests/auth/oauth2/oauth2-state-validation.spec.ts`:
- Around line 263-268: The authorization code flow block in
oauth2-state-validation.spec.ts has a commented-out test.step wrapper, unlike
the other tests. Update the test around the clickGetAccessToken,
stubOpenExternal, installCallbackCapture, and waitForAuthorizationStarted calls
to either restore the test.step('start the authorization code flow', ...)
wrapper or remove the commented wrapper entirely so the structure is consistent.
- Line 152: Remove the dead nonce-length test code in
oauth2-state-validation.spec.ts: the STATE_NONCE_HEX_LENGTH constant and the
commented-out nonce-length assertion are only used together, so delete both if
the check is intentionally disabled. If nonce validation should remain active,
update the state validation test logic in the oauth2 state spec to re-enable the
assertion and make the user-supplied state tests consistent by removing any
contradictory toBe expectations.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7797074f-ef5d-4c86-a993-3f57f6aeb088
📒 Files selected for processing (20)
.github/actions/auth/oauth2/linux/run-oauth2-e2e-tests/action.yml.github/actions/auth/oauth2/linux/setup-keycloak/action.yml.github/actions/auth/oauth2/macos/run-oauth2-e2e-tests/action.yml.github/actions/auth/oauth2/macos/setup-keycloak/action.yml.github/actions/auth/oauth2/windows/run-oauth2-e2e-tests/action.yml.github/actions/auth/oauth2/windows/setup-keycloak/action.yml.github/workflows/tests-linux.yml.github/workflows/tests-macos.yml.github/workflows/tests-windows.ymlpackage.jsonplaywright.config.tstests/auth/oauth2/fixtures/collection/AuthCodeUserSuppliedState.brutests/auth/oauth2/fixtures/collection/AuthorizationCode.brutests/auth/oauth2/fixtures/collection/AuthorizationImplicit.brutests/auth/oauth2/fixtures/collection/ImplicitUserSuppliedState.brutests/auth/oauth2/fixtures/collection/bruno.jsontests/auth/oauth2/fixtures/collection/environments/Local.brutests/auth/oauth2/fixtures/keycloak/realm-export.jsontests/auth/oauth2/init-user-data/preferences.jsontests/auth/oauth2/oauth2-state-validation.spec.ts
| if (-not $ready) { | ||
| Write-Error "Keycloak did not become ready in time" | ||
| if (Test-Path $log) { Get-Content $log -Tail 100 } | ||
| exit 1 | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Log tail is unreachable when Keycloak fails to start.
With $ErrorActionPreference = 'Stop' set at line 46, Write-Error at line 76 throws immediately, so Get-Content at line 77 and exit 1 at line 78 never execute. The Keycloak log — critical for debugging startup failures — won't be displayed. Use Write-Host for the error message and log output, then exit 1 explicitly.
🐛 Proposed fix
if (-not $ready) {
- Write-Error "Keycloak did not become ready in time"
- if (Test-Path $log) { Get-Content $log -Tail 100 }
+ Write-Host "::error::Keycloak did not become ready in time"
+ if (Test-Path $log) { Get-Content $log -Tail 100 }
+ if (Test-Path "$env:RUNNER_TEMP\keycloak.err.log") { Get-Content "$env:RUNNER_TEMP\keycloak.err.log" -Tail 100 }
exit 1
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (-not $ready) { | |
| Write-Error "Keycloak did not become ready in time" | |
| if (Test-Path $log) { Get-Content $log -Tail 100 } | |
| exit 1 | |
| } | |
| if (-not $ready) { | |
| Write-Host "::error::Keycloak did not become ready in time" | |
| if (Test-Path $log) { Get-Content $log -Tail 100 } | |
| if (Test-Path "$env:RUNNER_TEMP\keycloak.err.log") { Get-Content "$env:RUNNER_TEMP\keycloak.err.log" -Tail 100 } | |
| exit 1 | |
| } |
🤖 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 @.github/actions/auth/oauth2/windows/setup-keycloak/action.yml around lines
75 - 79, The failure path in the Keycloak readiness check uses Write-Error,
which stops execution before the log tail is printed because
$ErrorActionPreference is Stop. Update the error handling in the setup-keycloak
action script so the not-ready branch in the readiness check prints the failure
message and the last log lines with Write-Host (or equivalent non-terminating
output), then explicitly exits with code 1. Keep the change localized to the
Keycloak startup wait logic so the log output is always reached when readiness
fails.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
.github/workflows/lint-checks.yml (1)
1-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSame anti-pattern as benchmarks.yml — and this one disables lint enforcement in CI.
Commenting out the entire file leaves dead YAML and produces an actionlint "workflow is empty" error. More importantly, this removes automated lint enforcement from CI — the
npm run lintscript andeslint-plugin-diffconfig remain active in the repo (confirmed inpackage.jsonline 91 andeslint.config.js), so only CI-side enforcement is lost.Prefer the same alternatives: delete the file, keep only
workflow_dispatch, or addif: falseto the job. If the intent is to temporarily unblock the WIP PR, a single comment at the top of an otherwise intact file is cleaner than commenting out every line.🤖 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 @.github/workflows/lint-checks.yml around lines 1 - 26, The lint-checks workflow is effectively disabled by commenting out the entire file, which also leaves dead YAML that triggers the empty-workflow actionlint error. Update the workflow by either removing the file, keeping only workflow_dispatch, or marking the lint job in lint-checks.yml with if: false; if this is only a temporary WIP unblock, leave the workflow intact and add a brief top-level comment instead of commenting every step.Source: Linters/SAST tools
.github/workflows/benchmarks.yml (1)
1-92: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid commenting out entire workflow files — prefer deletion or trigger removal.
Commenting out every line produces an invalid workflow (actionlint reports "workflow is empty") and leaves ~90 lines of dead YAML in the repo. This is hard to maintain and easy to accidentally re-enable.
For a WIP disable, prefer one of:
- Delete the file — recoverable via git history when needed.
- Keep only
workflow_dispatch— removes automatic triggers while preserving manual-run capability:-# name: Benchmarks -# on: -# workflow_dispatch: -# inputs: -# update-baseline: -# description: 'Update baseline with current results instead of comparing' -# type: boolean -# default: false -# pull_request: -# branches: [main, 'release/v*'] +name: Benchmarks +on: + workflow_dispatch: + inputs: + update-baseline: + description: 'Update baseline with current results instead of comparing' + type: boolean + default: false
- Add
if: falseto the job — keeps the workflow structurally valid while disabling execution.If this is truly temporary and will be reverted before merge, a comment at the top (
# Temporarily disabled for OAuth2 WIP) on an otherwise intact file would be cleaner than commenting out every line.🤖 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 @.github/workflows/benchmarks.yml around lines 1 - 92, The entire benchmarks workflow is commented out, which leaves an invalid empty workflow and a lot of dead YAML. In .github/workflows/benchmarks.yml, either remove the file, restore the workflow and keep only the manual trigger, or disable execution structurally with an always-false job condition; use the existing Benchmarks workflow/job definitions and the benchmark job name to locate it. Avoid commenting out every line so the file remains maintainable and lint-safe.Source: Linters/SAST tools
🤖 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 @.github/workflows/flaky-test-detector.yml:
- Around line 1-123: The flaky-test-detector workflow is inert because all jobs
in the workflow are commented out, leaving GitHub Actions with an empty
workflow. Restore the active workflow structure around detect-flaky-tests and
its related steps, and if this is meant to be temporary, keep the workflow file
valid by gating execution with an on/if condition rather than commenting out the
entire job block. Refer to the detect-flaky-tests job and the Post PR
comment/Upload flaky test artifacts steps when re-enabling it.
In @.github/workflows/npm-bru-cli.yml:
- Around line 1-51: The Bru CLI validation workflow has been effectively
disabled because the entire workflow definition is commented out, leaving no
runnable jobs or triggers. Restore the workflow structure in npm-bru-cli.yml by
uncommenting the actual job definition and only disable it through the trigger
or job conditions if this is meant to be temporary; keep the existing workflow
identity and steps such as the test job and actions/checkout,
actions/setup-node, and dorny/test-reporter intact.
In @.github/workflows/tests-linux.yml:
- Around line 14-146: The Linux workflow currently disables every existing test
job by commenting out unit-test, cli-test, e2e-test, ssl-test, and oauth1-tests,
which removes CI coverage. Restore the existing job definitions in
tests-linux.yml and use a safer temporary disable mechanism like if: false on
individual jobs with a brief note, or leave them intact and add the new
oauth2-tests job separately. Keep the workflow anchored around the existing job
names so the CI intent stays clear and the YAML does not drift.
---
Nitpick comments:
In @.github/workflows/benchmarks.yml:
- Around line 1-92: The entire benchmarks workflow is commented out, which
leaves an invalid empty workflow and a lot of dead YAML. In
.github/workflows/benchmarks.yml, either remove the file, restore the workflow
and keep only the manual trigger, or disable execution structurally with an
always-false job condition; use the existing Benchmarks workflow/job definitions
and the benchmark job name to locate it. Avoid commenting out every line so the
file remains maintainable and lint-safe.
In @.github/workflows/lint-checks.yml:
- Around line 1-26: The lint-checks workflow is effectively disabled by
commenting out the entire file, which also leaves dead YAML that triggers the
empty-workflow actionlint error. Update the workflow by either removing the
file, keeping only workflow_dispatch, or marking the lint job in lint-checks.yml
with if: false; if this is only a temporary WIP unblock, leave the workflow
intact and add a brief top-level comment instead of commenting every step.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cad6ca3a-ce2e-422c-804b-a40494c64c34
📒 Files selected for processing (9)
.github/workflows/benchmarks.yml.github/workflows/flaky-test-detector.yml.github/workflows/lint-checks.yml.github/workflows/npm-bru-cli.yml.github/workflows/tests-linux.yml.github/workflows/tests-macos.yml.github/workflows/tests-windows.ymltests/auth/oauth2/fixtures/collection/environments/Local.brutests/auth/oauth2/oauth2-state-validation.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/auth/oauth2/oauth2-state-validation.spec.ts
… environment - Changed the Keycloak setup action to only prepare the environment without starting the server. - Updated the test execution action to start Keycloak and run OAuth2 E2E tests in the same step, ensuring the server remains active during the tests. - Improved error handling and logging for Keycloak readiness checks.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/auth/oauth2/oauth2-state-validation.spec.ts (1)
128-133: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueType annotation inconsistency on
argparameter.The
argparameter is typed asstringbut uses optional chaining (arg?.startsWith). Ifargcan be undefined, the type should reflect that; if not, the?.is unnecessary. As per coding guidelines, avoid optional chaining where it doesn't make sense — fix the type or narrow first.♻️ Suggested type fix
- const url = commandLine?.find((arg: string) => arg?.startsWith('bruno://')); + const url = commandLine?.find((arg) => arg?.startsWith('bruno://'));Or, if
argis guaranteed to be a string:- const url = commandLine?.find((arg: string) => arg?.startsWith('bruno://')); + const url = commandLine?.find((arg: string) => arg.startsWith('bruno://'));🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts` around lines 128 - 133, Resolve the type and optional-chaining mismatch in the second-instance listener’s commandLine.find callback: either declare arg as possibly undefined if that reflects the data, or keep it as string and replace arg?.startsWith with arg.startsWith. Preserve the existing bruno:// URL detection and capture behavior.Source: Coding guidelines
🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts`:
- Around line 272-273: Update both mismatch tests in
oauth2-state-validation.spec.ts, including “authorization code: rejects callback
when returned state does not match issued state” and the other mismatch test, to
call test.setTimeout(60_000) consistently with the success tests before their
asynchronous setup.
- Around line 373-374: Set a 60-second timeout for the implicit-grant
state-mismatch test, alongside the existing test declaration before its
asynchronous setup, so waitForReadyPage can complete within the allowed
duration. Keep the test behavior unchanged.
---
Nitpick comments:
In `@tests/auth/oauth2/oauth2-state-validation.spec.ts`:
- Around line 128-133: Resolve the type and optional-chaining mismatch in the
second-instance listener’s commandLine.find callback: either declare arg as
possibly undefined if that reflects the data, or keep it as string and replace
arg?.startsWith with arg.startsWith. Preserve the existing bruno:// URL
detection and capture behavior.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3b4b4b2d-da5f-4535-b9d9-062dd77d3c21
📒 Files selected for processing (2)
packages/bruno-electron/src/utils/oauth2.jstests/auth/oauth2/oauth2-state-validation.spec.ts
✅ Files skipped from review due to trivial changes (1)
- packages/bruno-electron/src/utils/oauth2.js
| test('authorization code: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | ||
| const app = await restartApp(); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Add test.setTimeout(60_000) to mismatch tests for consistency and stability.
The four success tests (lines 198, 238, 306, 343) all set a 60s test timeout, but the two mismatch tests (here and line 373) do not. Since waitForReadyPage can take up to 45s, the default test timeout may be exceeded on slower CI runners, causing flaky failures.
🛡️ Proposed fix
test('authorization code: rejects callback when returned state does not match issued state', async ({ restartApp }) => {
+ test.setTimeout(60_000);
const app = await restartApp();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test('authorization code: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | |
| const app = await restartApp(); | |
| test('authorization code: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | |
| test.setTimeout(60_000); | |
| const app = await restartApp(); |
🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts` around lines 272 - 273,
Update both mismatch tests in oauth2-state-validation.spec.ts, including
“authorization code: rejects callback when returned state does not match issued
state” and the other mismatch test, to call test.setTimeout(60_000) consistently
with the success tests before their asynchronous setup.
| test('implicit grant: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | ||
| const app = await restartApp(); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Add test.setTimeout(60_000) here too.
Same missing timeout as the auth code mismatch test — waitForReadyPage can take up to 45s, risking a default-timeout failure.
🛡️ Proposed fix
test('implicit grant: rejects callback when returned state does not match issued state', async ({ restartApp }) => {
+ test.setTimeout(60_000);
const app = await restartApp();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test('implicit grant: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | |
| const app = await restartApp(); | |
| test('implicit grant: rejects callback when returned state does not match issued state', async ({ restartApp }) => { | |
| test.setTimeout(60_000); | |
| const app = await restartApp(); |
🤖 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 `@tests/auth/oauth2/oauth2-state-validation.spec.ts` around lines 373 - 374,
Set a 60-second timeout for the implicit-grant state-mismatch test, alongside
the existing test declaration before its asynchronous setup, so waitForReadyPage
can complete within the allowed duration. Keep the test behavior unchanged.
…feat/oauth2-keyclock-cicd-setup
Description
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Bug Fixes