Skip to content

fix(gateway): saturate certificate lock expiry - #1015

Merged
kvinwang merged 1 commit into
masterfrom
fix/gateway-acme-lock-expiry-overflow
Aug 5, 2026
Merged

fix(gateway): saturate certificate lock expiry#1015
kvinwang merged 1 commit into
masterfrom
fix/gateway-acme-lock-expiry-overflow

Conversation

@kvinwang

@kvinwang kvinwang commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prevent overflow while calculating expiry for certificate-renewal and ACME-rotation leases. Saturating addition preserves a far-future lock instead of panicking in checked builds or wrapping to an expired timestamp.

Verification

  • cargo fmt --all -- --check
  • cargo test -p dstack-gateway lease_expiry_does_not_overflow -- --nocapture
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 5, 2026 12:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the gateway’s KV-based ACME lease/lock handling by preventing u64 overflow when computing lock expiry times, ensuring locks don’t accidentally appear expired (or panic in debug/checked builds).

Changes:

  • Use saturating_add when computing certificate-renewal and ACME-rotation lock expiry.
  • Add a regression test that writes a lock with started_at = u64::MAX and asserts acquisition correctly fails (lock remains held).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kvinwang
kvinwang merged commit 822806a into master Aug 5, 2026
17 checks passed
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.

2 participants