Scrub tracked API key material

This commit is contained in:
Brandon Schneider 2026-05-11 22:25:43 -05:00
parent 731d470d47
commit 6135c7752b
8 changed files with 37 additions and 34 deletions

View file

@ -131,7 +131,7 @@ cd rust
```bash
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
export ANTHROPIC_AUTH_TOKEN="local-dev-token"
export ANTHROPIC_AUTH_TOKEN="YOUR_ANTHROPIC_AUTH_TOKEN"
cd rust
./target/debug/claw --model "claude-sonnet-4-6" prompt "reply with the word ready"
@ -141,7 +141,7 @@ cd rust
```bash
export OPENAI_BASE_URL="http://127.0.0.1:8000/v1"
export OPENAI_API_KEY="local-dev-token"
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
cd rust
./target/debug/claw --model "qwen2.5-coder" prompt "reply with the word ready"
@ -161,7 +161,7 @@ cd rust
```bash
export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
export OPENAI_API_KEY="sk-or-v1-..."
export OPENAI_API_KEY="YOUR_OPENROUTER_API_KEY"
cd rust
./target/debug/claw --model "openai/gpt-4.1-mini" prompt "summarize this repository in one sentence"

View file

@ -1,4 +1,5 @@
sk-kimi-DtgIkChtw8kvJztv2vnNGtKhkntDb1OUTLQv5TvnsEM5PM7Gf0ULJRmF0zjROBdx
# API Information
API ID Name Create time Key Status Action
19d7e43e-c192-838e-8000-0000922956d4 Research Stack 04/11/2026, 03:37:53 PM sk-ki...ROBdx Enabled
Do not store provider API keys, API inventory exports, or credential table dumps in this file.
Use environment variables or a local ignored secret store instead.

View file

@ -1158,7 +1158,7 @@ mod tests {
#[test]
fn oauth_token_maps_to_bearer_auth_source() {
let auth = AuthSource::from(OAuthTokenSet {
access_token: "access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh".to_string()),
expires_at: Some(123),
scopes: vec!["scope:a".to_string()],
@ -1187,7 +1187,7 @@ mod tests {
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
std::env::remove_var("ANTHROPIC_API_KEY");
save_oauth_credentials(&runtime::OAuthTokenSet {
access_token: "saved-access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh".to_string()),
expires_at: Some(now_unix_timestamp() + 300),
scopes: vec!["scope:a".to_string()],
@ -1205,13 +1205,13 @@ mod tests {
#[test]
fn oauth_token_expiry_uses_expires_at_timestamp() {
assert!(oauth_token_is_expired(&OAuthTokenSet {
access_token: "access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: None,
expires_at: Some(1),
scopes: Vec::new(),
}));
assert!(!oauth_token_is_expired(&OAuthTokenSet {
access_token: "access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: None,
expires_at: Some(now_unix_timestamp() + 60),
scopes: Vec::new(),
@ -1226,7 +1226,7 @@ mod tests {
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
std::env::remove_var("ANTHROPIC_API_KEY");
save_oauth_credentials(&runtime::OAuthTokenSet {
access_token: "expired-access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh-token".to_string()),
expires_at: Some(1),
scopes: vec!["scope:a".to_string()],
@ -1258,7 +1258,7 @@ mod tests {
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
std::env::remove_var("ANTHROPIC_API_KEY");
save_oauth_credentials(&runtime::OAuthTokenSet {
access_token: "saved-access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh".to_string()),
expires_at: Some(now_unix_timestamp() + 300),
scopes: vec!["scope:a".to_string()],
@ -1282,7 +1282,7 @@ mod tests {
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
std::env::remove_var("ANTHROPIC_API_KEY");
save_oauth_credentials(&runtime::OAuthTokenSet {
access_token: "expired-access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh-token".to_string()),
expires_at: Some(1),
scopes: vec!["scope:a".to_string()],
@ -1314,7 +1314,7 @@ mod tests {
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
std::env::remove_var("ANTHROPIC_API_KEY");
save_oauth_credentials(&runtime::OAuthTokenSet {
access_token: "expired-access-token".to_string(),
access_token: "dummy-access-token".to_string(),
refresh_token: Some("refresh-token".to_string()),
expires_at: Some(1),
scopes: vec!["scope:a".to_string()],
@ -1475,8 +1475,8 @@ mod tests {
#[test]
fn auth_source_applies_headers() {
let auth = AuthSource::ApiKeyAndBearer {
api_key: "test-key".to_string(),
bearer_token: "proxy-token".to_string(),
api_key: "dummy-api-key".to_string(),
bearer_token: "dummy-bearer-token".to_string(),
};
let request = auth
.apply(reqwest::Client::new().post("https://example.test"))
@ -1705,8 +1705,8 @@ mod tests {
fn enrich_bearer_auth_error_skips_hint_when_api_key_header_is_also_present() {
// given
let auth = AuthSource::ApiKeyAndBearer {
api_key: "sk-ant-api03-legitimate".to_string(),
bearer_token: "sk-ant-api03-deadbeef".to_string(),
api_key: "dummy-api-key".to_string(),
bearer_token: "dummy-bearer-token".to_string(),
};
let error = crate::error::ApiError::Api {
status: reqwest::StatusCode::UNAUTHORIZED,
@ -1731,7 +1731,7 @@ mod tests {
#[test]
fn enrich_bearer_auth_error_ignores_401_when_auth_source_has_no_bearer() {
// given
let auth = AuthSource::ApiKey("sk-ant-api03-legitimate".to_string());
let auth = AuthSource::ApiKey("dummy-api-key".to_string());
let error = crate::error::ApiError::Api {
status: reqwest::StatusCode::UNAUTHORIZED,
error_type: Some("authentication_error".to_string()),

View file

@ -688,9 +688,9 @@ mod tests {
ANTHROPIC_API_KEY=plain-value
XAI_API_KEY=\"quoted-value\"
OPENAI_API_KEY='single-quoted'
OPENAI_API_KEY='quoted-openai-value'
export GROK_API_KEY=exported-value
PADDED_KEY = padded-value
PADDED_KEY = padded-value
EMPTY_VALUE=
NO_EQUALS_LINE
";
@ -709,7 +709,7 @@ NO_EQUALS_LINE
);
assert_eq!(
values.get("OPENAI_API_KEY").map(String::as_str),
Some("single-quoted")
Some("quoted-openai-value")
);
assert_eq!(
values.get("GROK_API_KEY").map(String::as_str),

View file

@ -8,14 +8,16 @@ from infra.deepseek_adapter import DeepSeekV4
def solve_famm_sorry():
# Use DeepSeek API for better reliability
api_key = "sk-62e23a21b1054ae2986b97876e5c1265"
api_key = os.environ.get("DEEPSEEK_API_KEY", "")
if not api_key:
raise RuntimeError("DEEPSEEK_API_KEY is required")
client = DeepSeekV4(api_key=api_key, use_local=False)
model = "deepseek-v4-pro"
file_path = "/home/allaun/Documents/Research Stack/0-Core-Formalism/lean/Semantics/Semantics/FAMM.lean"
with open(file_path, 'r') as f:
content = f.read()
prompt = f"""
You are a Lean 4 formalization expert.
The following Lean 4 file `FAMM.lean` has duplicate definitions and 'sorry' axioms.
@ -32,7 +34,7 @@ Provide the complete refactored file content in a code block.
print(f"Sending request to {model}...")
messages = [{"role": "user", "content": prompt}]
try:
res = client.chat(messages, model=model)
# Check if it's Ollama response format
@ -40,18 +42,18 @@ Provide the complete refactored file content in a code block.
new_content = res["message"]["content"]
else:
new_content = res["choices"][0]["message"]["content"]
# Extract from code block
if "```lean" in new_content:
new_content = new_content.split("```lean")[1].split("```")[0].strip()
elif "```" in new_content:
new_content = new_content.split("```")[1].split("```")[0].strip()
output_path = "/home/allaun/Documents/Research Stack/scratch/FAMM_refactored.lean"
with open(output_path, 'w') as f:
f.write(new_content)
print(f"Refactored file saved to {output_path}")
except Exception as e:
print(f"Error: {e}")

