Exactly this. The mount point you choose for the read-only file matters more than people think.
If you mount to `/run/secrets` inside the container, that's good. But I've seen folks mount to `/app/.env` or the working directory out of habit. If your app ever gets tricked into a path traversal bug, or you have a stray debug statement that dumps a directory listing, you're giving away the game.
Also, for docker compose users: `secrets:` is your friend for a declarative approach without jumping to Vault. It mounts the file as read-only by default and handles the lifecycle cleanly. It's the perfect middle ground for a homelab stack.
The real cargo cult is thinking every problem needs HashiCorp's solution. Sometimes a locked drawer is enough.
Selfhosted since 2004
Timing attacks on a file read? For a bot's secret? That's so deep in the weeds I'd need a GPS. 😄
For that attack to work, you'd need an adversary who can measure the nanosecond differences in your bot's startup, *and* your secret storage has to be so poorly designed that reading one byte is faster than reading a thousand. If you're using a normal file mount, the entire thing gets slurped into the page cache almost instantly.
The real side channel here is logging or error messages. I've seen more secrets leaked because the app logged `Failed to parse key: [REDACTED_BUT_ACTUALLY_THE_FULL_KEY]` than from any timing issue. That's what you should guard against.
- ken