mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
Scrub tracked API key material
This commit is contained in:
parent
a99e839bab
commit
d440fa3f47
8 changed files with 37 additions and 34 deletions
|
|
@ -131,7 +131,7 @@ cd rust
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
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
|
cd rust
|
||||||
./target/debug/claw --model "claude-sonnet-4-6" prompt "reply with the word ready"
|
./target/debug/claw --model "claude-sonnet-4-6" prompt "reply with the word ready"
|
||||||
|
|
@ -141,7 +141,7 @@ cd rust
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENAI_BASE_URL="http://127.0.0.1:8000/v1"
|
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
|
cd rust
|
||||||
./target/debug/claw --model "qwen2.5-coder" prompt "reply with the word ready"
|
./target/debug/claw --model "qwen2.5-coder" prompt "reply with the word ready"
|
||||||
|
|
@ -161,7 +161,7 @@ cd rust
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
|
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
|
cd rust
|
||||||
./target/debug/claw --model "openai/gpt-4.1-mini" prompt "summarize this repository in one sentence"
|
./target/debug/claw --model "openai/gpt-4.1-mini" prompt "summarize this repository in one sentence"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
sk-kimi-DtgIkChtw8kvJztv2vnNGtKhkntDb1OUTLQv5TvnsEM5PM7Gf0ULJRmF0zjROBdx
|
# API Information
|
||||||
|
|
||||||
API ID Name Create time Key Status Action
|
Do not store provider API keys, API inventory exports, or credential table dumps in this file.
|
||||||
19d7e43e-c192-838e-8000-0000922956d4 Research Stack 04/11/2026, 03:37:53 PM sk-ki...ROBdx Enabled
|
|
||||||
|
Use environment variables or a local ignored secret store instead.
|
||||||
|
|
|
||||||
|
|
@ -1158,7 +1158,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn oauth_token_maps_to_bearer_auth_source() {
|
fn oauth_token_maps_to_bearer_auth_source() {
|
||||||
let auth = AuthSource::from(OAuthTokenSet {
|
let auth = AuthSource::from(OAuthTokenSet {
|
||||||
access_token: "access-token".to_string(),
|
access_token: "dummy-access-token".to_string(),
|
||||||
refresh_token: Some("refresh".to_string()),
|
refresh_token: Some("refresh".to_string()),
|
||||||
expires_at: Some(123),
|
expires_at: Some(123),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1187,7 +1187,7 @@ mod tests {
|
||||||
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
||||||
std::env::remove_var("ANTHROPIC_API_KEY");
|
std::env::remove_var("ANTHROPIC_API_KEY");
|
||||||
save_oauth_credentials(&runtime::OAuthTokenSet {
|
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()),
|
refresh_token: Some("refresh".to_string()),
|
||||||
expires_at: Some(now_unix_timestamp() + 300),
|
expires_at: Some(now_unix_timestamp() + 300),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1205,13 +1205,13 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn oauth_token_expiry_uses_expires_at_timestamp() {
|
fn oauth_token_expiry_uses_expires_at_timestamp() {
|
||||||
assert!(oauth_token_is_expired(&OAuthTokenSet {
|
assert!(oauth_token_is_expired(&OAuthTokenSet {
|
||||||
access_token: "access-token".to_string(),
|
access_token: "dummy-access-token".to_string(),
|
||||||
refresh_token: None,
|
refresh_token: None,
|
||||||
expires_at: Some(1),
|
expires_at: Some(1),
|
||||||
scopes: Vec::new(),
|
scopes: Vec::new(),
|
||||||
}));
|
}));
|
||||||
assert!(!oauth_token_is_expired(&OAuthTokenSet {
|
assert!(!oauth_token_is_expired(&OAuthTokenSet {
|
||||||
access_token: "access-token".to_string(),
|
access_token: "dummy-access-token".to_string(),
|
||||||
refresh_token: None,
|
refresh_token: None,
|
||||||
expires_at: Some(now_unix_timestamp() + 60),
|
expires_at: Some(now_unix_timestamp() + 60),
|
||||||
scopes: Vec::new(),
|
scopes: Vec::new(),
|
||||||
|
|
@ -1226,7 +1226,7 @@ mod tests {
|
||||||
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
||||||
std::env::remove_var("ANTHROPIC_API_KEY");
|
std::env::remove_var("ANTHROPIC_API_KEY");
|
||||||
save_oauth_credentials(&runtime::OAuthTokenSet {
|
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()),
|
refresh_token: Some("refresh-token".to_string()),
|
||||||
expires_at: Some(1),
|
expires_at: Some(1),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1258,7 +1258,7 @@ mod tests {
|
||||||
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
||||||
std::env::remove_var("ANTHROPIC_API_KEY");
|
std::env::remove_var("ANTHROPIC_API_KEY");
|
||||||
save_oauth_credentials(&runtime::OAuthTokenSet {
|
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()),
|
refresh_token: Some("refresh".to_string()),
|
||||||
expires_at: Some(now_unix_timestamp() + 300),
|
expires_at: Some(now_unix_timestamp() + 300),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1282,7 +1282,7 @@ mod tests {
|
||||||
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
||||||
std::env::remove_var("ANTHROPIC_API_KEY");
|
std::env::remove_var("ANTHROPIC_API_KEY");
|
||||||
save_oauth_credentials(&runtime::OAuthTokenSet {
|
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()),
|
refresh_token: Some("refresh-token".to_string()),
|
||||||
expires_at: Some(1),
|
expires_at: Some(1),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1314,7 +1314,7 @@ mod tests {
|
||||||
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
std::env::remove_var("ANTHROPIC_AUTH_TOKEN");
|
||||||
std::env::remove_var("ANTHROPIC_API_KEY");
|
std::env::remove_var("ANTHROPIC_API_KEY");
|
||||||
save_oauth_credentials(&runtime::OAuthTokenSet {
|
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()),
|
refresh_token: Some("refresh-token".to_string()),
|
||||||
expires_at: Some(1),
|
expires_at: Some(1),
|
||||||
scopes: vec!["scope:a".to_string()],
|
scopes: vec!["scope:a".to_string()],
|
||||||
|
|
@ -1475,8 +1475,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn auth_source_applies_headers() {
|
fn auth_source_applies_headers() {
|
||||||
let auth = AuthSource::ApiKeyAndBearer {
|
let auth = AuthSource::ApiKeyAndBearer {
|
||||||
api_key: "test-key".to_string(),
|
api_key: "dummy-api-key".to_string(),
|
||||||
bearer_token: "proxy-token".to_string(),
|
bearer_token: "dummy-bearer-token".to_string(),
|
||||||
};
|
};
|
||||||
let request = auth
|
let request = auth
|
||||||
.apply(reqwest::Client::new().post("https://example.test"))
|
.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() {
|
fn enrich_bearer_auth_error_skips_hint_when_api_key_header_is_also_present() {
|
||||||
// given
|
// given
|
||||||
let auth = AuthSource::ApiKeyAndBearer {
|
let auth = AuthSource::ApiKeyAndBearer {
|
||||||
api_key: "sk-ant-api03-legitimate".to_string(),
|
api_key: "dummy-api-key".to_string(),
|
||||||
bearer_token: "sk-ant-api03-deadbeef".to_string(),
|
bearer_token: "dummy-bearer-token".to_string(),
|
||||||
};
|
};
|
||||||
let error = crate::error::ApiError::Api {
|
let error = crate::error::ApiError::Api {
|
||||||
status: reqwest::StatusCode::UNAUTHORIZED,
|
status: reqwest::StatusCode::UNAUTHORIZED,
|
||||||
|
|
@ -1731,7 +1731,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn enrich_bearer_auth_error_ignores_401_when_auth_source_has_no_bearer() {
|
fn enrich_bearer_auth_error_ignores_401_when_auth_source_has_no_bearer() {
|
||||||
// given
|
// 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 {
|
let error = crate::error::ApiError::Api {
|
||||||
status: reqwest::StatusCode::UNAUTHORIZED,
|
status: reqwest::StatusCode::UNAUTHORIZED,
|
||||||
error_type: Some("authentication_error".to_string()),
|
error_type: Some("authentication_error".to_string()),
|
||||||
|
|
|
||||||
|
|
@ -688,9 +688,9 @@ mod tests {
|
||||||
|
|
||||||
ANTHROPIC_API_KEY=plain-value
|
ANTHROPIC_API_KEY=plain-value
|
||||||
XAI_API_KEY=\"quoted-value\"
|
XAI_API_KEY=\"quoted-value\"
|
||||||
OPENAI_API_KEY='single-quoted'
|
OPENAI_API_KEY='quoted-openai-value'
|
||||||
export GROK_API_KEY=exported-value
|
export GROK_API_KEY=exported-value
|
||||||
PADDED_KEY = padded-value
|
PADDED_KEY = padded-value
|
||||||
EMPTY_VALUE=
|
EMPTY_VALUE=
|
||||||
NO_EQUALS_LINE
|
NO_EQUALS_LINE
|
||||||
";
|
";
|
||||||
|
|
@ -709,7 +709,7 @@ NO_EQUALS_LINE
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
values.get("OPENAI_API_KEY").map(String::as_str),
|
values.get("OPENAI_API_KEY").map(String::as_str),
|
||||||
Some("single-quoted")
|
Some("quoted-openai-value")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
values.get("GROK_API_KEY").map(String::as_str),
|
values.get("GROK_API_KEY").map(String::as_str),
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,16 @@ from infra.deepseek_adapter import DeepSeekV4
|
||||||
|
|
||||||
def solve_famm_sorry():
|
def solve_famm_sorry():
|
||||||
# Use DeepSeek API for better reliability
|
# Use DeepSeek API for better reliability
|
||||||
api_key = "***REMOVED***"
|
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)
|
client = DeepSeekV4(api_key=api_key, use_local=False)
|
||||||
model = "deepseek-v4-pro"
|
model = "deepseek-v4-pro"
|
||||||
|
|
||||||
file_path = "/home/allaun/Documents/Research Stack/0-Core-Formalism/lean/Semantics/Semantics/FAMM.lean"
|
file_path = "/home/allaun/Documents/Research Stack/0-Core-Formalism/lean/Semantics/Semantics/FAMM.lean"
|
||||||
with open(file_path, 'r') as f:
|
with open(file_path, 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
prompt = f"""
|
prompt = f"""
|
||||||
You are a Lean 4 formalization expert.
|
You are a Lean 4 formalization expert.
|
||||||
The following Lean 4 file `FAMM.lean` has duplicate definitions and 'sorry' axioms.
|
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}...")
|
print(f"Sending request to {model}...")
|
||||||
messages = [{"role": "user", "content": prompt}]
|
messages = [{"role": "user", "content": prompt}]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = client.chat(messages, model=model)
|
res = client.chat(messages, model=model)
|
||||||
# Check if it's Ollama response format
|
# 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"]
|
new_content = res["message"]["content"]
|
||||||
else:
|
else:
|
||||||
new_content = res["choices"][0]["message"]["content"]
|
new_content = res["choices"][0]["message"]["content"]
|
||||||
|
|
||||||
# Extract from code block
|
# Extract from code block
|
||||||
if "```lean" in new_content:
|
if "```lean" in new_content:
|
||||||
new_content = new_content.split("```lean")[1].split("```")[0].strip()
|
new_content = new_content.split("```lean")[1].split("```")[0].strip()
|
||||||
elif "```" in new_content:
|
elif "```" in new_content:
|
||||||
new_content = new_content.split("```")[1].split("```")[0].strip()
|
new_content = new_content.split("```")[1].split("```")[0].strip()
|
||||||
|
|
||||||
output_path = "/home/allaun/Documents/Research Stack/scratch/FAMM_refactored.lean"
|
output_path = "/home/allaun/Documents/Research Stack/scratch/FAMM_refactored.lean"
|
||||||
with open(output_path, 'w') as f:
|
with open(output_path, 'w') as f:
|
||||||
f.write(new_content)
|
f.write(new_content)
|
||||||
print(f"Refactored file saved to {output_path}")
|
print(f"Refactored file saved to {output_path}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error: {e}")
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ Forbidden exposure:
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
```bash
|
```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 OBSIDIAN_VAULT_PATH="/absolute/path/to/private/obsidian-vault"
|
||||||
export NEO4J_URI="bolt://127.0.0.1:7687"
|
export NEO4J_URI="bolt://127.0.0.1:7687"
|
||||||
export NEO4J_USER="neo4j"
|
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.
|
Never store secrets in GitHub, Notion, Google Drive, or Obsidian notes.
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ Forbidden exposure:
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
```bash
|
```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_APP_ID="your-private-wolfram-alpha-app-id"
|
||||||
export WOLFRAM_MAX_QUERY_CHARS=1600
|
export WOLFRAM_MAX_QUERY_CHARS=1600
|
||||||
export WOLFRAM_TIMEOUT_MS=15000
|
export WOLFRAM_TIMEOUT_MS=15000
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ Forbidden exposure:
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
```bash
|
```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 OBSIDIAN_VAULT_PATH="/absolute/path/to/private/obsidian-vault"
|
||||||
export NEO4J_URI="bolt://127.0.0.1:7687"
|
export NEO4J_URI="bolt://127.0.0.1:7687"
|
||||||
export NEO4J_USER="neo4j"
|
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.
|
Never store secrets in GitHub, Notion, Google Drive, or Obsidian notes.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue