Skip to content

security: untrusted project config, CORS off by default, list limit caps - #1321

Merged
ajianaz merged 4 commits into
developfrom
security/config-trust-boundary
Oct 7, 2026
Merged

ajianaz merged 4 commits into
developfrom
security/config-trust-boundary

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • Server config: load_uteke_toml now merges the project-local .uteke/uteke.toml per section instead of replacing the whole global config. The project file can no longer set [server] (host, auth tokens, CORS origins) or [extraction] (LLM endpoint + key); a warning is logged when it tries.
  • CLI config: after the project layer is merged, embedding.backend and embedding / embed_fallback / extraction api_key, base_url, endpoint_path and server.{enabled,host,port} are reverted to the global values. Opt-in escape hatch: UTEKE_TRUST_PROJECT_CONFIG=1.
  • CORS: no CORS headers unless cors_origins is configured; "*" is an explicit opt-in. The "hide Authorization under wildcard" guard now also covers a read-only-token-only setup. PUT added to allowed methods. Startup warning when "*" is combined with no auth.
  • Hardening: limit capped at 1000 on /list, /recent, /contradictions, /doc/list, deprecated listing; /extract max_facts capped at 100; request log records the path only (no query string); nine 500 arms no longer echo e.to_string() (logged instead).

Why

High + medium findings from the v0.19.1 review — see #1319. A cloned repo's .uteke/uteke.toml could disable server auth or redirect embedding/extraction traffic (with the API key from the user's env) to an attacker host, and the default wildcard CORS let any web page read/write a local unauthenticated server.

Testing

  • cargo clippy --workspace --all-targets clean; cargo test -p uteke-cli -p uteke-server passes.
  • New tests: server overlay keeps global auth and ignores project [server]; CLI project config cannot redirect endpoints/keys/server address; CORS default/explicit-origin/wildcard+read-only-token behavior.

Notes for reviewers

Refs #1319

🤖 Generated with Claude Code

- server: merge project config per section; project file can no longer set [server]/[extraction]
- cli: project config cannot override endpoints, api keys or server address (UTEKE_TRUST_PROJECT_CONFIG=1 opts in)
- server: no CORS headers unless cors_origins is set; "*" is an explicit opt-in; guard also covers read-only token
- server: cap list-style limits and /extract max_facts; log request path without query string; generic 500 bodies

Refs #1319

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajianaz ajianaz added security priority:high Fix in next release type:security Security-related work labels Oct 7, 2026
Comment thread crates/uteke-cli/src/config.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/uteke-cli/src/config.rs Fixed
Comment thread crates/uteke-cli/src/config.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
Comment thread crates/uteke-server/src/main.rs Fixed
A project file could switch the backend from local ONNX to a remote provider,
sending memory text out with the trusted global API key.

Refs #1319

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment thread crates/uteke-server/src/main.rs Outdated

#[test]
fn project_config_without_server_section_does_not_wipe_global() {
let token = "t".repeat(10);
Refs #1319

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:high Fix in next release security type:security Security-related work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants