Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/imp/redaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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/(?<![A-Za-z0-9_])[sr]k_live_[A-Za-z0-9]{16,}(?![A-Za-z0-9_])/,
# GitHub classic, OAuth, user-to-server, server and refresh tokens, and
Expand Down
1 change: 1 addition & 0 deletions test/redaction_differential_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ defmodule Imp.RedactionDifferentialTest do
sk = "sk-FAKEopenai" <> 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",
Expand Down
Loading