-
Notifications
You must be signed in to change notification settings - Fork 1
Enh/add auth #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enh/add auth #189
Changes from all commits
1b4c726
4eb83e1
e078df6
5e68ead
2776e09
8a2b6e6
0d91e3a
44e4bea
36b88a2
291bff3
c807e88
64a9208
d09ddea
bdcb80a
60829a6
651606b
4aa8beb
115980b
cb05f7f
005cd76
fd86f0e
53d9388
8166f49
453b1ca
1a5a12b
e4dcd64
c00e8be
7786c18
ed1468b
57b8f3c
8c68cbd
ff6f5ac
978ffd3
31fffaa
cc619bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,24 @@ | ||
| """Helper service for viewing redis objects.""" | ||
| import json | ||
| from typing import Dict, List | ||
| from typing import Any, Dict | ||
|
|
||
| from aioredis import Redis | ||
| from fastapi import APIRouter, Depends | ||
| from fastapi_plugins import depends_redis | ||
|
|
||
| from app.models.error import httpexception_404_item_id_does_not_exist | ||
|
|
||
| ROUTER = APIRouter(prefix="/redis") | ||
|
|
||
|
|
||
| @ROUTER.get("/{key}", include_in_schema=False) | ||
| async def get_gey( | ||
| async def get_key( | ||
| key: str, | ||
| cache: Redis = Depends(depends_redis), | ||
| ) -> Dict[str, List[str]]: | ||
| ) -> Dict[str, Any]: | ||
| """Low-level cache interface to retrieve the object-value | ||
| stored with key 'key' | ||
| """ | ||
| if not await cache.exists(key): | ||
| raise httpexception_404_item_id_does_not_exist(key, "key") | ||
| return json.loads(await cache.get(key)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,10 @@ services: | |
| OTEAPI_REDIS_HOST: redis | ||
| OTEAPI_REDIS_PORT: 6379 | ||
| OTEAPI_prefix: "${OTEAPI_prefix:-/api/v1}" | ||
| OTEAPI_INCLUDE_REDISADMIN: "${OTEAPI_INCLUDE_REDISADMIN:-False}" | ||
| OTEAPI_EXPOSE_SECRETS: "${OTEAPI_EXPOSE_SECRETS:-True}" | ||
|
Comment on lines
+13
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait. So by default you don't want to include the Redis admin endpoint (for security reasons) but do want to expose secrets? :/
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the redis admin is not exposed because the secrets are exposed. If the secret strings for the If they are exposed and the redis admin is enabled, you may simply reveal all user's in a configuration through the redis endpoint. For this reason, the chance, that you may remotely inspect the redis-cache from other's users sessions, is lowered since you only can access the redis-cache from the strategies, and not directly through the services anymore. In other words, the motivation is that when you put sensitive/general information into the cache, you cannot reveal it by chance if you only got the config-id, but it still can be used by the strategies internally. Since I did not find any straight-forward user management for redis through an oauth-scheme, I think this is one of the only ways how to deal with this scenario for the moment. Does this make sense to you?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense. Essentially what we need is to hash/encrypt the secrets before storing in redis. That should solve it. The strategies can then get some interface to decrypting the secrets they may need. Or it's done from the service before invoking the strategies. Not very important, but it should circumvent this issue. However that's something for another day and another PR. |
||
| OTEAPI_PLUGIN_PACKAGES: | ||
| OTEAPI_AUTHENTICAION_DEPENDENCIES: | ||
| depends_on: | ||
| - redis | ||
| networks: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.