Do Not Write Contents of Secret Files to app.ini #14880

Open
opened 2025-11-02 11:25:01 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @joebobmiles on GitHub (Aug 19, 2025).

Feature Description

Back in 2023, environment-to-ini was modified to support Docker secrets. However, after reading a secret like the database password from a file, Gitea writes the secret in plaintext to the app.ini file, which is a security concern.

As an example: I have a setup where the database password is encrypted on the host file system. The password is only decrypted when it is passed to Gitea via Docker secrets. Because I also have app.ini mapped to the host file system, Gitea ends up leaking the unencrypted secret back to the host file system in the app.ini.

I'd like to propose that Gitea only stores the *_FILE value for secrets in app.ini and keeps the file contents only in memory.

Screenshots

No response

Originally created by @joebobmiles on GitHub (Aug 19, 2025). ### Feature Description Back in 2023, [environment-to-ini was modified to support Docker secrets](https://github.com/go-gitea/gitea/pull/24832). However, after reading a secret like the database password from a file, Gitea writes the secret in plaintext to the app.ini file, which is a security concern. As an example: I have a setup where the database password is encrypted on the host file system. The password is only decrypted when it is passed to Gitea via Docker secrets. Because I also have app.ini mapped to the host file system, Gitea ends up leaking the unencrypted secret back to the host file system in the app.ini. I'd like to propose that Gitea only stores the *_FILE value for secrets in app.ini and keeps the file contents only in memory. ### Screenshots _No response_
GiteaMirror added the type/proposaltopic/security labels 2025-11-02 11:25:01 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14880