I was working on a Discourse forum – v2.0.0.beta9 – recently, when I spotted the Files tab of the administrative settings. I was surprised to see the S3 secret key displayed to the user, and I was horrified to observe that my changes to it were echoed, in full, in the dashboard logs.
This means that an attacker who manages to simply observe the Files tab has the ability to seize and delete Discourse backups during a rampage.
Please consider not displaying the secret key to even administrative users, and simply noting who changed the key and when in the audit trail.
They can see it when they set it, but when the UI is loaded, that field should be blank. If somebody shoulder-surfs me they should see the userID and the blank password field, just like the password-change dialogue on every user account page on every website I’ve encountered since the mid-2000s.
Well, my preference would be to standardize on the usual behavior – it should not appear even to the administrator; there should be a field where the administrator sets it, and it should load /blank/ instead of filled. Honestly, the only time I ever see click-to-reveal is when you’re dealing with something designed to store sets of credentials, not a single one, but click-to-reveal would resolve that half of it, yes.
Either way, though, the log entries that show setting changes that echo the password back in plaintext are… not a common behavior.
Do you have any thoughts on how we could improve here @mpalmer? It is a Discourse core value™ to be safe by default, so it is worth thinking about any small things we can improve here as we go.
Logging changes to sensitive data: I think that definitely needs to be fixed. We scrub passwords and API keys from logs, the same thing should definitely apply to S3 secret keys, IMO.
Shoulder-surfing creds: Leaving the box blank, even though there’s a value set, seems like a UX nightmare – I predict “I entered the S3 key and now it’s gone!” support requests if we did that. It is handy to be able to check on an entered value to make sure it’s right – I’ve noticed a steady increase in the number of password entry boxes that have “click to show” ability. That seems like a reasonable middle ground to me – hide it behind dots or something by default, with a “click to show” option.
I think we should do part 1 in the 2.0 release, @techapj can you assist? It seems relatively straightforward, if we are doing it elsewhere? Let me know if it is not.
Since I’m sure more sensitive settings will appear in the future, and plugins may add some also, would it be particularly tricky to add the ability to mark “sensitive” site settings as such in site_settings.yml?
I presume you’re familiar with the security considerations around instance role creds and SSRF vulnerabilities? It’s quite a pity AWS doesn’t protect the metadata store with a magic header like GCP does.