From f3c75f9e3fa682b0f4756ab102cfe93f1615facb Mon Sep 17 00:00:00 2001 From: pedro-cf Date: Wed, 29 May 2024 22:03:27 +0100 Subject: [PATCH 1/5] basic_auth bugfix --- stac_fastapi/core/stac_fastapi/core/basic_auth.py | 2 +- stac_fastapi/tests/basic_auth/test_basic_auth.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stac_fastapi/core/stac_fastapi/core/basic_auth.py b/stac_fastapi/core/stac_fastapi/core/basic_auth.py index c504978d..e9964b62 100644 --- a/stac_fastapi/core/stac_fastapi/core/basic_auth.py +++ b/stac_fastapi/core/stac_fastapi/core/basic_auth.py @@ -61,7 +61,7 @@ def has_access( ) permissions = user.get("permissions", []) - path = request.url.path + path = request.scope.get("route").path method = request.method if permissions == "*": diff --git a/stac_fastapi/tests/basic_auth/test_basic_auth.py b/stac_fastapi/tests/basic_auth/test_basic_auth.py index 0515364b..95be59ee 100644 --- a/stac_fastapi/tests/basic_auth/test_basic_auth.py +++ b/stac_fastapi/tests/basic_auth/test_basic_auth.py @@ -74,7 +74,7 @@ async def test_delete_resource_insufficient_permissions(app_client_basic_auth, c assert response.status_code == 403 assert response.json() == { - "detail": "Insufficient permissions for [DELETE /collections/test-collection]" + "detail": "Insufficient permissions for [DELETE /collections/{collection_id}]" } From d45643c98d5ab954def3b4c0c7106b59420cf90a Mon Sep 17 00:00:00 2001 From: pedro-cf Date: Thu, 30 May 2024 12:47:23 +0100 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b1f14f..9c746277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - API sort extension tests [#264](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/264) +- Basic auth permission fix for checking route path instead of absolute path [266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) ## [v3.0.0a1] From 32cc57f15616d7b4ba3ab25a596d2d75a1acfea2 Mon Sep 17 00:00:00 2001 From: pedro-cf Date: Thu, 30 May 2024 12:48:33 +0100 Subject: [PATCH 3/5] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9532bc5..1622f476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - API sort extension tests [#264](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/264) -- Basic auth permission fix for checking route path instead of absolute path [266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) +- Basic auth permission fix for checking route path instead of absolute path [#266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) ## [v3.0.0a1] From 051cbbd41b616785d9cc8ba25b59aae1de3e20e6 Mon Sep 17 00:00:00 2001 From: pedro-cf Date: Thu, 30 May 2024 12:48:42 +0100 Subject: [PATCH 4/5] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1622f476..0ff79f1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - API sort extension tests [#264](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/264) -- Basic auth permission fix for checking route path instead of absolute path [#266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) +- Basic auth permission fix for checking route path instead of absolute path [#266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) ## [v3.0.0a1] From 992456679dbcf5508eaff48589818b30d0ff10cd Mon Sep 17 00:00:00 2001 From: pedro-cf Date: Thu, 30 May 2024 12:48:58 +0100 Subject: [PATCH 5/5] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ff79f1e..a88e32a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - API sort extension tests [#264](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/264) -- Basic auth permission fix for checking route path instead of absolute path [#266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) +- Basic auth permission fix for checking route path instead of absolute path [#266](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/266) ## [v3.0.0a1]