-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix auth-related issues caused by dependency updates #13333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses CI failures caused by updates to the authlib and tornado dependencies. The main change adapts to authlib 1.6.6+ behavior, which now always writes state to session objects even when a cache is available. The fix provides an empty dictionary as a session placeholder instead of None to accommodate this new behavior.
Key Changes:
- Modified OIDC authentication to use empty dict session placeholders instead of
Noneto work with authlib 1.6.6+ - Updated test assertions to handle modified error message format from updated dependencies
- Added explanatory comments documenting the authlib version-specific behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/streamlit/web/server/oidc_mixin.py |
Updated session handling in two methods to use empty dict instead of None, with comments explaining authlib 1.6.6+ behavior |
lib/tests/streamlit/web/server/oauth_authlib_routes_test.py |
Split error message assertion into two separate checks to handle updated error format from dependency |
📈 Frontend coverage change detectedThe frontend unit test (vitest) coverage has increased by 0.0400%
🎉 Great job on improving test coverage! |
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
SummaryThis PR fixes authentication-related CI issues caused by dependency updates, specifically addressing compatibility with authlib 1.6.6+. The new authlib version changed its behavior to always write OAuth state to session even when a cache is available, which broke Streamlit's Tornado integration since Tornado doesn't have persistent sessions across HTTP requests. Main changes:
Code QualityThe implementation is clean, well-structured, and follows the existing patterns in the codebase: Strengths:
Minor observations:
Test CoverageThe test coverage is excellent. The new tests thoroughly cover the critical state management functionality: New tests in
Test quality assessment:
Test updates:
Backwards CompatibilityFully backwards compatible. The changes:
Security & RiskNo security concerns identified:
Regression risk: Low
RecommendationsNo blocking issues found. Minor optional suggestions:
VerdictAPPROVED: This PR correctly fixes the authlib 1.6.6+ compatibility issue for Tornado's sessionless architecture. The implementation is clean, well-documented, thoroughly tested, and maintains backwards compatibility. The changes are isolated to the authentication integration layer with no impact on public APIs or security. This is an automated AI review. Please verify the feedback and use your judgment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
SummaryThis PR updates Streamlit’s Authlib↔Tornado integration to remain compatible with Authlib 1.6.6+ (which now always tracks OAuth state in “session”), by using a placeholder session dict and overriding state retrieval/cleanup to rely on Streamlit’s cache. It also tightens up a couple tests that became brittle after dependency updates. Code Quality
Test Coverage
Backwards Compatibility
Security & Risk
Recommendations
VerdictCHANGES REQUESTED: The core fix is sound and well-tested at the integration layer, but the new This is an automated AI review. Please verify the feedback and use your judgment. |
📉 Python coverage change detectedThe Python unit test coverage has decreased by 0.0055%
✅ Coverage change is within normal range. Coverage by files
|
These two aspects are somewhat valid, but already working that way in the previous state. They should be made more robust in a follow-up. |
See this had been fixed ✅ |
| pass | ||
|
|
||
| # Fallback: direct cache access with JSON decoding | ||
| # This mirrors the implementation in FrameworkIntegration._get_cache_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the downside to using this method? Is it always available, or only given a certain authlib version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, the method is easy enough that we can always just use the fallback and not even rely on it at all
| assert result == {"redirect_uri": "http://example.com"} | ||
|
|
||
| def test_get_state_data_returns_none_without_cache(self) -> None: | ||
| """Verify get_state_data returns None when no cache is configured.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the expected case for this when the user is logged out, or their authentication is expired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it was testing an edge case that cannot happen in actual Streamlit usage. Removed the test again since cache cannot be None
Co-authored-by: Laura Wilby <laura.wilby@snowflake.com>
Co-authored-by: Laura Wilby <laura.wilby@snowflake.com>
Co-authored-by: Laura Wilby <laura.wilby@snowflake.com>
sfc-gh-lwilby
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
## Describe your changes Authlib (1.6.6) & tornado (6.5.3) got updated, causing some issues with our CI. The authlib session aspect likely also breaks existing usage and requires a patch. Closes #13335 --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Laura Wilby <laura.wilby@snowflake.com>
Describe your changes
Authlib (1.6.6) & tornado (6.5.3) got updated, causing some issues with our CI.
The authlib session aspect likely also breaks existing usage and requires a patch.
Closes #13335
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.