fix(ci): replace sk-ant- prefixed test placeholders

Pipelock secret scanner pattern-matches `sk-ant-*` as a real Anthropic
API key and fails the PR security-scan check. Test stubs and
ClimateControl env values used `sk-ant-test`, `sk-ant-from-setting`,
`sk-ant-x`, `sk-ant-y` as obvious placeholders, but the scanner does
not care about value entropy.

Switched to `fake-anthropic-key-*` / `fake-token-*` strings so the
scanner stops flagging them. No production code touched, no behavior
change — Provider::Anthropic still accepts any non-blank token.
This commit is contained in:
Guillem Arias
2026-05-29 14:50:49 +02:00
parent 5ab9bb33d6
commit 4b511c4dad
2 changed files with 4 additions and 4 deletions

View File

@@ -67,11 +67,11 @@ class Provider::AnthropicTest < ActiveSupport::TestCase
Setting.stubs(:anthropic_access_token).returns(nil)
assert_not Provider::Anthropic.configured?
Setting.stubs(:anthropic_access_token).returns("sk-ant-x")
Setting.stubs(:anthropic_access_token).returns("fake-token-1")
assert Provider::Anthropic.configured?
end
ClimateControl.modify("ANTHROPIC_API_KEY" => "sk-ant-y") do
ClimateControl.modify("ANTHROPIC_API_KEY" => "fake-token-2") do
Setting.stubs(:anthropic_access_token).returns(nil)
assert Provider::Anthropic.configured?
end

View File

@@ -62,7 +62,7 @@ class Provider::RegistryTest < ActiveSupport::TestCase
end
test "anthropic provider initializes from ANTHROPIC_API_KEY env" do
ClimateControl.modify("ANTHROPIC_API_KEY" => "sk-ant-test", "ANTHROPIC_ACCESS_TOKEN" => nil) do
ClimateControl.modify("ANTHROPIC_API_KEY" => "fake-anthropic-key-for-tests", "ANTHROPIC_ACCESS_TOKEN" => nil) do
Setting.stubs(:anthropic_access_token).returns(nil)
provider = Provider::Registry.get_provider(:anthropic)
@@ -78,7 +78,7 @@ class Provider::RegistryTest < ActiveSupport::TestCase
"ANTHROPIC_BASE_URL" => "",
"ANTHROPIC_MODEL" => ""
) do
Setting.stubs(:anthropic_access_token).returns("sk-ant-from-setting")
Setting.stubs(:anthropic_access_token).returns("fake-anthropic-key-from-setting")
Setting.stubs(:anthropic_base_url).returns(nil)
Setting.stubs(:anthropic_model).returns(nil)