feat: dynamic App API tokens - #11670
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11670 +/- ##
==========================================
- Coverage 88.73% 88.72% -0.01%
==========================================
Files 337 338 +1
Lines 45313 45376 +63
==========================================
+ Hits 40209 40261 +52
- Misses 5104 5115 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| class AppApiToken(models.Model): | ||
| endpoints = models.ManyToManyField("api.KnownApiEndpoint", related_name="tokens") | ||
| token = models.CharField( |
There was a problem hiding this comment.
Do we want to keep hashed token here? Similar to PersonalApiKey1?
Footnotes
There was a problem hiding this comment.
Hashing it is a good idea in principle. Need to think about the tradeoffs here (the concern about operators seeing the value is not as significant as it is with user-owned secrets)
There was a problem hiding this comment.
I think you're right, hashing is the right thing to do.
I updated to store the hash instead. That requires a more sophisticated admin interface to support, so I added that, too.
Adds Django model-backed API tokens alongside the existing settings-backed ones. Uses Django admin for management.
This works, but is draft for discussion. Also, must update the database snapshot process to clear out this table when producing dev database snapshots.
Still needs aResourceclass (which should refuse to serve the models at all)Disabled the
apiapp from the v1 API. This causes a request for/api/v1/api/to 404 instead of returning{}as it does at present.