kiba-core 0.5.3.dev62__tar.gz → 0.5.3.dev63__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/PKG-INFO +1 -1
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/authorizer.py +13 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/kiba_core.egg-info/PKG-INFO +1 -1
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/pyproject.toml +1 -1
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_authorizer.py +31 -1
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/.github/pull_request_template.md +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/.github/workflows/deploy.yml +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/.github/workflows/pull-request.yml +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/.github/workflows/release.yml +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/.gitignore +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/CHANGELOG.md +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/Dockerfile +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/README.md +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/api_request.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/api_response.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/default_routes.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/health.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/json_route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/database_connection_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/exception_handling_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/logging_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/origin_ip_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/server_headers_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/openapi.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/rate_limit.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/request_context.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/route_auth.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/route_metadata.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/streaming_json_route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/aws_requester.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/caching/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/caching/cache.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/caching/dict_cache.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/caching/file_cache.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/exceptions.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/http/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/http/basic_authentication.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/http/jwt.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/http/rest_method.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/logging.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/notifications/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/notifications/discord_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/notifications/notification_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/notifications/slack_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/py.typed +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/aqs.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/cosmos.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/message_queue.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/message_queue_processor.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/model.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/sql.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/queues/sqs.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/requester/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/requester/requester.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/s3_manager.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/service_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/store/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/store/database.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/store/retriever.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/store/saver.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/async_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/chain_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/date_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/dict_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/file_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/hashing_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/http_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/json_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/list_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/string_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/typing_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/url_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/util/value_holder.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/web3/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/web3/eth_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/web3/multicall3.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/kiba_core.egg-info/SOURCES.txt +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/kiba_core.egg-info/dependency_links.txt +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/kiba_core.egg-info/requires.txt +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/kiba_core.egg-info/top_level.txt +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/makefile +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/setup.cfg +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_api_response.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_exception_handling_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_json_route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_openapi.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_origin_ip_middleware.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_rate_limit.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_request_context.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_streaming_json_route.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/caching/test_dict_cache.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/caching/test_file_cache.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/requester/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/requester/test_requester.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/test_database.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/test_exceptions.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_async_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_chain_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_date_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_dict_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_file_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_json_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_list_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_string_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/util/test_url_util.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/web3/__init__.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/web3/test_rest_eth_client.py +0 -0
- {kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/uv.lock +0 -0
|
@@ -135,6 +135,19 @@ async def authorize_static_token_request[ApiRequest: BaseModel](request: KibaApi
|
|
|
135
135
|
raise ForbiddenException(message='AUTH_INVALID')
|
|
136
136
|
|
|
137
137
|
|
|
138
|
+
async def authorize_static_header_request[ApiRequest: BaseModel](
|
|
139
|
+
request: KibaApiRequest[ApiRequest],
|
|
140
|
+
*,
|
|
141
|
+
headerName: str,
|
|
142
|
+
token: str,
|
|
143
|
+
) -> None:
|
|
144
|
+
providedToken = request.headers.get(headerName)
|
|
145
|
+
if providedToken is None:
|
|
146
|
+
raise ForbiddenException(message='AUTH_NOT_PROVIDED')
|
|
147
|
+
if not hmac.compare_digest(providedToken, token):
|
|
148
|
+
raise ForbiddenException(message='AUTH_INVALID')
|
|
149
|
+
|
|
150
|
+
|
|
138
151
|
def authorize_token[ApiRequest: BaseModel]( # type: ignore[explicit-any]
|
|
139
152
|
authorizer: TokenAuthorizer,
|
|
140
153
|
*,
|
|
@@ -7,7 +7,7 @@ from starlette.routing import Route
|
|
|
7
7
|
from starlette.testclient import TestClient
|
|
8
8
|
|
|
9
9
|
from core.api.api_request import KibaApiRequest
|
|
10
|
-
from core.api.authorizer import Authorizer, SignatureAuthorizer, StaticTokenAuthorizer, authorize_bearer_jwt, authorize_signature, authorize_token
|
|
10
|
+
from core.api.authorizer import Authorizer, SignatureAuthorizer, StaticTokenAuthorizer, authorize_bearer_jwt, authorize_signature, authorize_static_header_request, authorize_token
|
|
11
11
|
from core.api.json_route import json_route
|
|
12
12
|
from core.api.middleware.exception_handling_middleware import ExceptionHandlingMiddleware
|
|
13
13
|
from core.api.streaming_json_route import streaming_json_route
|
|
@@ -133,6 +133,18 @@ def token_streaming_client():
|
|
|
133
133
|
return TestClient(app, raise_server_exceptions=False)
|
|
134
134
|
|
|
135
135
|
|
|
136
|
+
@pytest.fixture
|
|
137
|
+
def static_header_json_client():
|
|
138
|
+
@json_route(requestType=SimpleRequest, responseType=SimpleResponse)
|
|
139
|
+
async def protected_endpoint(request: KibaApiRequest[SimpleRequest]) -> SimpleResponse:
|
|
140
|
+
await authorize_static_header_request(request=request, headerName='X-Test-Webhook-Secret', token=VALID_STATIC_TOKEN)
|
|
141
|
+
return SimpleResponse(result=request.data.value)
|
|
142
|
+
|
|
143
|
+
app = Starlette(routes=[Route('/protected', protected_endpoint, methods=['POST'])])
|
|
144
|
+
app.add_middleware(ExceptionHandlingMiddleware)
|
|
145
|
+
return TestClient(app, raise_server_exceptions=False)
|
|
146
|
+
|
|
147
|
+
|
|
136
148
|
# --- authorize_bearer_jwt + json_route ---
|
|
137
149
|
|
|
138
150
|
def test_jwt_json_no_auth_header_returns_403(jwt_json_client):
|
|
@@ -235,6 +247,24 @@ def test_token_json_valid_token_returns_200(token_json_client):
|
|
|
235
247
|
assert response.json()['result'] == 'hello'
|
|
236
248
|
|
|
237
249
|
|
|
250
|
+
# --- authorize_static_header_request + json_route ---
|
|
251
|
+
|
|
252
|
+
def test_static_header_json_no_secret_returns_403(static_header_json_client):
|
|
253
|
+
response = static_header_json_client.post('/protected', json={'value': 'hello'})
|
|
254
|
+
assert response.status_code == 403
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def test_static_header_json_invalid_secret_returns_403(static_header_json_client):
|
|
258
|
+
response = static_header_json_client.post('/protected', json={'value': 'hello'}, headers={'X-Test-Webhook-Secret': 'wrong-token'})
|
|
259
|
+
assert response.status_code == 403
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def test_static_header_json_valid_secret_returns_200(static_header_json_client):
|
|
263
|
+
response = static_header_json_client.post('/protected', json={'value': 'hello'}, headers={'X-Test-Webhook-Secret': VALID_STATIC_TOKEN})
|
|
264
|
+
assert response.status_code == 200
|
|
265
|
+
assert response.json()['result'] == 'hello'
|
|
266
|
+
|
|
267
|
+
|
|
238
268
|
# --- authorize_token + streaming_json_route ---
|
|
239
269
|
|
|
240
270
|
def test_token_streaming_no_auth_header_returns_403(token_streaming_client):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/exception_handling_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/core/api/middleware/server_headers_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kiba_core-0.5.3.dev62 → kiba_core-0.5.3.dev63}/tests/api/test_exception_handling_middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|