Secret Storage Risks

Comments focus on the security risks and pitfalls of storing and managing secrets like API keys and passwords in code, memory, logs, or through methods like hashing, with debates on exposure vulnerabilities and better practices like asymmetric cryptography.

➡️ Stable 0.5x Security
2,069
Comments
20
Years Active
5
Top Authors
#995
Topic ID

Activity Over Time

2007
2
2008
7
2009
10
2010
27
2011
42
2012
60
2013
93
2014
94
2015
104
2016
100
2017
138
2018
146
2019
128
2020
158
2021
159
2022
216
2023
189
2024
179
2025
188
2026
29

Keywords

e.g OK PIN RSA JSON NET HTTP IV SecureString QR secrets secret memory keys token password url certs env securely

Sample Comments

tough Apr 10, 2023 View on HN

Sounds like really nice plausible deniability for whomever came up with such a blatant wrong way of storing secrets/value

griffinmb May 22, 2017 View on HN

I'm sure it's possible to do this securely, but in general this seems like a sure-fire way to expose your secret keys.

stilldavid Nov 20, 2018 View on HN

I'd be more concerned if you used this for actual secrets.

pluto_modadic Sep 8, 2025 View on HN

I've known users to type passwords in the username field. you implicitly do NOT know all secrets (e.g., a password is hashed).secrets can also churn, so even if you did your example would require something besides an in-memory array.and, the final point: what if your secret masking code fails on an exception, too ;)

lrusnac Feb 17, 2017 View on HN

sure, but it's more likely for somebody that doesn't know about this service to publish a secret than someone that is aware of it

Certhas Apr 6, 2019 View on HN

Because the secret is never in memory, wouldn't it exactly be safe against all the attacks you mention?

throw1234651234 Oct 12, 2023 View on HN

You can't keep secrets in code most of the time.

garethadams Apr 13, 2017 View on HN

"can get the original secret" is a phrase which should worry a security-conscious person

jhasse Jun 19, 2016 View on HN

It's a good idea if you're using a secure secret or if an attacker doesn't know your exact method.

CaveTech Feb 14, 2017 View on HN

You leak your secret key to every user who can view that page.