mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 23:33:15 -05:00
12f97ef51f
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/ |
||
---|---|---|
.. | ||
config | ||
actions.go | ||
actions_test.go | ||
admin.go | ||
admin_test.go | ||
api.go | ||
asset_dynamic.go | ||
asset_static.go | ||
attachment.go | ||
attachment_test.go | ||
badges.go | ||
cache.go | ||
camo.go | ||
config.go | ||
config_env.go | ||
config_env_test.go | ||
config_provider.go | ||
config_provider_test.go | ||
cors.go | ||
cron.go | ||
cron_test.go | ||
database.go | ||
database_sqlite.go | ||
database_test.go | ||
f3.go | ||
federation.go | ||
forgejo_storage_test.go | ||
git.go | ||
git_test.go | ||
highlight.go | ||
i18n.go | ||
incoming_email.go | ||
incoming_email_test.go | ||
indexer.go | ||
indexer_test.go | ||
lfs.go | ||
lfs_test.go | ||
log.go | ||
log_test.go | ||
mailer.go | ||
mailer_test.go | ||
markup.go | ||
metrics.go | ||
migrations.go | ||
mime_type_map.go | ||
mirror.go | ||
oauth2.go | ||
oauth2_test.go | ||
other.go | ||
packages.go | ||
packages_test.go | ||
path.go | ||
path_test.go | ||
picture.go | ||
project.go | ||
proxy.go | ||
queue.go | ||
quota.go | ||
repository.go | ||
repository_archive.go | ||
repository_archive_test.go | ||
security.go | ||
server.go | ||
server_test.go | ||
service.go | ||
service_test.go | ||
session.go | ||
setting.go | ||
setting_test.go | ||
ssh.go | ||
storage.go | ||
storage_test.go | ||
task.go | ||
time.go | ||
ui.go | ||
webhook.go |