Repository navigation
fix(storage): preserve access-token timestamps and reject future introspection nbf - #344
Conversation
必须处理项评审基于 本轮未发现需要阻断合并的新增缺陷。 已核对:PostgreSQL 单 token、事务 token pair、refresh rotation 共用时间戳赋值路径;两个零值字段使用同一次捕获的应用时间,显式值分别保留;读取补齐 issued_at/not_before;Memory、Redis、PostgreSQL introspection 均增加未来 nbf 拒绝,原有事务/回调与过期边界未被改动。新增测试已接入源码收集与 Contract 注册。 当前 head 的三平台 CI、ASan+UBSan、SDK smoke 均成功;严格 coverage gate 和 nightly TSan 为跳过,不能算作已验证。本轮为差异及关联代码审查,没有在本机重新执行 C++/数据库全套测试。其他 Bearer 路径的一致性属于 PR 已声明的范围外事项,未据此要求扩大本次修复。 |
建议处理项评审基于 1. 补充默认时间戳经过缓存的冷暖一致性用例位置:TokenTimestampContractTest.cc:264–278、296–303。 现有缓存用例均传入明确的非零 issuedAt/notBefore;零值默认化只在直接 PostgreSQL 写读路径验证。现有 RedisCachedTokenRepository 的写后预热保存的是输入 DTO,而本 PR 的 PostgreSQL 会在内部解析零值,因此值得补测 建议使用独立 token,比较实际持久化值与各条读取路径,而不只断言 active。缓存预热逻辑未在本 PR 修改,此项作为覆盖和契约澄清建议,不将其直接认定为本次新增阻断缺陷。 |
b62762a to
e9b1015
Compare
e9b1015 to
edbcfbd
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ion nbf Persist explicit iat/nbf and resolve unspecified values from one application second on every PostgreSQL write path; round-trip the fields and reject future access-token nbf during backend introspection. Cover writes, rotation, fractional seconds, and real cache/fallback behavior. Fixes #342
edbcfbd to
7884511
Compare
Summary
Fresh access tokens could introspect as inactive because PostgreSQL rounded default
not_beforeto the next second. Explicitly persist issuance/not-before on single-token, pair and rotation writes, preserving nonzero caller values and resolving zero-valued inputs from one captured application second. Read both fields back into the DTO.Memory, Redis and PostgreSQL access-token introspection also reject intentionally future
not_beforevalues. Cache enforcement, existing expiry boundaries, refresh semantics and transaction/callback completion remain unchanged. This does not unify every Bearer-validation path. No schema, migration, generated ORM, public SDK or controller changes.Fixes #342
Validation
.25/.75boundaries, independent/default fields, three write paths, future nbf and real cache/fallback behavior.The combined smoke verifies functional flows and metrics, not capacity or clean shutdown: abnormal server-stop outcomes are retained separately under the #300 exclusion. Full raw runs and credentials remain private. Formal S07 still needs persistent-space provisioning and a successful pilot budget; no matrix/soak/fault acceptance or merge/deployment is claimed.
Checklist
Bug fix, non-breaking.
Integration with current master (2026-11-19)
Rebased onto
f720d5d9after #339/#343/#354. Current head:7884511d79a0d9c465967aceaca0b81dde807555.The only manual conflict was CHANGELOG; both Unreleased entries were retained. All six production/new-test blobs are byte-identical to the previously reviewed head. The CMake net change remains exactly the seven timestamp contract registrations, with upstream feature guards retained. Zero-context stable patch IDs match; the normal patch ID differs because CHANGELOG context changed. Native and published trees match exactly. Spec/API/double-move/migration/naming/macro/architecture/manage-parity checks passed locally.
The final update over #354 changed only the base's seven admin frontend files: all backend/test/CHANGELOG blobs are unchanged, and the full stable patch ID is identical before and after that update. Native/published tree:
5dcba5b8eb34ff33b7ccb23eccf4c9f1648b320e.The #343 authoritative-cache fallback remains intact. No further repository or timestamp semantics changed during this rebase. Fresh current-head CI and repository review protection are required before the user-authorized rebase merge; previous-head results are not counted as current-head acceptance.