AsyncOAuthFlow raises UnboundLocalError on org-wide install without a bot token
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- authentication, backend
Rechercherichtung
The crash is in slack_bolt/oauth/async_oauth_flow.py in AsyncOAuthFlow.run_installation, where auth_test is read for enterprise installs but only assigned inside the bot-token branch. Compare it with the sync OAuthFlow.run_installation, which keeps that lookup under if bot_token is not None:. A fix already exists in linked PR #1590 with tests, so review or extend that PR rather than starting a parallel one. Done means an org-wide install with user scopes only saves the installation and redirects without raising UnboundLocalError.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Reproducible in:
The slack_bolt version
slack_bolt==1.30.0
slack_sdk==3.45.0
Python runtime version
Python 3.12.5
OS info
macOS 27.0
Steps to reproduce:
Use AsyncApp with OAuth and have an Enterprise Grid org install the app with only user scopes (no bot scopes). The oauth.v2.access response then has no access_token for the bot and is_enterprise_install is true.
- Configure
AsyncOAuthFlowwith user scopes only. - Install the app at the organization level (org-wide install).
- Complete the OAuth redirect.
Expected result:
The installation is saved and the redirect succeeds, the same as it does with the sync OAuthFlow.
Actual result:
AsyncOAuthFlow.run_installation in slack_bolt/oauth/async_oauth_flow.py raises:
UnboundLocalError: cannot access local variable 'auth_test' where it is not associated with a value
The code reads auth_test.get("url") for enterprise installs, but auth_test is only set when a bot token exists. The sync OAuthFlow.run_installation nests that line inside the if bot_token is not None: block, so the two have drifted apart.
I have a fix that mirrors the sync version, with tests for both, in #1590.
Requirements
I have read the Contributing guidelines and Code of Conduct.
- Vorherrschende Sprache
- Python
- Sterne
- 1.3k
- Forks
- 300
- Ø Merge
- 19 Std. 33 Min.
- Gemergte PRs (30 T.)
- 25
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus slackapi/bolt-python
-
`extract_team_id` crashes with `TypeError when payload["user"]` is a string (e.g. `member_joined_channel` events)Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenauto-triage-skip bug security semver:major
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
slackapi/bolt-python#1447 · 9 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
auto-triage-stale
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
slackapi/bolt-python#1599 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Error handlers that take args: Args crash with a missing 'next' argumentEvtl. vergeben @sahiljagtap08 hat das vor 42 Tagen übernommen. Offenauto-triage-stale
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 25/100
slackapi/bolt-python#1598 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Assistant listener middleware crashes when given a plain functionEvtl. vergeben @sahiljagtap08 hat das vor 42 Tagen übernommen. Offenauto-triage-stale
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
slackapi/bolt-python#1597 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
SslCheck returns 401 for a matching verification_token and 200 for a wrong oneEvtl. vergeben @sahiljagtap08 hat das vor 42 Tagen übernommen. Offenauto-triage-stale
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 25/100
slackapi/bolt-python#1595 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in slackapi/bolt-python
Ähnliche Issues
-
documentation
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
BrainLesion/BraTS#200 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
OpenHands/extensions#970 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
rl-institut/enetra#91 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
huggingface/datasets#9100 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
NVIDIA/garak#2486 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen