1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-28 19:06:12 +01:00
unleash.unleash/website/docs
Gastón Fournier 70499dc1d4
feat: allow api token middleware to fetch from db (#6344)
## About the changes
When edge is configured to automatically generate tokens, it requires
the token to be present in all unleash instances.
It's behind a flag which enables us to turn it on on a case by case
scenario.

The risk of this implementation is that we'd be adding load to the
database in the middleware that evaluates tokens (which are present in
mostly all our API calls. We only query when the token is missing but
because the /client and /frontend endpoints which will be the affected
ones are high throughput, we want to be extra careful to avoid DDoSing
ourselves

## Alternatives:
One alternative would be that we merge the two endpoints into one.
Currently, Edge does the following:
If the token is not valid, it tries to create a token using a service
account token and /api/admin/create-token endpoint. Then it uses the
token generated (which is returned from the prior endpoint) to query
/api/frontend. What if we could call /api/frontend with the same service
account we use to create the token? It may sound risky but if the same
application holding the service account token with permission to create
a token, can call /api/frontend via the generated token, shouldn't it be
able to call the endpoint directly?

The purpose of the token is authentication and authorization. With the
two tokens we are authenticating the same app with 2 different
authorization scopes, but because it's the same app we are
authenticating, can't we just use one token and assume that the app has
both scopes?

If the service account already has permissions to create a token and
then use that token for further actions, allowing it to directly call
/api/frontend does not necessarily introduce new security risks. The
only risk is allowing the app to generate new tokens. Which leads to the
third alternative: should we just remove this option from edge?
2024-02-27 16:08:44 +01:00
..
contributing docs: add ADR for logging with error object (#6249) 2024-02-20 13:41:33 +00:00
feature-flag-tutorials docs: Java Tutorial v1 (#6299) 2024-02-22 09:18:17 -05:00
how-to
migrations
reference feat: allow api token middleware to fetch from db (#6344) 2024-02-27 16:08:44 +01:00
topics docs: update images in feature flags best practices to work on dark backgrounds (#6168) 2024-02-09 09:39:40 +09:00
understanding-unleash docs: Minor typos (#6014) 2024-01-23 20:19:06 +01:00
unleash-academy docs: change "time burden" to "time investment" (#6079) 2024-01-31 10:48:28 +00:00
using-unleash fix: Allow AuthType None to use valid API tokens (#6247) 2024-02-16 08:24:56 +00:00
client-specification.md refactor: move docs into new structure / fix links for SEO (#2416) 2022-11-22 09:05:30 +00:00
quickstart.md docs: add missing full stop 2024-02-14 11:45:00 +09:00
welcome.md Navigation refactor (#5227) 2023-10-31 09:38:03 -05:00