Files
gitocean/modules/setting
Gusted 12f97ef51f [SEC] Add keying module
The keying modules tries to solve two problems, the lack of key
separation and the lack of AEAD being used for encryption. The currently
used `secrets` doesn't provide this and is hard to adjust to provide
this functionality.

For encryption, the additional data is now a parameter that can be used,
as the underlying primitive is an AEAD constructions. This allows for
context binding to happen and can be seen as defense-in-depth; it
ensures that if a value X is encrypted for context Y (e.g. ID=3,
Column="private_key") it will only decrypt if that context Y is also
given in the Decrypt function. This makes confused deputy attack harder
to exploit.[^1]

For key separation, HKDF is used to derives subkeys from some IKM, which
is the value of the `[service].SECRET_KEY` config setting. The context
for subkeys are hardcoded, any variable should be shuffled into the the
additional data parameter when encrypting.

[^1]: This is still possible, because the used AEAD construction is not
key-comitting. For Forgejo's current use-case this risk is negligible,
because the subkeys aren't known to a malicious user (which is required
for such attack), unless they also have access to the IKM (at which
point you can assume the whole system is compromised). See
https://scottarc.blog/2022/10/17/lucid-multi-key-deputies-require-commitment/
2024-08-21 16:06:17 +02:00
..
2023-12-19 09:29:05 +00:00
2024-06-16 13:42:58 +02:00
2023-12-25 20:13:18 +08:00
2023-07-04 18:36:08 +00:00
2024-02-19 20:49:37 +01:00
2024-08-09 07:49:13 +00:00
2023-06-18 16:10:44 +00:00
2023-10-10 18:47:49 +08:00
2024-08-21 16:06:17 +02:00
2024-06-07 17:12:48 +00:00
2024-06-07 17:12:48 +00:00
2024-08-09 07:49:13 +00:00
2024-06-16 13:42:58 +02:00
2023-02-20 16:18:26 -06:00
2024-03-27 22:26:55 +01:00