diff --git a/lib/imp/redaction.ex b/lib/imp/redaction.ex index cc7d664e..ae0a01d9 100644 --- a/lib/imp/redaction.ex +++ b/lib/imp/redaction.ex @@ -917,8 +917,9 @@ defmodule Imp.Redaction do # encrypted), a PGP private key block, a PuTTY key file. ~r/-----BEGIN [A-Z0-9 ]{0,40}PRIVATE KEY(?: BLOCK)?-----/, ~r/PuTTY-User-Key-File-[0-9]+:/, - # OpenAI (`sk-`, `sk-proj-`), Anthropic (`sk-ant-`), OpenRouter (`sk-or-`). - ~r/(?:\A|[^A-Za-z0-9_-])sk-[A-Za-z0-9_-]{8,}(?=\z|[^A-Za-z0-9_-])/, + # OpenAI (`sk-`, `sk-proj-`), Anthropic (`sk-ant-`), OpenRouter (`sk-or-`), + # also right after a hyphen (`x-sk-...`), as a word boundary allows. + ~r/(?:\A|[^A-Za-z0-9_])sk-[A-Za-z0-9_-]{8,}(?=\z|[^A-Za-z0-9_-])/, # Stripe secret and restricted live keys. ~r/(? String.duplicate("a1", 12) [ + {"key after a hyphen", "flag x-#{sk} set\n"}, {"printenv", "HOME=/root\nOPENAI_API_KEY=#{sk}\nSECRET_KEY_BASE=FAKEskbQQQQQQQQQQQQ\nPGPASSWORD=FAKEpgpass99\nRELEASE_COOKIE=FAKEcookie\nSTRIPE_KEY=FAKEstripeplain\n"}, {"curl -v",