Skip to content

fix(server): mask caller-supplied llm_configs api_key in persisted requests (RENG-39) - #153

Open
Liewzheng wants to merge 1 commit into
mainfrom
fix/req-apikey-mask
Open

fix(server): mask caller-supplied llm_configs api_key in persisted requests (RENG-39)#153
Liewzheng wants to merge 1 commit into
mainfrom
fix/req-apikey-mask

Conversation

@Liewzheng

Copy link
Copy Markdown
Owner

Summary

Masks the caller-supplied api_key inside llm_configs before a review request is persisted, and fixes rerun matching to backfill against the masked request.

Changes

  • Single masking chokepoint: enqueue_review is the one place where reviews.request is written to the DB — the caller's llm_configs[*].api_key is replaced with a masked form there, so no other code path can leak a raw key into storage.
  • Rerun backfill semantics: rerun now matches existing requests by the composite key (provider, api_base) instead of the (now-masked) api_key, so re-running a review still finds and backfills the right persisted request.
  • Existing data cleanup: historical rows may already contain plaintext keys. A manual cleanup SQL is documented in the CHANGELOG for operators to run against existing data.

Test evidence

  • 17 lib tests green
  • 6 integration tests green

Notes

  • No schema changes; masking is applied at write time only.

Plane: RENG-39

…ng reviews.request (RENG-39) (0.10.2)

Explicit llm_configs in a ReviewRequest were serialized verbatim into the
reviews.request column, leaking live LLM API keys into the DB. Masking now
happens at the single persistence choke point (enqueue_review): each
llm_configs[i].api_key is stored as the *** sentinel (empty stays empty),
using the same projection as GET /config. The in-memory config driving the
review keeps the live key.

A rerun replays the persisted (masked) request, so a masked key is resolved
for execution like the POST /config/models probe: fall back to the
server-side config with the same api_base; unmatched masks are kept and
fail explicitly at the provider. Reruns of legacy plaintext rows re-persist
masked instead of copying the leak forward.

Existing rows are not rewritten (no migration); CHANGELOG documents cleanup
SQL/options for pre-0.10.2 history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant