Secret-safe operation

Know which credential unlocks which MARS capability.

MARS keeps credentials local and explicit. Official GitHub release metadata is anonymous-first; optional auth supports private forks and rate-limit fallback. Model provider credentials unlock cloud or hosted inference routes. Integration secrets verify optional webhooks and external board reads. Repo configuration stores names and policy, not raw secret values.

Security route: this reference owns credential handling detail. Use security and governance for the wider reviewer path and documentation map to find adjacent ownership docs.

Credential Map

Start with the capability you want, then choose the narrowest credential path. Do not reuse a token just because it happens to work for another surface.

CapabilityCredential sourcePrimary command or fileCommit?
Read official MARS release metadataNone by default; GH_TOKEN, GITHUB_TOKEN, GitHub CLI auth, or local fallback only after an exact official access denial.mars auth github check; optional setup for private forks or rate limits.No token values; access classification proves access only.
Use cloud model routesProvider API key in process env or ignored target-local env file.api_key_env, mars models credentials write-local-env.Commit env names only.
Use local llama.cpp modelsNo provider key; local model files under ~/.mars/models/.mars setup, mars models eligible.No model files.
Use optional GitHub code-host integrationPAT or GitHub App credentials depending on integration mode.Integration config and local credential storage.Commit config only when it contains no secret values.
Use optional JIRA or Atlassian MCP readsEnvironment variables named from integration config..harness/integrations.yaml fields such as webhook_secret_env.Commit env-var names only.
Detect accidental secret leaksNo credential needed.mars guardrails secret-scan.Commit findings only after redaction.
Rule of thumb: values stay in the user environment, ~/.mars/, or ignored local files. Repo files may name the variable, provider, endpoint, trust policy, or integration profile.

GitHub Release Access

mars auth github check first makes one exact, no-redirect anonymous request to the official api.github.com release-metadata endpoint. Only an exact 401, 403, or 404 may resolve optional credentials and retry the same origin and path once. The result is classified as anonymous, authenticated, or unavailable without disclosure. Credential availability does not authorize publication or prove artifact authenticity. Source signing and publication stay blocked until the approved F-018 cutover workflow; this credential path is separate from target model or board integration credentials.

Ordinary public path

mars auth github check --json

No credentials are resolved for a successful anonymous request, a redirect, transport failure, unexpected status, or custom origin.

Optional private-fork or rate-limit auth

gh auth login
mars auth github setup
mars auth github check --json

When fallback is eligible, GH_TOKEN and GITHUB_TOKEN are checked before GitHub CLI auth and the optional local config token. Do not echo or log token values.

Persist an explicit fallback

mars auth github setup --token "$GH_TOKEN"

Use this for headless installs when GitHub CLI auth is not available. Prefer GitHub CLI auth on interactive machines.

Use an isolated config file

mars auth github setup --config /private/tmp/mars-config.yaml
mars auth github check --config /private/tmp/mars-config.yaml --json
mars auth github clear-local --config /private/tmp/mars-config.yaml

Useful for validation or temporary machines where you do not want to update the default ~/.mars/config.yaml.

CommandFlagsOutput contract
mars auth github check--config, --json.Reports anonymous, authenticated, or unavailable without revealing credentials.
mars auth github setup--config, --json, --token.Verifies access before persisting a fallback. Token values are never printed.
mars auth github clear-local--config, --json.Removes only the stored config github_token; it does not touch environment variables, GitHub CLI or GitHub App credentials, repositories, or remote state. Repeated runs are safe.

Model Credentials

Cloud and hosted model routes use an api_key_env name. MARS resolves the actual key from the process environment or from ignored .harness/.env.local. Serializable routing data keeps provider, model, endpoint, and env-var name; it does not carry the API key value.

Use a process environment variable

export ANTHROPIC_API_KEY=...
mars models evaluate \
  --provider anthropic \
  --model claude-sonnet-family \
  --api-key-env ANTHROPIC_API_KEY

Best for short-lived shells, CI jobs, and operators who already manage env vars.

Write ignored target-local credentials

export ANTHROPIC_API_KEY=...
mars models credentials write-local-env \
  --repo ~/my-project \
  --api-key-env ANTHROPIC_API_KEY \
  --yes \
  --json

The command reads the value from the current process environment, writes ignored .harness/.env.local with owner-only permissions, and updates .harness/.env.example with the name only.

Commit routing policy, not the key

mars models override \
  --repo ~/my-project \
  --role engineer \
  --provider openai \
  --model gpt-4.1 \
  --api-key-env OPENAI_API_KEY

Review generated config for env-var names and endpoints before committing.

File or fieldMeaningCommit?
.harness/model-overrides.yamlProvider, model, endpoint, routing tier or role, and api_key_env.Yes, when the target repo should use that route.
.harness/.env.exampleExample env-var names with empty values.Yes.
.harness/.env.localLocal provider key values.No; ignored and owner-only.
Process environmentTemporary or externally managed provider key values.No.

Provider Env Vars

Provider names and default env vars come from the model provider catalog. OpenAI-compatible endpoints can use a user-supplied env var name because the endpoint is operator-defined.

ProviderDefault endpointDefault env varRuntime status
OpenAIhttps://api.openai.com/v1OPENAI_API_KEYSelectable.
Anthropichttps://api.anthropic.com/v1ANTHROPIC_API_KEYSelectable.
Geminihttps://generativelanguage.googleapis.com/v1beta/openaiGEMINI_API_KEYSelectable through OpenAI-compatible adapter.
Mistralhttps://api.mistral.ai/v1MISTRAL_API_KEYSelectable.
xAIhttps://api.x.ai/v1XAI_API_KEYSelectable.
DeepSeekhttps://api.deepseek.com/v1DEEPSEEK_API_KEYSelectable.
Groqhttps://api.groq.com/openai/v1GROQ_API_KEYSelectable.
Coherehttps://api.cohere.com/v2COHERE_API_KEYCataloged, but not runtime-selectable until native tool-call fixtures exist.
OpenAI-compatibleUser supplied.User supplied.Selectable.
Ollamahttp://127.0.0.1:11434/v1None by default.Selectable local provider.

Integration Secrets

Optional code-host, JIRA, and Atlassian MCP integrations use environment-variable indirection. Config can name the variable that contains a webhook secret, base URL, API token, or provider credential, but repo-owned config must not contain the value. Keeping credentials out of repo-owned config does not keep either authentication or integration data on-device during use. The selected service receives authentication material according to its protocol, and configured services receive the scoped repository, work-item, tool, and request data needed to perform each operation.

Integration surfaceWhat config may containLocal storage boundary and use
GitHub code-host clientAuth mode, base URL, app or PAT mode metadata.Secret values stay out of repo config. PATs, signed App assertions, and installation credentials are transmitted to the configured GitHub endpoint as required by its authentication protocol.
GitHub webhook receiverWhether a webhook receiver is enabled and which repo it maps to.The webhook secret is stored locally and used to verify incoming signatures; configured GitHub webhook deliveries carry event content.
JIRA mirrorProject mapping, allowed workspaces, labels, JQL shape, env-var field names.Tokens stay out of repo config but are transmitted to the configured JIRA endpoint for authentication; account and work-item data is exchanged for the request.
Atlassian MCPProvider mode, proxy command, endpoint, allowed tool names, env-var field names.OAuth/session credentials and scoped tool data are sent according to the configured MCP or Atlassian authentication protocol.
Future design or board integrationsScope gates and env-var names.Service and refresh tokens stay out of repo config but may be transmitted for authentication; selected customer data leaves the machine only when the configured operation requires it.
Local-first fallback: missing optional integration credentials should make the integration unavailable with remediation. They should not block source install, local setup, dry runs, or target operation that does not need the integration.

Files And Storage

Secret-safe operation depends on knowing which files are repo-owned contracts and which files are machine-local state.

LocationContainsRule
~/.mars/config.yamlMachine-local MARS config and optional private-release auth fallback.Do not commit; keep owner-readable.
~/.mars/models/Downloaded local model artifacts.Never commit; large local runtime state.
~/.mars/bin/Managed helper binaries.Never commit.
.harness/.env.localTarget-local model provider key values.Ignored; never commit.
.harness/.env.exampleTarget-local credential names with empty values.Commit when useful for onboarding.
.harness/integrations.yamlOptional integration profile and env-var names.Commit only after confirming it contains no secret values or tenant-private data.
docs/validation/reports/Evidence and blocker reports.Commit only redacted evidence; never raw tokens.
~/.mars/traces/Local command logs and traces.Do not paste or commit blindly; inspect for sensitive local context first.