View file

@ -34,11 +34,11 @@ Forbidden exposure:
## Environment
```bash
export TOPOLOGICAL_ENGINE_TOKEN="long-random-private-token-at-least-32-chars"
export TOPOLOGICAL_ENGINE_TOKEN="YOUR_TOPOLOGICAL_ENGINE_TOKEN"
export OBSIDIAN_VAULT_PATH="/absolute/path/to/private/obsidian-vault"
export NEO4J_URI="bolt://127.0.0.1:7687"
export NEO4J_USER="neo4j"
export NEO4J_PASSWORD="use-a-local-secret-manager"
export NEO4J_PASSWORD="YOUR_NEO4J_PASSWORD"
```
Never store secrets in GitHub, Notion, Google Drive, or Obsidian notes.

View file

@ -33,7 +33,7 @@ Forbidden exposure:
## Environment
```bash
export WOLFRAM_CONNECTOR_TOKEN="long-random-private-token-at-least-32-chars"
export WOLFRAM_CONNECTOR_TOKEN="YOUR_WOLFRAM_CONNECTOR_TOKEN"
export WOLFRAM_APP_ID="your-private-wolfram-alpha-app-id"
export WOLFRAM_MAX_QUERY_CHARS=1600
export WOLFRAM_TIMEOUT_MS=15000

View file

@ -34,11 +34,11 @@ Forbidden exposure:
## Environment
```bash
export TOPOLOGICAL_ENGINE_TOKEN="long-random-private-token-at-least-32-chars"
export TOPOLOGICAL_ENGINE_TOKEN="YOUR_TOPOLOGICAL_ENGINE_TOKEN"
export OBSIDIAN_VAULT_PATH="/absolute/path/to/private/obsidian-vault"
export NEO4J_URI="bolt://127.0.0.1:7687"
export NEO4J_USER="neo4j"
export NEO4J_PASSWORD="use-a-local-secret-manager"
export NEO4J_PASSWORD="YOUR_NEO4J_PASSWORD"
```
Never store secrets in GitHub, Notion, Google Drive, or Obsidian notes.