Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by comboy on Thursday October 13, 2022 @09:38PM
(#33198680)
TIL: make private key for your service easy to match with regexps
[ Parent
| on HN ]
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by hunter2_ on Friday October 14, 2022 @12:37AM
(#33199678)
Reminds me of how Airbnb redacts Hawaiian street addresses because they look too much like phone numbers, literally replacing them with a "phone number hidden" string in the host|guest chat.
Moral of the story: make your keys regexable without likelihood of false positives!
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by Breza on Tuesday October 25, 2022 @09:38AM
(#33330293)
I spend a lot of time working with physician data. In the USA, physicians have a registration system called NPI. Apparently, NPI numbers are in the same format as some passport numbers. I know this because I started getting angry warnings about PII sharing until I got our tech team to turn them off.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by echelon on Friday October 14, 2022 @12:51AM
(#33199759)
The whole industry should adopt a convention to prefix production keys with a well known prefix, such as "prod_secret_".
We should have our systems and precommit hooks then alert us when those enter places they shouldn't and help us automate rotation.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by jve on Friday October 14, 2022 @04:40AM
(#33201084)
Bad idea. Better do it in DEV like you would do in PROD, not to shoot yourself in the foot. If you do it right in DEV, no problem in PROD.
And what if your DEV is not actually well isolated from PROD/other infra? And what if some real data sneaked into DEV? Etc.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by mewpmewp2 on Friday October 14, 2022 @06:00AM
(#33201536)
I think prod_ might not be the important part there, so something like __secret__ should be enough.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by MattJ100 on Friday October 14, 2022 @06:03AM
(#33201546)
You're not the first with this idea! There exists a standard, see RFC 8959: https://www.rfc-editor.org/rfc/rfc8959.html
Previous HN discussion: https://news.ycombinator.com/item?id=25978185
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by gl-prod on Friday October 14, 2022 @01:49AM
(#33200066)
Yeah, prefixing your keys with your service name like SRVCE_{KEY} is the way to go.
Bonus: adding SRVCE_PRVT_{KEY} and SRVCE_PUB_{KEY}.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by rytis on Friday October 14, 2022 @02:13AM
(#33200175)
And while we're at it, I think saving two chars isn't going to do much to prevent global warming, and let's just use more readable SERVICE_{KEY} and SERVICE_PUB_{KEY} (as opposed to having scratch your head thinking "did I call it SRV, SVC, SRVC, SRVCE, ...?")
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by hawski on Friday October 14, 2022 @04:41AM
(#33201090)
I think OP meant to use the actual name of the service. For example FOOBARINC_{KEY}
I also think that it should look just a bit cryptic to make a person unsure if they can meddle with the string.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by gl-prod on Friday October 14, 2022 @03:37AM
(#33200656)
I meant as an abbreviation, like GitHub becomes ghp_XXXXXXXXX. But yeah anything is better than just random characters.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by miohtama on Friday October 14, 2022 @08:29AM
(#33202609)
There is already RTC 8958 Secret token scheme for this, so you do not need to invent your own prefix
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by throwaway290 on Friday October 14, 2022 @09:33AM
(#33203306)
I see this standard linked here a lot. Did anyone read it though? It only helps with identifying whether a string is a secret, not at all the service or environment where the secret applies.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by miohtama on Friday October 14, 2022 @05:39PM
(#33209119)
If any value does not natively support secret token sceme, you can apply secret-token: prefix and then strip it during the usage.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by GoblinSlayer on Friday October 14, 2022 @05:53AM
(#33201503)
I don't think it's a regex pattern, most keys are random strings.
Re:Toyota Accidently Exposed a Secret Key Publicly on GitHub...
by semiquaver on Friday October 14, 2022 @09:42AM
(#33203380)
That’s the idea. Add a deterministic prefix to make it identifiable as associated with a specific service.