Safe Output

Treat terminal output, JSON, traces, tickets, docs, screenshots, and chat as potentially durable. MARS commands aim to print remediation and env-var names rather than secret values, but users still need to avoid leaking shell-expanded values.

Use placeholders in docs

export OPENAI_API_KEY=<secret>
mars models credentials write-local-env --repo . --api-key-env OPENAI_API_KEY --yes

Never replace <secret> with a real value in documentation or tickets.

Scan before committing

mars guardrails secret-scan --repo .
mars guardrails secret-scan --repo . --staged --json

Remove the value and rotate the secret if a real credential was staged or committed.

Install optional local hook

mars guardrails install-hooks --repo .
git status --short

The managed pre-commit hook runs the staged secret scan locally.

Verification

Verify credentials by the capability they unlock, not by printing the credential. Prefer JSON when another agent or script needs to decide the next action.

QuestionCommandPassing signal
Can MARS read official release metadata?mars auth github check --jsonAccess class reports anonymous, authenticated, or unavailable; this proves access only, not signature, commit, or archive validity.
Does the source release match its producer contract?Run the no-publish steps authorized by AD-315 before tagging; the T-080 workflow is tag-only and least privilege.Four archives, four SBOMs, and the exact checksum contract pass before an approved tag can publish.
Is a packaged update admissible?Run the approved F-018 signed consumer lifecycle.Signature, workflow identity, immutable commit, platform/build metadata, checksum, archive, and replacement gates all pass.
Can a cloud route authenticate?mars models evaluate --provider openai --model ... --api-key-env OPENAI_API_KEYEvaluation reaches the provider without missing credential errors.
Did local env writing work?mars models credentials write-local-env --repo . --api-key-env OPENAI_API_KEY --yes --jsonIgnored local file is written, example contains the env name only.
Did a repo gain a leaked secret?mars guardrails secret-scan --repo . --jsonNo findings, or findings are removed and rotated before commit.

Recipes

Ordinary source install

make install
mars setup
mars doctor

Ordinary setup does not require GitHub credentials.

Check future private Release read access

gh auth login
mars auth github setup
mars auth github check --json

Access does not make a packaged update available or valid. Source checkout remains the supported route until the approved signed cutover release exists.

Configure a cloud model key safely

export OPENAI_API_KEY=<secret>
mars models credentials write-local-env \
  --repo ~/my-project \
  --api-key-env OPENAI_API_KEY \
  --yes \
  --json
git -C ~/my-project status --short

Expect .harness/.env.local to stay ignored and .harness/.env.example to contain only the name.

Recover from a suspected leak

mars guardrails secret-scan --repo ~/my-project --json
git -C ~/my-project status --short

Remove the value, rotate the credential if it was real, then rerun the scan before committing.

Troubleshooting

SymptomLikely causeRecovery
mars auth github check reports unavailable.The anonymous official request failed, or an eligible authenticated retry was not accepted.Check connectivity first; configure optional credentials only for a private fork or rate-limit fallback.
mars update tool cannot download assets.Release access is unavailable or the signed asset contract is absent.Run mars auth github check --json and follow the remediation.
Cloud route says credential env is not set.The configured api_key_env is absent from the process environment and .harness/.env.local.Export the env var or run mars models credentials write-local-env after exporting it.
models credentials write-local-env fails.--repo is missing, .harness/ is missing, or the named env var is not set.Run mars init --repo ..., export the env var, and retry with --yes --json.
Secret scan reports a finding.A repo file or staged file looks like a token, password, or API key.Remove the value, rotate the real credential, rerun the scan, and review git history if it was committed.
Integration webhook signature fails.The configured env var is missing or points to the wrong secret for the mapped repo.Check the env-var name in integration config, export the correct value locally, and retry without logging it.
Telemetry or validation report may contain sensitive context.A report copied local logs, traces, env output, or service payloads too broadly.Redact values and tenant-private payloads before committing evidence.

For setup failures, use the Install And Setup Reference. For model routing, use the Models And Inference Guide. For secret scanning and trust controls, use the Safety, Trust, And Quality Guide.