proxmox/proxmox-auth-api
Stefan Sterz 4d6922e2c4 auth-api: move to hmac signing for csrf tokens
previously we used our own hmac-like implementation for csrf token
signing that simply appended the key to the message (csrf token).
however, this is possibly insecure as an attacker that finds a
collision in the hash function can easily forge a signature. after all,
two messages would then produce the same start conditions before
hashing the key. while this is probably a theoretic attack on our csrf
implementation, it does not hurt to move to the safer standard hmac
implementation that avoids such pitfalls.

this commit re-uses the hmac key wrapper used for the keyring. it also
keeps the old construction around so we can use it for a transition
period between old and new csrf token implementations.

this is a breaking change as it changes the signature of the
`csrf_secret` method of the `AuthContext` trait to return an hmac
key.

also exposes `assemble_csrf_prevention_toke` so we can re-use this
code here instead of duplicating it in e.g. proxmox-backup's
auth_helpers.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2024-05-22 10:26:40 +02:00
..
debian auth-api: bump version to 0.3.5 2024-04-24 21:22:33 +02:00
examples auth-api: fixup examples 2023-07-10 09:06:35 +02:00
src auth-api: move to hmac signing for csrf tokens 2024-05-22 10:26:40 +02:00
Cargo.toml auth-api: bump version to 0.3.5 2024-04-24 21:22:33 +02:00