Repository navigation
feat(backend): switch API token storage to hmac digest - #12850
Conversation
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12850 +/- ##
==========================================
+ Coverage 87.25% 87.30% +0.05%
==========================================
Files 1501 1502 +1
Lines 101997 102139 +142
Branches 11654 11557 -97
==========================================
+ Hits 88994 89173 +179
+ Misses 12938 12901 -37
Partials 65 65
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
allign token prefix and token end (add date issuance)
|
@SchrodingersGat @wolflu05 ready for review; this should fix security issues where a staff user is able to read out a superusers or other users api key and such can gain more right than they originally had. I have kept this PR pretty minimal but there are some other areas in which the schema might be altert in the future or this PR if you find it prudent:
One thing that worries me a bit: rotating a secret key now means all tokens are invalid; is this something we need to address or is that acceptable? |
|
@matmair looks good in general, I think that the existing token docs ( |
- revocation details (reason, revoker) - issueance - version - pepper
i have extended the docs in this regard and added a few more fields to make this revocation behavior transparent to users / admins |
|
API version needs a bump also? |
Replaces the old token which are stored in plaintext with a peppered version that uses a HMAC-SHA265 zu ensure that gaining database read access via a sidechannel or IDOR attack is not causing a privilege escalation. For now the secret key is used as a pepper; that might be replaced with a rotating pepper in the future.
After merge only v2 tokens (which are slightly longer and have a slightly different format) will be issued. Old issues keep being valid but there is no API path to issue them. As a breaking change in the future we might remove those code paths.
There a 2 things in here that I consider breaking:
Fixes #12027