Skip to content

fix: relax CSP for non-Teams SSO pages to unblock eval-dependent login#2330

Open
IsmaelMartinez wants to merge 3 commits intomainfrom
fix/relax-csp-for-sso-login-2326
Open

fix: relax CSP for non-Teams SSO pages to unblock eval-dependent login#2330
IsmaelMartinez wants to merge 3 commits intomainfrom
fix/relax-csp-for-sso-login-2326

Conversation

@IsmaelMartinez
Copy link
Owner

@IsmaelMartinez IsmaelMartinez commented Mar 13, 2026

Summary

Fixes login failure for users with third-party SSO providers (e.g. Symantec VIP) that use Angular/jQuery requiring eval().

Strips all CSP headers (Content-Security-Policy and Content-Security-Policy-Report-Only) from non-Teams domain responses, so third-party SSO pages aren't blocked by their own restrictive CSP when running with contextIsolation: false. Teams domains (including MCAS proxy suffix) are explicitly excluded from any CSP modification.

Root cause

The Symantec VIP login page delivers CSP via both HTTP headers and potentially <meta> tags. With contextIsolation: false (our architectural choice for DOM access), the shared V8 context enforces even the Content-Security-Policy-Report-Only policy as a blocking policy, causing Uncaught EvalError in the VIP userservices script and preventing the Angular-based login UI from initializing.

The initial fix (adding 'unsafe-eval' to script-src) didn't work because the CSP is likely delivered via <meta> tags in the HTML, which HTTP header modification can't reach. Stripping all CSP headers handles the HTTP header case. A separate PR will add a contextIsolation config option as a guaranteed fallback.

Test plan

  • Verify normal Teams login flow still works (no CSP changes for Teams domains)
  • Verify Symantec VIP SSO login completes successfully
  • Verify other third-party SSO providers are not broken
  • Run npm run lint — passes clean

Closes #2326

🤖 Generated with Claude Code

#2326)

Third-party SSO providers like Symantec VIP use Angular/jQuery which
require eval(). With contextIsolation disabled, the shared V8 context
enforces the page's CSP strictly, blocking eval and breaking login.

Add 'unsafe-eval' to the script-src directive in enforcing CSP headers
for non-Teams domains only, preserving Teams' own CSP unchanged.

Closes #2326

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

✅ Changelog entry generated and committed to this PR:

Fix: Relax CSP for non-Teams SSO to unblock eval-dependent login - by @IsmaelMartinez (#2330)

The file .changelog/pr-2330.txt will be included when you merge this PR.

You can edit it directly in this PR if needed.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical login issue for users of third-party Single Sign-On (SSO) providers by selectively relaxing the Content Security Policy (CSP). The change specifically targets non-Teams domains to permit the use of eval() in scripts, which is required by some SSO UIs, without compromising the security policies enforced on core Teams domains. This ensures broader compatibility for authentication while maintaining security where it's most critical.

Highlights

  • SSO Login Fix: Resolved login failures for users utilizing third-party SSO providers (e.g., Symantec VIP) that depend on eval() for their Angular/jQuery-based UIs.
  • Content Security Policy (CSP) Relaxation: Introduced 'unsafe-eval' to the script-src directive of the CSP for non-Teams domains only, allowing dynamic code evaluation necessary for certain SSO flows.
  • Teams Domain Preservation: Ensured that the original CSP for Teams domains, including those with Microsoft Cloud App Security (MCAS) proxy suffixes, remains entirely unchanged to maintain existing security postures.
  • Domain Identification Logic: Implemented a utility function to accurately identify Teams domains, accounting for potential MCAS proxy suffixes, to selectively apply CSP modifications.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/mainAppWindow/index.js
    • Added TEAMS_DOMAINS constant to list known Teams domains.
    • Implemented isTeamsDomain function to check if a given URL belongs to a Teams domain, including handling MCAS proxy suffixes.
    • Introduced relaxCspForAuthPages function to modify the Content-Security-Policy header by adding 'unsafe-eval' to script-src for non-Teams domains.
    • Integrated relaxCspForAuthPages into the onHeadersReceivedHandler to apply the CSP relaxation during header processing.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request relaxes the Content Security Policy for non-Teams domains by adding 'unsafe-eval' to the script-src directive. This is a deliberate change to support third-party SSO providers that rely on eval(). The implementation correctly restricts this change to non-Teams domains, leaving the CSP for Teams pages untouched. I have one suggestion to improve the robustness of how the CSP string is modified, ensuring that only the script-src directive is affected.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

📦 PR Build Artifacts

Build successful! Download artifacts:

🐧 Linux

x86_64 (434.03 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

arm64 (425.25 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

armv7l (403.29 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

🍎 macOS

x86_64 (124.84 MB) - Contains: .dmg

🪟 Windows

x86_64 (105.41 MB) - Contains: .exe installer


📝 Note: Snap packages (.snap) are built in a separate workflow

View workflow run

🕐 Last updated: 2026-03-13 07:26 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

📦 PR Snap Build Artifacts

Snap builds successful! Download artifacts:

🐧 Linux Snap Packages

x86_64 (107.27 MB)

arm64 (104.18 MB)

armv7l (98.41 MB)


📝 Note: Other package formats (.deb, .rpm, .AppImage, .dmg, .exe) are built in the main workflow

View workflow run

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[Bug]: Cant login with symantec login due to contextIsolation

1 participant