You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "tahvane1 (via GitHub)" <gi...@apache.org> on 2026/01/19 01:25:09 UTC
[PR] feat(auth): Skip OAUTH provider selection [superset]
tahvane1 opened a new pull request, #37234:
URL: https://github.com/apache/superset/pull/37234
### SUMMARY
This PR introduces OAUTH_SKIP_PROVIDER_SELECTION feature flag. When set (and there is only one OAUTH provider) it will skip provider selection screen and forward request directly to OAUTH provider.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [X ] Required feature flags: OAUTH_SKIP_PROVIDER_SELECTION
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [X ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3766023041
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-4850666764
All good... holler if you want help, I/we can try to push some commits to move it forward.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3994040820
Hey @tahvane1, thanks for the ping! I took a closer look at all the review comments.
A few of the bot comments were false positives or not really a big deal, so I've resolved them.
For the sake of the PR here, some items would still need to be addressed:
1. Pre-commit β Please make sure `pre-commit run --all-files` passes cleanly.
2. The feature flag is not documented, and has no default state, in `config.py` and thus will not be listed on the generated [feature flags docs page](https://superset.apache.org/admin-docs/configuration/feature-flags).
However, there's a bigger issue to wrangle about the need for a feature flag at all. There's some trepidation (generally) about adding new feature flags. Often these involve proposing a SIP (or at least a Lazy Consensus thread on the Dev mailing list).
One suggestion to get around that would be to simplify the approach entirely. The current implementation creates a 79-line file that duplicates FAB's AuthOAuthView.login just to add a 3-line single-provider check, plus a feature flag and conditional view registration. I don't think we need the feature flag at all, really. If someone configures exactly one OAuth provider, there's nothing to "select," so skipping is just good UX.
This could be simplified to ~10 lines added to the existing `auth.py`, with no new file or feature flag:
```
class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
route_base = "/login"
@expose("/")
@expose("/<provider>")
@no_cache
def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
if provider is None:
providers = list(self.appbuilder.sm.oauth_remotes.keys())
if len(providers) == 1:
provider = providers[0]
return super().login(provider)
```
Then in `security/manager.py`, just always register SupersetOAuthView when `auth_type == AUTH_OAUTH` instead of conditionally swapping views based on a feature flag. This avoids duplicating FAB internals (which can break on upgrades), eliminates the feature flag, and keeps the change minimal.
The remaining ask would be test coverage β a few unit tests for the single-provider redirect behavior would be good to have.
Let me/us know your thoughts on the above. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3796255905
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 closed pull request #37234: feat(auth): Skip OAUTH provider selection
URL: https://github.com/apache/superset/pull/37234
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37234:
URL: https://github.com/apache/superset/pull/37234#discussion_r2702955622
##########
superset/views/oauth.py:
##########
@@ -0,0 +1,85 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import logging
+from typing import Optional
+import jwt
+from flask import flash, g, redirect, get_flashed_messages, request, session, url_for
+from flask_appbuilder import expose
+from flask_appbuilder.security.decorators import no_cache
+from flask_appbuilder.security.utils import generate_random_string
+from flask_appbuilder.security.views import AuthOAuthView, WerkzeugResponse
+from flask_appbuilder._compat import as_unicode
+from superset.views.base import BaseSupersetView
+
+logger = logging.getLogger(__name__)
+
+
+class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
+ route_base = "/login"
+
+ @expose("/")
+ @expose("/<provider>")
+ @no_cache
+ def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
+
+ get_flashed_messages(category_filter=['danger'])
+
+ if provider is None:
+ providers = [k for k in self.appbuilder.sm.oauth_remotes.keys()]
+ if len(providers) == 1:
+ provider = providers[0]
+ logger.debug("Provider: %s", provider)
+ if g.user is not None and g.user.is_authenticated:
+ logger.debug("Already authenticated %s", g.user)
+ return redirect(self.appbuilder.get_url_for_index)
Review Comment:
**Suggestion:** Runtime bug: passing the method object `self.appbuilder.get_url_for_index` to `redirect` instead of calling it will lead to an invalid redirect URL (the bound method's repr). Call the method to obtain the URL string before redirecting. [possible bug]
<details>
<summary><b>Severity Level:</b> Critical π¨</summary>
```mdx
- β Authenticated users redirected to invalid URL.
- β οΈ /login route broken for signed-in users.
- β οΈ User experience degraded on login access.
```
</details>
```suggestion
return redirect(self.appbuilder.get_url_for_index())
```
<details>
<summary><b>Steps of Reproduction β
</b></summary>
```mdx
1. Authenticate a user in the running Superset instance. The login view is
SupersetOAuthView.login at superset/views/oauth.py:35-38.
2. While authenticated, visit the login route (GET /login). The login handler checks
authentication at superset/views/oauth.py:47.
3. Because g.user is authenticated, execution reaches superset/views/oauth.py:48-49 and
calls return redirect(self.appbuilder.get_url_for_index) β note the code passes the bound
method object rather than calling it.
4. Flask's redirect will convert the bound method to a string (its repr) and set it as the
Location header; result is an invalid Location (e.g., "<bound method ...>") and the
browser navigates to an incorrect path or receives an unexpected response. This reproduces
the broken redirect for signed-in users.
```
</details>
<details>
<summary><b>Prompt for AI Agent π€ </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/oauth.py
**Line:** 49:49
**Comment:**
*Possible Bug: Runtime bug: passing the method object `self.appbuilder.get_url_for_index` to `redirect` instead of calling it will lead to an invalid redirect URL (the bound method's repr). Call the method to obtain the URL string before redirecting.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #37234:
URL: https://github.com/apache/superset/pull/37234#discussion_r2702955198
##########
superset/views/oauth.py:
##########
@@ -0,0 +1,85 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import logging
+from typing import Optional
+import jwt
+from flask import flash, g, redirect, get_flashed_messages, request, session, url_for
+from flask_appbuilder import expose
+from flask_appbuilder.security.decorators import no_cache
+from flask_appbuilder.security.utils import generate_random_string
+from flask_appbuilder.security.views import AuthOAuthView, WerkzeugResponse
+from flask_appbuilder._compat import as_unicode
+from superset.views.base import BaseSupersetView
+
+logger = logging.getLogger(__name__)
+
+
+class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
+ route_base = "/login"
+
+ @expose("/")
+ @expose("/<provider>")
+ @no_cache
+ def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
+
+ get_flashed_messages(category_filter=['danger'])
+
+ if provider is None:
+ providers = [k for k in self.appbuilder.sm.oauth_remotes.keys()]
+ if len(providers) == 1:
+ provider = providers[0]
+ logger.debug("Provider: %s", provider)
+ if g.user is not None and g.user.is_authenticated:
+ logger.debug("Already authenticated %s", g.user)
+ return redirect(self.appbuilder.get_url_for_index)
+
+ if provider is None:
+ return self.render_template(
+ self.login_template,
+ providers=self.appbuilder.sm.oauth_providers,
+ title=self.title,
+ appbuilder=self.appbuilder,
+ )
+
+ logger.debug("Going to call authorize for: %s", provider)
Review Comment:
## Clear-text logging of sensitive information
This expression logs [sensitive data (password)](1) as clear text.
[Show more details](https://github.com/apache/superset/security/code-scanning/2225)
##########
superset/views/oauth.py:
##########
@@ -0,0 +1,85 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import logging
+from typing import Optional
+import jwt
+from flask import flash, g, redirect, get_flashed_messages, request, session, url_for
+from flask_appbuilder import expose
+from flask_appbuilder.security.decorators import no_cache
+from flask_appbuilder.security.utils import generate_random_string
+from flask_appbuilder.security.views import AuthOAuthView, WerkzeugResponse
+from flask_appbuilder._compat import as_unicode
+from superset.views.base import BaseSupersetView
+
+logger = logging.getLogger(__name__)
+
+
+class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
+ route_base = "/login"
+
+ @expose("/")
+ @expose("/<provider>")
+ @no_cache
+ def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
+
+ get_flashed_messages(category_filter=['danger'])
+
+ if provider is None:
+ providers = [k for k in self.appbuilder.sm.oauth_remotes.keys()]
+ if len(providers) == 1:
+ provider = providers[0]
+ logger.debug("Provider: %s", provider)
Review Comment:
## Clear-text logging of sensitive information
This expression logs [sensitive data (password)](1) as clear text.
[Show more details](https://github.com/apache/superset/security/code-scanning/2224)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3792234479
Getting some warnings about clear-text logging of sensitive information that will need to be addressed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3766039233
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/37234?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `4.44444%` with `43 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 48.08%. Comparing base ([`476e454`](https://app.codecov.io/gh/apache/superset/commit/476e454384dedb279493a780c4f6002b95fc478b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`65dc084`](https://app.codecov.io/gh/apache/superset/commit/65dc0848e15feb8a2e00a5d82f84f70f735dd3b7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/37234?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/views/oauth.py](https://app.codecov.io/gh/apache/superset/pull/37234?src=pr&el=tree&filepath=superset%2Fviews%2Foauth.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmlld3Mvb2F1dGgucHk=) | 0.00% | [40 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/security/manager.py](https://app.codecov.io/gh/apache/superset/pull/37234?src=pr&el=tree&filepath=superset%2Fsecurity%2Fmanager.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvc2VjdXJpdHkvbWFuYWdlci5weQ==) | 40.00% | [2 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/superset/pull/37234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #37234 +/- ##
===========================================
+ Coverage 0 48.08% +48.08%
===========================================
Files 0 645 +645
Lines 0 48269 +48269
Branches 0 5291 +5291
===========================================
+ Hits 0 23211 +23211
- Misses 0 24394 +24394
- Partials 0 664 +664
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/37234/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/37234/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `42.72% <4.44%> (?)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/37234/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.31% <4.44%> (?)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/37234/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `48.08% <4.44%> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/37234/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ΓΈ> (?)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/37234?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3766022947
CodeAnt AI is reviewing your PR.
---
### Thanks for using CodeAnt! π
We're free for open-source projects. if you're enjoying it, help us grow by sharing.
[Share on X](https://twitter.com/intent/tweet?text=Just%20tried%20%40CodeAntAI%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A&url=https%3A//codeant.ai) Β·
[Reddit](https://www.reddit.com/submit?title=Check%20out%20CodeAnt%20for%20automated%20code%20review&text=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A%20https%3A//codeant.ai) Β·
[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcodeant.ai&mini=true&title=Check%20out%20CodeAnt%20for%20automated%20code%20review&summary=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37234:
URL: https://github.com/apache/superset/pull/37234#discussion_r2824026707
##########
superset/views/oauth.py:
##########
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import Optional
+
+import jwt
+from flask import flash, g, get_flashed_messages, redirect, request, session, url_for
+from flask_appbuilder import expose
+from flask_appbuilder._compat import as_unicode
+from flask_appbuilder.security.decorators import no_cache
+from flask_appbuilder.security.utils import generate_random_string
+from flask_appbuilder.security.views import AuthOAuthView, WerkzeugResponse
+
+from superset.views.base import BaseSupersetView
+
+
+class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
+ route_base = "/login"
+
+ @expose("/")
+ @expose("/<provider>")
+ @no_cache
+ def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
+ get_flashed_messages(category_filter=["danger"])
+
+ if provider is None:
+ providers = [k for k in self.appbuilder.sm.oauth_remotes.keys()]
Review Comment:
**Suggestion:** The automatic skipping of the provider selection screen when there is a single OAuth provider happens unconditionally, ignoring the `OAUTH_SKIP_PROVIDER_SELECTION` feature flag described in the PR; this means the behavior cannot be toggled and will always skip selection, which contradicts the intended feature-flagged behavior. [logic error]
<details>
<summary><b>Severity Level:</b> Major β οΈ</summary>
```mdx
- β οΈ Feature flag OAUTH_SKIP_PROVIDER_SELECTION has no effect.
- β οΈ Provider selection UI cannot be preserved when desired.
- β οΈ Cannot safely roll out skip-selection behavior gradually.
```
</details>
```suggestion
if provider is None and self.appbuilder.app.config.get("OAUTH_SKIP_PROVIDER_SELECTION"):
```
<details>
<summary><b>Steps of Reproduction β
</b></summary>
```mdx
1. Start Superset with this PR code and configure a single OAuth provider (e.g. Google) so
that `self.appbuilder.sm.oauth_remotes` in `superset/views/oauth.py:41` contains exactly
one key.
2. Ensure the feature flag `OAUTH_SKIP_PROVIDER_SELECTION` is unset or set to `False` in
the Flask config accessed via `self.appbuilder.app.config` (so the intended behavior is to
NOT auto-skip).
3. In a fresh browser session (no authenticated user), send `GET /login` which is handled
by `SupersetOAuthView.login` at `superset/views/oauth.py:37` with `provider=None`.
4. Observe that the block at `superset/views/oauth.py:41-44` unconditionally sets
`provider` to the only configured provider and the code proceeds past the
template-rendering branch at `superset/views/oauth.py:48-53`, directly initiating the
OAuth redirect, meaning the provider selection screen is always skipped regardless of the
`OAUTH_SKIP_PROVIDER_SELECTION` flag.
```
</details>
<details>
<summary><b>Prompt for AI Agent π€ </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/oauth.py
**Line:** 41:41
**Comment:**
*Logic Error: The automatic skipping of the provider selection screen when there is a single OAuth provider happens unconditionally, ignoring the `OAUTH_SKIP_PROVIDER_SELECTION` feature flag described in the PR; this means the behavior cannot be toggled and will always skip selection, which contradicts the intended feature-flagged behavior.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37234&comment_hash=2089baa06fc74fa2dc9be98696e34a04a1cd4597dbeb22dd0c8d4ec4540b2259&reaction=like'>π</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37234&comment_hash=2089baa06fc74fa2dc9be98696e34a04a1cd4597dbeb22dd0c8d4ec4540b2259&reaction=dislike'>π</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3766027420
CodeAnt AI finished reviewing your PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3792230366
Superset uses Git pre-commit hooks courtesy of [pre-commit](https://pre-commit.com/). To install run the following:
```
pip3 install -r requirements/development.txt
pre-commit install
```
A series of checks will now run when you make a git commit.
Alternatively it is possible to run pre-commit by running pre-commit manually:
```
pre-commit run --all-files
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3766028710
### <span aria-hidden="true">β
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">π¨</span> Latest commit | 65dc0848e15feb8a2e00a5d82f84f70f735dd3b7 |
|<span aria-hidden="true">π</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/696d87f686041f0008a2025f |
|<span aria-hidden="true">π</span> Deploy Preview | [https://deploy-preview-37234--superset-docs-preview.netlify.app](https://deploy-preview-37234--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">π±</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-37234--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3769581706
CodeAnt AI is running Incremental review
---
### Thanks for using CodeAnt! π
We're free for open-source projects. if you're enjoying it, help us grow by sharing.
[Share on X](https://twitter.com/intent/tweet?text=Just%20tried%20%40CodeAntAI%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A&url=https%3A//codeant.ai) Β·
[Reddit](https://www.reddit.com/submit?title=Check%20out%20CodeAnt%20for%20automated%20code%20review&text=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A%20https%3A//codeant.ai) Β·
[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcodeant.ai&mini=true&title=Check%20out%20CodeAnt%20for%20automated%20code%20review&summary=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-4740088766
Sorry, "fixing" this is on my todo list but I have been very busy lately.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-4859157937
@rusackas I create new PR #41635
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-4859157937
@rusackas I create new PR #41635
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3993788233
@rusackas is this okay now?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "tahvane1 (via GitHub)" <gi...@apache.org>.
tahvane1 commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3922689247
any updates on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37234:
URL: https://github.com/apache/superset/pull/37234#discussion_r2725082406
##########
superset/views/oauth.py:
##########
@@ -0,0 +1,78 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import Optional
+import jwt
+from flask import flash, g, redirect, get_flashed_messages, request, session, url_for
+from flask_appbuilder import expose
+from flask_appbuilder.security.decorators import no_cache
+from flask_appbuilder.security.utils import generate_random_string
+from flask_appbuilder.security.views import AuthOAuthView, WerkzeugResponse
+from flask_appbuilder._compat import as_unicode
+from superset.views.base import BaseSupersetView
+
+
+class SupersetOAuthView(BaseSupersetView, AuthOAuthView):
+ route_base = "/login"
+
+ @expose("/")
+ @expose("/<provider>")
+ @no_cache
+ def login(self, provider: Optional[str] = None) -> WerkzeugResponse:
+
+ get_flashed_messages(category_filter=['danger'])
+
+ if provider is None:
+ providers = [k for k in self.appbuilder.sm.oauth_remotes.keys()]
+ if len(providers) == 1:
+ provider = providers[0]
+ if g.user is not None and g.user.is_authenticated:
+ return redirect(self.appbuilder.get_url_for_index)
+
+ if provider is None:
+ return self.render_template(
+ self.login_template,
+ providers=self.appbuilder.sm.oauth_providers,
+ title=self.title,
+ appbuilder=self.appbuilder,
+ )
+
+ random_state = generate_random_string()
+ state = jwt.encode(
+ request.args.to_dict(flat=False), random_state, algorithm="HS256"
+ )
+ session["oauth_state"] = random_state
Review Comment:
**Suggestion:** The session currently stores `random_state` instead of the encoded `state` token; if downstream verification expects the token returned by the provider to match the stored `state`, this mismatch will break verification. Save the string form of the encoded JWT (`state`) into the session (decode bytes to str if necessary). [logic error]
<details>
<summary><b>Severity Level:</b> Critical π¨</summary>
```mdx
- β OAuth callback state verification may fail blocking logins.
- β οΈ All OAuth provider logins may be affected.
```
</details>
```suggestion
state_str = state.decode("ascii") if isinstance(state, bytes) else state
session["oauth_state"] = state_str
```
<details>
<summary><b>Steps of Reproduction β
</b></summary>
```mdx
1. Start the Superset server with the PR changes applied.
2. Open the OAuth initiation URL `GET /login` (SupersetOAuthView.login at
`superset/views/oauth.py:35`) when `provider` is resolved (or call `/login/<provider>`).
Execution reaches `superset/views/oauth.py:54-57` where `random_state` and `state` (the
JWT) are created.
3. The code stores `session["oauth_state"] = random_state` at `superset/views/oauth.py:58`
(the random nonce), not the encoded JWT string that is later passed to providers as
`state` (lines 62-75 show `state` being sent to providers).
4. When the OAuth provider redirects back to the configured callback (`.oauth_authorized`,
referenced in `superset/views/oauth.py:62-73`), the callback receives the `state` value
the provider returned (the encoded JWT). Downstream verification logic (the callback
implemented by the auth layer / AuthOAuthView) will compare the returned `state` to
`session["oauth_state"]`. Because the session holds the raw `random_state` (not the
encoded JWT), this comparison will fail and the authorization will be rejected, causing
login failure.
5. The mismatch is evidenced by the code paths in `superset/views/oauth.py:54-58` (setting
session) and `superset/views/oauth.py:62-75` (sending `state` to provider), showing a
concrete, verifiable inconsistency rather than a stylistic issue.
```
</details>
<details>
<summary><b>Prompt for AI Agent π€ </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/oauth.py
**Line:** 58:58
**Comment:**
*Logic Error: The session currently stores `random_state` instead of the encoded `state` token; if downstream verification expects the token returned by the provider to match the stored `state`, this mismatch will break verification. Save the string form of the encoded JWT (`state`) into the session (decode bytes to str if necessary).
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-3769583657
CodeAnt AI Incremental review completed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(auth): Skip OAUTH provider selection [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #37234:
URL: https://github.com/apache/superset/pull/37234#issuecomment-4737427668
Still a useful feature, @tahvane1. My remaining worry is `SupersetOAuthView.login` copies FAB's internals wholesale, which tends to break on upgrades. Could we subclass and just override the single-provider redirect, and add a test or two? I can help with pre-commit and stuff if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org