Spaces:
Sleeping
Advisory Secret Handling
Version: 1.8.0 Status: Operational policy for provider-neutral advisory handoff
Scope
This document covers how STEM BIO-AI handles provider configuration for advisory packet export and downstream provider runners.
The deterministic scanner itself does not call external provider APIs. The secret boundary still matters because provider-neutral handoff packets and future adapters must not normalize unsafe practices.
Non-Negotiable Rules
- Provider API keys must come from environment variables or an external secret store.
- Provider API keys must never appear in CLI arguments.
- Provider API keys must never be written to audit JSON, Markdown, PDF, or explain artifacts.
- Provider handoff metadata may report
api_key_presentand the expected env-var name, but never the secret value. - Base URLs containing embedded credentials are invalid.
- Cloud-provider overrides require
https. - Plain
httpis restricted tolocalhost,127.0.0.1, or::1. - Real provider-call intent must be explicit via
stem advisory call.
Supported Environment Variables
Shared
STEM_AI_ADVISORY_PROVIDERSTEM_AI_ADVISORY_MODELSTEM_AI_ADVISORY_BASE_URLSTEM_AI_ADVISORY_TIMEOUT_SECSTEM_AI_ADVISORY_MAX_TOKENSSTEM_AI_ADVISORY_RUNTIME
Provider-Specific API Keys
OPENAI_API_KEYANTHROPIC_API_KEYGEMINI_API_KEYOPENAI_COMPATIBLE_API_KEYOLLAMA_API_KEYLOCAL_RUNTIME_API_KEY
Generic Fallback
STEM_AI_ADVISORY_API_KEY
STEM BIO-AI prefers the provider-specific variable first and falls back to STEM_AI_ADVISORY_API_KEY only when the provider-specific variable is absent.
.env Policy
.envand.env.*are ignored by Git..env.exampleis committed as a names-only template.- Real secrets belong in local untracked env files, CI/HF/host secret stores, or OS secret managers.
Committed example files must contain placeholders only.
Artifact Boundary
The following artifacts must remain secret-free:
*_experiment_results.json*_advisory_input.json*_report.md*.pdf*_explain.txt
Provider handoff metadata may include:
providermodelbase_urlapi_key_presentapi_key_env_varsecret_sourcenetwork_modebase_url_validationsecret_policyenv_contract
It must not include any actual key value.
Endpoint Policy
Valid
https://api.openai.com/v1https://api.anthropic.comhttps://generativelanguage.googleapis.comhttp://localhost:11434http://127.0.0.1:8000/v1
Invalid
http://api.openai.com/v1http://10.0.0.4:8000/v1https://user:pass@example.com/v1
Recommended Operating Pattern
- Generate deterministic audit output locally.
- Export
stem advisory packet. - Validate
provider_request.args_validationandprovider_request.base_url_validation. - Pass the packet to a downstream adapter only after the secret/env contract is satisfied.
- Validate the provider response with
stem advisory check-response <repo> --response FILE.
This keeps deterministic scoring and external provider execution on separate trust boundaries.
Runtime Guardrails
stem advisory call is an explicit provider-call boundary. In v1.8.0 the runtime exports:
- centralized redaction policy
- adapter logging policy
- child-env allowlist summary
- network intent vs actual network-called flag
This keeps call intent observable even when a provider adapter is not yet implemented.
See also: docs/ADVISORY_RUNTIME.md