You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "lhpaoletti (via GitHub)" <gi...@apache.org> on 2026/04/15 11:18:47 UTC

[I] [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY' [superset]

lhpaoletti opened a new issue, #39364:
URL: https://github.com/apache/superset/issues/39364

   ### Bug description
   
   In Superset 6.0.0, enabling `AUTH_USER_REGISTRATION = True` together with a non-OAuth auth type such as `AUTH_DB` can cause the app to return `500` on `/superset/welcome/` and `/login/` with:
   
   ```python
   KeyError: 'RECAPTCHA_PUBLIC_KEY'
   ```
   
   The issue appears to be that `superset/views/base.py` computes:
   
   ```python
   should_show_recaptcha = auth_user_registration and (auth_type != AUTH_OAUTH)
   ```
   
   and then unconditionally does:
   
   ```python
   frontend_config["RECAPTCHA_PUBLIC_KEY"] = app.config["RECAPTCHA_PUBLIC_KEY"]
   ```
   
   However, `RECAPTCHA_PUBLIC_KEY` does not appear to be defined in the default `superset.config` for 6.0.0, and I could not find documentation indicating that it is required when `AUTH_USER_REGISTRATION=True`.
   
   This means a valid configuration can crash unless users manually add a dummy/default `RECAPTCHA_PUBLIC_KEY`.
   
   ### How to reproduce the bug
   
   Use Superset `6.0.0`.
   
   Set config similar to:
   
   ```python
   from flask_appbuilder.security.manager import AUTH_DB
   
   AUTH_TYPE = AUTH_DB
   AUTH_USER_REGISTRATION = True
   AUTH_USER_REGISTRATION_ROLE = "Public"
   ```
   
   Do **not** define `RECAPTCHA_PUBLIC_KEY`.
   
   Start Superset and open:
   
   - `/`
   - or `/superset/welcome/`
   - or `/login/`
   
   ### Screenshots/recordings
   
   No screenshot, but the server traceback is:
   
   ```text
   File "/app/superset/views/base.py", line 417, in cached_common_bootstrap_data
       frontend_config["RECAPTCHA_PUBLIC_KEY"] = app.config["RECAPTCHA_PUBLIC_KEY"]
   KeyError: 'RECAPTCHA_PUBLIC_KEY'
   ```
   
   Full request flow in my case:
   
   - `GET /` -> 302
   - `GET /superset/welcome/` -> 500
   - `GET /login/?next=%2Fsuperset%2Fwelcome%2F` -> 500
   
   ### Expected behavior
   
   One of these:
   
   1. `RECAPTCHA_PUBLIC_KEY` should have a safe default in config, or
   2. the bootstrap code should use `app.config.get("RECAPTCHA_PUBLIC_KEY", "")`, or
   3. recaptcha should only be required when an explicit recaptcha-related config is enabled.
   
   A missing optional recaptcha config should not crash login/welcome pages.
   
   ### Actual behavior
   
   Superset returns `500 Internal Server Error` due to `KeyError: 'RECAPTCHA_PUBLIC_KEY'`.
   
   ### Environment
   
   - Superset version: `6.0.0`
   - Deployment: Docker image `apache/superset:6.0.0`
   - Auth type reproduced with: `AUTH_DB`
   
   ### Additional context
   
   A few details that may help narrow this down:
   
   - I did not see this behavior before enabling `AUTH_USER_REGISTRATION = True`.
   - The issue seems specific to the code path where `auth_user_registration` is true and `auth_type != AUTH_OAUTH`.
   - I checked the upstream `apache/superset:6.0.0` image and `RECAPTCHA_PUBLIC_KEY` does not seem to be exported from `superset.config`.
   - I also could not find this requirement in the 6.0.0 configuration docs.
   
   If helpful, I can provide a minimal container repro.
   
   ---
   
   Disclosure: this issue was posted by my coding agent on my behalf, based on my reproduction and review before posting.


-- 
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.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: [I] [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY' [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #39364:
URL: https://github.com/apache/superset/issues/39364#issuecomment-4251575326

   <!-- Greeting -->
   Hi @lhpaoletti! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
   
   <!-- Answer -->
   This is a confirmed regression in Superset 6.0.0. The same issue was reported in #37100 by @MG-MW for `AUTH_LDAP` [[1]](https://github.com/apache/superset/issues/37100#issuecomment-4068822397), and the root cause is identical for `AUTH_DB`.
   
   The problem is in `superset/views/base.py` — the bootstrap code accesses `app.config["RECAPTCHA_PUBLIC_KEY"]` whenever `AUTH_USER_REGISTRATION=True` and the auth type is not OAuth (or SAML, after PR #38606), but `RECAPTCHA_PUBLIC_KEY` has no default in `superset/config.py` [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/base.py#L339-L342) [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py).
   
   There are two open PRs attempting to fix this that haven't been merged yet:
   
   - **PR #36857** — "fix: disable recaptcha for LDAP authentication" [[4]](https://github.com/apache/superset/pull/36857)
   - **PR #37009** — "fix: do not require recaptcha public key for LDAP authentication" [[5]](https://github.com/apache/superset/pull/37009)
   
   **Workaround** from #37100: add dummy reCAPTCHA keys and use `COMMON_BOOTSTRAP_OVERRIDES_FUNC` to hide the registration UI from the frontend while keeping backend auto-provisioning intact [[1]](https://github.com/apache/superset/issues/37100#issuecomment-4068822397):
   
   ```python
   RECAPTCHA_PUBLIC_KEY = ""
   RECAPTCHA_PRIVATE_KEY = ""
   
   def COMMON_BOOTSTRAP_OVERRIDES_FUNC(bootstrap_data: dict) -> dict:
       conf = bootstrap_data.get("conf", {})
       return {
           **bootstrap_data,
           "conf": {
               **conf,
               "AUTH_USER_REGISTRATION": False,
           },
       }
   ```
   
   Or more minimally, just setting `RECAPTCHA_PUBLIC_KEY = ""` in your config should prevent the `KeyError`.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=too_verbose) | [Hallucination](https://
 app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=hallucination) | [Report šŸ›](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=f6185c3c-bb9a-42da-ba56-edc8bbe5b6c9&feedback_type=other)</sup>
   [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20regression%20in%20Superset%206.0.0.%20The%20same%20issue%20was%20reported%20in%20%2337100%20by%20%40MG-MW%20for%20%60AUTH_LDAP%60%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/issues/37100%23issuecomment-4068822397%29%2C%20and%20the%20root%20cause%20is%20identical%20for%20%60AUTH_DB%60.%0A%0AThe%20problem%20is%20in%20%60superset/views/base.py%60%20%E2%80%94%20the%20bootstrap%20code%20accesses%20%60app.config%5B%22RECAPTCHA_PUBLIC_KEY%22%5D%60%20whenever%20%60AUTH_USER_REGISTRATION%3DTrue%60%20and%20the%20auth%20type%20is%20not%20OAuth%20%28or%20SAML%2C%20after%20PR%20%2338606%29%2C%20but%20%60RECAPTCHA_PUBLIC_KEY%60%20has%20no%20default%
 20in%20%60superset/config.py%60%20%5B%5B2%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/base.py%23L339-L342%29%20%5B%5B3%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py%29.%0A%0AThere%20are%20two%20open%20PRs%20attempting%20to%20fix%20this%20that%20haven%27t%20been%20merged%20yet%3A%0A%0A-%20%2A%2APR%20%2336857%2A%2A%20%E2%80%94%20%22fix%3A%20disable%20recaptcha%20for%20LDAP%20authentication%22%20%5B%5B4%5D%5D%28https%3A//github.com/apache/superset/pull/36857%29%0A-%20%2A%2APR%20%2337009%2A%2A%20%E2%80%94%20%22fix%3A%20do%20not%20require%20recaptcha%20public%20key%20for%20LDAP%20authentication%22%20%5B%5B5%5D%5D%28https%3A//github.com/apache/superset/pull/37009%29%0A%0A%2A%2AWorkaround%2A%2A%20from%20%2337100%3A%20add%20dummy%20reCAPTCHA%20keys%20and%20use%20%60COMMON_BOOTSTRAP_OVERRIDES_FUNC%60%20to%20hide%20the%20registration%20UI%20from%20the%20frontend%20whil
 e%20keeping%20backend%20auto-provisioning%20intact%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/issues/37100%23issuecomment-4068822397%29%3A%0A%0A%60%60%60python%0ARECAPTCHA_PUBLIC_KEY%20%3D%20%22%22%0ARECAPTCHA_PRIVATE_KEY%20%3D%20%22%22%0A%0Adef%20COMMON_BOOTSTRAP_OVERRIDES_FUNC%28bootstrap_data%3A%20dict%29%20-%3E%20dict%3A%0A%20%20%20%20conf%20%3D%20bootstrap_data.get%28%22conf%22%2C%20%7B%7D%29%0A%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%2A%2Abootstrap_data%2C%0A%20%20%20%20%20%20%20%20%22conf%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%2A%2Aconf%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22AUTH_USER_REGISTRATION%22%3A%20False%2C%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%7D%0A%60%60%60%0A%0AOr%20more%20minimally%2C%20just%20setting%20%60RECAPTCHA_PUBLIC_KEY%20%3D%20%22%22%60%20in%20your%20config%20should%20prevent%20the%20%60KeyError%60.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://
 go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/39364)


-- 
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: [I] [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY' [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #39364:
URL: https://github.com/apache/superset/issues/39364#issuecomment-4266146426

   <!-- Answer -->
   I'd suggest keeping this issue open — the underlying bug hasn't been fixed yet. PRs #36857 and #37009 both attempt to address it but neither has been merged. Setting dummy `RECAPTCHA_PUBLIC_KEY` values is just a workaround, not a proper fix.
   
   This issue also adds value as a clear reproduction case for `AUTH_DB` specifically (the existing #37100 focused on `AUTH_LDAP`), so it could help draw attention to those pending PRs. That said, you could also consider closing this as a duplicate of #37100 and adding a comment there linking back here — either approach is reasonable.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=too_verbose) | [Hallucination](https://
 app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=hallucination) | [Report šŸ›](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=59ea145f-20c0-45fb-8bd1-f6cef547ff80&feedback_type=other)</sup>
   [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=I%27d%20suggest%20keeping%20this%20issue%20open%20%E2%80%94%20the%20underlying%20bug%20hasn%27t%20been%20fixed%20yet.%20PRs%20%2336857%20and%20%2337009%20both%20attempt%20to%20address%20it%20but%20neither%20has%20been%20merged.%20Setting%20dummy%20%60RECAPTCHA_PUBLIC_KEY%60%20values%20is%20just%20a%20workaround%2C%20not%20a%20proper%20fix.%0A%0AThis%20issue%20also%20adds%20value%20as%20a%20clear%20reproduction%20case%20for%20%60AUTH_DB%60%20specifically%20%28the%20existing%20%2337100%20focused%20on%20%60AUTH_LDAP%60%29%2C%20so%20it%20could%20help%20draw%20attention%20to%20those%20pending%20PRs.%20That%20said%2C%20you%20could%20also%20consider%20closing%20this%20as%20a%20dup
 licate%20of%20%2337100%20and%20adding%20a%20comment%20there%20linking%20back%20here%20%E2%80%94%20either%20approach%20is%20reasonable.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/39364)


-- 
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: [I] [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY' [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #39364: [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY'
URL: https://github.com/apache/superset/issues/39364


-- 
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: [I] [6.0.0] AUTH_USER_REGISTRATION=True with AUTH_DB/LDAP can crash login/welcome with KeyError: 'RECAPTCHA_PUBLIC_KEY' [superset]

Posted by "lhpaoletti (via GitHub)" <gi...@apache.org>.
lhpaoletti commented on issue #39364:
URL: https://github.com/apache/superset/issues/39364#issuecomment-4266144485

   @dosu Ok thanks, so should we close this issue?


-- 
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