Describe the bug
BaseX509.renew() unconditionally resets validity_end to the system default (DEFAULT_CERT_VALIDITY /DEFAULT_CA_VALIDITY), discarding the validity duration that was originally set on the certificate. This means cert created with a custom validity window (e.g. from a template) loses that window on every renewal, reverting to the system default.
Two problems in renew() (base/models.py):
- validity_end is overwritten with the system default instead of preserving the original duration.
- validity_start is never updated, leaving a stale start date after renewal.
Steps To Reproduce
- Create a certificate with a non-default validity duration (e.g. 730 days instead of the system default).
- Note validity_end - validity_start = 730 days.
- Call .renew() on that certificate.
- Observe that validity_end is now now + DEFAULT_CERT_VALIDITY (system default), not now + 730 days.
Expected behavior
renew() should preserve the original validity duration derived from validity_end - validity_start and apply it from the new validity_start, so a cert originally valid for 730 days is still valid for 730 days after renewal.
Screenshots
N/A
System Information:
- OS: macOS 15.3
- Python Version: Python 3.10+
- Django Version: Django 3.2+
- Browser and Browser Version (if applicable): N/Aa
Describe the bug
BaseX509.renew() unconditionally resets validity_end to the system default (DEFAULT_CERT_VALIDITY /DEFAULT_CA_VALIDITY), discarding the validity duration that was originally set on the certificate. This means cert created with a custom validity window (e.g. from a template) loses that window on every renewal, reverting to the system default.
Two problems in renew() (base/models.py):
Steps To Reproduce
Expected behavior
renew() should preserve the original validity duration derived from validity_end - validity_start and apply it from the new validity_start, so a cert originally valid for 730 days is still valid for 730 days after renewal.
Screenshots
N/A
System Information: