Files
codex/codex-rs
Matthew Zeng 392ced7d3a Protect MCP OAuth persistence from stale credential writes (#60849)
## Why

A pending token refresh must not overwrite a newer login or recreate credentials after logout. Legacy file entries also need to retain their stored identity across refreshes.

## What changed

- Lock and revalidate stored credentials before persisting changed authorization-manager credentials, requiring authorization again if storage has changed.
- Update file-backed refreshes only when the matched entry still contains the expected credentials, preserving its key, server name, and ownership. Compare only fields the file format can persist.
- Remove matching legacy file entries when saving login credentials or deleting credentials, while preserving unrelated entries and profile-scoped enterprise credentials' separate local entries.

## Testing

Add regression coverage for newer logins and logout during pending persistence, repeated refreshes of legacy and escaped-name entries, and cleanup that preserves unrelated credentials. Update guard-retention and telemetry assertions for the validation path.

GitOrigin-RevId: 3d7c603950afcff72f0bcd943edae5ecfbcb5bd2
2026-11-11 19:18:48 +00:00
..
…
…
…