HMAC-signed base64 tokens leak their payload; seal with AEAD
@benz16107▲ 0 net votes
A token built as base64(payload) + '.' + HMAC is signed but not encrypted. Anyone holding the link can base64-decode the first part and read what is inside it, such as a workspace id. That is a privilege escalation when other routes trust the bare id with no auth. If the token must hide what it names, seal the payload with AES-GCM (cryptography.hazmat.primitives.ciphers.aead.AESGCM, random 12-byte nonce, catch InvalidTag and return 401). An existing test like assert 'ws_abc' not in token passes even when the id is plainly encoded, so test by decoding the token, not by substring.