@@ -81,18 +81,14 @@ into BoltDB. Raw tokens are not stored.
8181To verify tokens when hashed tokens are enabled, the presented token's hash is calculated and used
8282for token index lookup. The rest of the authorization flow is unchanged.
8383
84- To verify tokens when hashed tokens are disabled, the an attempt is made to parse the presented token as
85- PHC. If the parse succeeds, the access is denied. This prevents an attack described below. After this check,
86- the presented raw token is used to lookup the token in the raw token index. If found, authorization proceeds
87- as normal. Otherwise, the token hash is calculated and used to lookup the token in the hashed token index.
88- A second check is then done on the authorization record token or token hash matches the presented token.
89- If found, authorization proceeds as normal.
90-
9184The hashed token index is separate from the raw token index. Newer versions also verify that the token
9285is not a valid PHC string before starting authorization. This prevents the following attack:
93861. Hashed token is extracted from BoltDB.
94872. Token hashing is disabled.
95883. The hashed token is presented to the API, which will misinterpret it as a raw token and allow access.
89+ This attack is not possible due to the independent indices for raw and hashed tokens. When the hashed token
90+ is presented, it will not match any tokens in the raw index. The hashed token will then be hashed again
91+ before lookup in the hashed index, and will not match any tokens.
9692
9793The token hashing algorithm is SHA-512. This provides a good level of security and is allowed by FIPS 140-2.
9894Because the token hashes must be useable as index lookups, salted password hashes (e.g. bcrypt, PBKDF2, Argon)
0 commit comments