SignatureVerifier.is_valid raises instead of returning False for a malformed timestamp, signature or body
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 57/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- backend-api-design, security
Rechercherichtung
Start with SignatureVerifier.is_valid() and its existing tests, including test_is_valid_none; the issue names the malformed timestamp, signature, and body cases. Confirm each currently raises, then make sure the tests expect False for all three while preserving the missing-value behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
SignatureVerifier.is_valid() (and is_valid_request()) returns False for missing values, but three kinds of malformed input from the request raise instead:
from slack_sdk.signature import SignatureVerifier
v = SignatureVerifier("secret")
v.is_valid("body", "abc", "v0=aa") # ValueError: invalid literal for int() with base 10: 'abc'
v.is_valid("body", "1531420618", "v0=é") # TypeError: comparing strings with non-ASCII characters is not supported
v.is_valid(b"\xff\xfe", "1531420618", "v0=aa") # UnicodeDecodeError (body is decoded before the signature is compared)
(For the last two, use a timestamp inside the 5 minute window.)
The timestamp and signature come straight from the X-Slack-Request-Timestamp and X-Slack-Signature headers, so anyone can send them. In bolt-python, RequestVerification.process calls is_valid directly, so such a request does not get the 401 invalid request response; the exception goes through the generic error path in App.dispatch and ends as a 500.
It is not a way around the check, the request is still rejected. But the method is documented as "Verifies if the given signature is valid" and test_is_valid_none already expects False for missing values, so returning False for these seems to be the intended contract.
I have a small fix with tests (catch the three cases in is_valid and return False). Happy to open a PR if that works for you.
Checked on main at b935494.
- Vorherrschende Sprache
- Python
- Sterne
- 4k
- Forks
- 874
- Ø Merge
- 13 Std. 22 Min.
- Gemergte PRs (30 T.)
- 64
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/python-slack-sdk
-
`WebClient` raises `JSONDecodeError` instead of `SlackApiError` on a malformed JSON body when retry handlers are setEvtl. vergeben @agustin18 hat das vor 13 Tagen übernommen. Offenbug semver:major web-client
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
slackapi/python-slack-sdk#2070 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 42/100
slackapi/python-slack-sdk#2066 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add missing Web API methods that are documented on docs.slack.dev to WebClientEvtl. vergeben @zimeg hat das vor 19 Tagen übernommen. Offenenhancement web-client
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
slackapi/python-slack-sdk#2014 · 2 Kommentare · 2 Reaktionen · 2 zugewiesene Personen ·
Maintainer antworten meist innerhalb von 1 Tag
-
Installation and Bot reject ISO 8601 timestamps with a negative UTC offset or a Z suffixEvtl. vergeben @hello-ashleyintech hat das vor 44 Tagen übernommen. Offenauto-triage-stale bug
slackapi/python-slack-sdk#1989 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
chat_postMessage silently forwards thread_id to the API, so a threaded reply posts to the channelEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenauto-triage-skip enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
slackapi/python-slack-sdk#1923 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in slackapi/python-slack-sdk
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
plone/plone.observability#114 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:docs type:docs
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
jejjohnson/gauss_flows#246 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
openvax/varcode#824 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add SAS as a cable typeOffennetbox status: needs triage type: feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
netbox-community/netbox#23868 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
emeryberger/CSrankings#15757 ·
Maintainer antworten meist innerhalb von 9 Tagen