Skip to content

Fix CSP blocking OIDC token endpoint - #680

Merged
jnfrati merged 1 commit into
netbirdio:mainfrom
maxbrc:fix-csp-auth-authority-origin
Jun 26, 2026
Merged

Fix CSP blocking OIDC token endpoint#680
jnfrati merged 1 commit into
netbirdio:mainfrom
maxbrc:fix-csp-auth-authority-origin

Conversation

@maxbrc

@maxbrc maxbrc commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Calculate the origin URL for AUTH_AUTHORITY and add it to CSP_DOMAINS.
Fixes #679

Documentation

  • Documentation is not needed

Summary by CodeRabbit

  • Bug Fixes
    • Improved app compatibility with authentication endpoints by correctly allowing the auth service’s origin in the content security policy.
    • Reduced issues caused by using full auth URLs, helping sign-in and related flows work more reliably.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The docker/init_react_envs.sh script is updated so that when AUTH_AUTHORITY is set, only its origin (scheme + host + port) is extracted via sed and appended to CSP_DOMAINS, instead of appending the full AUTH_AUTHORITY URL including its path.

Changes

CSP Origin Extraction Fix

Layer / File(s) Summary
Strip path from AUTH_AUTHORITY before adding to CSP_DOMAINS
docker/init_react_envs.sh
Introduces AUTH_AUTHORITY_ORIGIN computed by stripping everything after the host via sed, and appends that origin to CSP_DOMAINS instead of the full AUTH_AUTHORITY value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A path too long crept into the rule,
blocking the token — oh, how cruel!
With a snip of sed, just origin stays,
the auth endpoint flows through the haze.
Hippity-hop, the CSP's now cool! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the fix and documentation choice, but it omits the required issue ticket number/link section from the template. Add the issue ticket number and a link under the required section, and keep the documentation selection as shown.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing CSP so the OIDC token endpoint is no longer blocked.
Linked Issues check ✅ Passed The change matches issue #679 by using the AUTH_AUTHORITY origin in CSP_DOMAINS to allow the token endpoint.
Out of Scope Changes check ✅ Passed The patch is narrowly scoped to the CSP origin fix and does not introduce unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

jnfrati
jnfrati previously approved these changes Jun 24, 2026

@coderabbitai coderabbitai 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.

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 `@docker/init_react_envs.sh`:
- Around line 94-95: The AUTH_AUTHORITY_ORIGIN derivation in init_react_envs.sh
only strips path segments, so query strings and fragments can leak into the CSP
list. Update the AUTH_AUTHORITY_ORIGIN extraction logic to normalize
AUTH_AUTHORITY to a true origin by removing any trailing ?query or `#fragment` as
well as any path, then keep appending it to CSP_DOMAINS. Use the existing
AUTH_AUTHORITY_ORIGIN and CSP_DOMAINS variables in the shell block to locate the
change.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58dd68b0-345c-4e99-a843-9476fc2bbba2

📥 Commits

Reviewing files that changed from the base of the PR and between 76529fc and cbda14d.

📒 Files selected for processing (1)
  • docker/init_react_envs.sh

Comment thread docker/init_react_envs.sh
@jnfrati
jnfrati self-requested a review June 24, 2026 15:50
@jnfrati
jnfrati dismissed their stale review June 24, 2026 15:50

Missing checks before approval

@jnfrati

jnfrati commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Hey @maxbrc thanks for the contribution!
Could you check the failing CI on this PR? Everything looks good beyond that 🙌

@maxbrc

maxbrc commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jnfrati! Fixed the failing check (docs checkbox in the template). CodeRabbit had a point but it was out of scope, it's resolved.

@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jnfrati
jnfrati merged commit c325c17 into netbirdio:main Jun 26, 2026
4 of 11 checks passed
@maxbrc
maxbrc deleted the fix-csp-auth-authority-origin branch June 26, 2026 15:01
JuliusFreudenberger pushed a commit to JuliusFreudenberger/nix-config that referenced this pull request Jul 2, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [netbirdio/dashboard](https://github.com/netbirdio/dashboard) | minor | `v2.39.0` → `v2.90.3` |
| netbirdio/netbird | minor | `v0.73.2-rootless` → `v0.74.1-rootless` |
| netbirdio/netbird-server | minor | `0.73.2` → `0.74.1` |
| netbirdio/reverse-proxy | minor | `0.73.2` → `0.74.1` |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/12) for more information.

---

### Release Notes

<details>
<summary>netbirdio/dashboard (netbirdio/dashboard)</summary>

### [`v2.90.3`](https://github.com/netbirdio/dashboard/releases/tag/v2.90.3)

[Compare Source](netbirdio/dashboard@v2.90.2...v2.90.3)

#### What's Changed

- Show reason for peer login expiration events by [@&#8203;bcmmbaga](https://github.com/bcmmbaga) in [#&#8203;694](netbirdio/dashboard#694)
- Reload nginx after patching CSP header by [@&#8203;pappz](https://github.com/pappz) in [#&#8203;687](netbirdio/dashboard#687)
- Fix peer table page reset when switching kind by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;696](netbirdio/dashboard#696)
- Feature/add provider session by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;695](netbirdio/dashboard#695)
- Add Metrics settings tab with metrics push toggle by [@&#8203;pappz](https://github.com/pappz) in [#&#8203;613](netbirdio/dashboard#613)
- Feature/add skip tls verification by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;697](netbirdio/dashboard#697)

**Full Changelog**: <netbirdio/dashboard@v2.90.2...v2.90.3>

### [`v2.90.2`](https://github.com/netbirdio/dashboard/releases/tag/v2.90.2)

[Compare Source](netbirdio/dashboard@v2.90.1...v2.90.2)

#### What's Changed

- Add Claude provider selector and Bedrock by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;691](netbirdio/dashboard#691)
- Prevent gated useFetchApi hooks from overwriting shared cache entries by [@&#8203;bcmmbaga](https://github.com/bcmmbaga) in [#&#8203;692](netbirdio/dashboard#692)

**Full Changelog**: <netbirdio/dashboard@v2.90.1...v2.90.2>

### [`v2.90.1`](https://github.com/netbirdio/dashboard/releases/tag/v2.90.1)

[Compare Source](netbirdio/dashboard@v2.90.0...v2.90.1)

#### What's Changed

- The empty-state peer card now renders AddPeerDropdown by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;686](netbirdio/dashboard#686)
- Support Vertex keyfile upload and agent config by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;688](netbirdio/dashboard#688)
- Prefill Vertex endpoint by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;689](netbirdio/dashboard#689)

**Full Changelog**: <netbirdio/dashboard@v2.90.0...v2.90.1>

### [`v2.90.0`](https://github.com/netbirdio/dashboard/releases/tag/v2.90.0)

[Compare Source](netbirdio/dashboard@v2.80.0...v2.90.0)

#### What's Changed

- Fix CSP blocking OIDC token endpoint by [@&#8203;maxbrc](https://github.com/maxbrc) in [#&#8203;680](netbirdio/dashboard#680)
- Agent Network by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;684](netbirdio/dashboard#684)

#### New Contributors

- [@&#8203;maxbrc](https://github.com/maxbrc) made their first contribution in [#&#8203;680](netbirdio/dashboard#680)

**Full Changelog**: <netbirdio/dashboard@v2.80.0...v2.90.0>

### [`v2.80.0`](https://github.com/netbirdio/dashboard/releases/tag/v2.80.0)

[Compare Source](netbirdio/dashboard@v2.39.0...v2.80.0)

#### What's Changed

- Add Logout URL to the Identity Provider dialog by [@&#8203;TechHutTV](https://github.com/TechHutTV) in [#&#8203;657](netbirdio/dashboard#657)
- Edit banner to IPv6 kh link by [@&#8203;TechHutTV](https://github.com/TechHutTV) in [#&#8203;662](netbirdio/dashboard#662)
- Insert link to remote jobs documentation by [@&#8203;semp26](https://github.com/semp26) in [#&#8203;664](netbirdio/dashboard#664)
- DNS Zones & Setup modal improvements by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;669](netbirdio/dashboard#669)
- Update banner by [@&#8203;heisbrot](https://github.com/heisbrot) in [#&#8203;672](netbirdio/dashboard#672)
- Update announcements.json by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;673](netbirdio/dashboard#673)
- Merge NetBird cloud edition into the dashboard by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;674](netbirdio/dashboard#674)
- Restrict cloud/licensed-only API calls in open-source mode by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;675](netbirdio/dashboard#675)
- Preserve inactivity expiration on partial peer updates by [@&#8203;bcmmbaga](https://github.com/bcmmbaga) in [#&#8203;676](netbirdio/dashboard#676)

#### New Contributors

- [@&#8203;TechHutTV](https://github.com/TechHutTV) made their first contribution in [#&#8203;657](netbirdio/dashboard#657)
- [@&#8203;semp26](https://github.com/semp26) made their first contribution in [#&#8203;664](netbirdio/dashboard#664)

**Full Changelog**: <netbirdio/dashboard@v2.39.0...v2.80.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNTAuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE1MC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.jfreudenberger.de/JuliusFreudenberger/nix-config/pulls/10
Co-authored-by: Renovate Bot <renovate@jfreudenberger.de>
Co-committed-by: Renovate Bot <renovate@jfreudenberger.de>
ocoj pushed a commit to ocoj/dashboard that referenced this pull request Jul 17, 2026
ocoj pushed a commit to ocoj/dashboard that referenced this pull request Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSP connect-src (derived from AUTH_AUTHORITY) locks out Authentik token endpoint

3 participants