openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Security: API key suffix leaked in tracing logs (providers/reliable.rs)

Open Liohtml opened this issue 6 months ago • 2 comments

Summary

src/openhuman/providers/reliable.rs — rotate_key() logs the last 4 characters of the API key in a tracing::info! call. With multiple key rotations, an attacker with log access can reconstruct significant portions of short API keys.

Location

src/openhuman/providers/reliable.rs — rotate_key() method

Impact

Medium — Partial key material leaked to logs. Combined with log aggregation or Sentry capture, this can narrow key search space significantly.

Suggested Fix

Log only the key slot index: tracing::info!("Rotated to key slot {}/{}", current_idx + 1, total_keys) — no key material at all.

Liohtml avatar May 16 '26 14:05 Liohtml

I rechecked current origin/main and this looks stale/resolved.

Evidence:

  • The path in the issue, src/openhuman/providers/reliable.rs, no longer exists on main; the current implementation is under src/openhuman/inference/provider/reliable.rs.
  • Current rotate_key() only advances the index and returns the selected key:
    • let idx = self.key_index.fetch_add(1, Ordering::Relaxed) % self.api_keys.len();
    • Some(&self.api_keys[idx])
  • I did not find the described tracing::info! that logs a key suffix / last 4 chars in the current reliable provider.

I think this issue can be closed unless there is another current log path still emitting key material.

honor2030 avatar May 17 '26 15:05 honor2030

Verified: the file has moved to src/openhuman/inference/provider/reliable.rs and the current rotate_key() no longer logs key material. Closing as stale — thanks @honor2030 for verifying.

Liohtml avatar May 17 '26 15:05 Liohtml