Do not use AES in CBC mode for encrypting the username in Cookies
We currently use AES CBC by default in order to encrypt the username of the authenticated users in the encrypted session cookies. AES CBC protects only confidentiality and not the integrity ( authenticity ) and an attacker could be able to modify the encrypted value in order to authenticate as any other user.
We should use authenticated encryption instead
This may be as easy as specifying MODE_GCM as the default for https://github.com/rohe/pysaml2/blob/bc6d4cdacd0f66a68c2b0f7bdf9856387776dce8/src/saml2/aes.py#L31 and related calls in that file.
Commenting here as a pointer for anyone looking to implement, as well as for my own ToDo list.
luckily I use cookies inside a wrapper (django) to manage user sessions. I hope this topic has already had a follow up given its delicacy