From c437493a2b8f5d71fb44fda8ff6f5bf55d385c7b Mon Sep 17 00:00:00 2001 From: Ulrich Dangel Date: Thu, 31 Aug 2023 11:11:31 -0400 Subject: [PATCH 1/2] Update _url.py to not match for repositories starting with `app` `APP_ROUTES` contains an `r"/app"` entry to match for the `/app` route. This will also match repositories which start with `app` causing `require_app_auth` to return true. This change adjusts the `/app` regex to match at the beginning of the string and not anywhere within the url.path --- githubkit/auth/_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubkit/auth/_url.py b/githubkit/auth/_url.py index a8a4595b5..26e9fc116 100644 --- a/githubkit/auth/_url.py +++ b/githubkit/auth/_url.py @@ -3,7 +3,7 @@ import httpx APP_ROUTES = { - r"/app", + r"^/app", r"/app/hook/config", r"/app/hook/deliveries", r"/app/hook/deliveries/(?:.+?)", From 557ef70f55adc5c3bd3b69d5c10cf029d4bca491 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:14:25 +0800 Subject: [PATCH 2/2] :bug: fix app auth regex --- githubkit/auth/_url.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/githubkit/auth/_url.py b/githubkit/auth/_url.py index 26e9fc116..8e0c70f9b 100644 --- a/githubkit/auth/_url.py +++ b/githubkit/auth/_url.py @@ -3,7 +3,7 @@ import httpx APP_ROUTES = { - r"^/app", + r"/app", r"/app/hook/config", r"/app/hook/deliveries", r"/app/hook/deliveries/(?:.+?)", @@ -26,7 +26,7 @@ } BYPASS_REGEX = re.compile(r"/login/(oauth/access_token|device/code)$") -APP_AUTH_REGEX = re.compile(rf"(?:{'|'.join(APP_ROUTES)})[^/]*$", re.I) +APP_AUTH_REGEX = re.compile(rf"^(?:{'|'.join(APP_ROUTES)})$", re.I) BASIC_AUTH_REGEX = re.compile(r"/applications/[^/]+/(token|grant)s?") OAUTH_BASE_REGEX = re.compile(r"^https://(api\.)?github\.com/?$")