SensitiveDate Validator¶
Flags certificates that expire on a date you'd rather not be doing an emergency renewal: weekends, leap days, or your own list of blackout dates (holidays, change freezes, peak-traffic events). A proactive scheduling check rather than a security one.
Opt-in
Enable via enabled_validators=["sensitive_date", ...] or ENABLED_VALIDATORS. Weekend and leap-day checks run automatically; pass dates to add your own.
Try it¶
from certmonitor import CertMonitor
with CertMonitor("example.com", enabled_validators=["sensitive_date"]) as monitor:
monitor.get_cert_info()
result = monitor.validate(
validator_args={"sensitive_date": {"dates": ["2025-12-25", ["Black Friday", "2025-11-28"]]}}
)
print(result["sensitive_date"])
A certificate expiring on a weekend (built-in check) fails:
These examples show selected fields from illustrative scans. validate() also adds status and code, described in the result contract.
{
"is_valid": false,
"leapday_expiry": false,
"weekend_expiry": true,
"sensitive_date_matches": [],
"warnings": ["Certificate expires on a weekend (Saturday)"],
"reason": "Certificate expires on a sensitive date: Certificate expires on a weekend (Saturday)"
}
Arguments¶
Pass via validator_args={"sensitive_date": {...}}:
| Argument | Type | Default | Description |
|---|---|---|---|
dates |
List[...] |
None |
Extra dates to flag. Each entry may be an ISO string ("2025-12-25"), a date/datetime, a (name, date) tuple, or a SensitiveDate. |
The accepted entry shapes:
| Form | Example |
|---|---|
| ISO date string | "2025-12-25" |
(name, date) tuple |
("Black Friday", "2025-11-28") |
datetime.date |
date(2025, 12, 25) |
Reading the result¶
| Field | Meaning |
|---|---|
weekend_expiry |
Certificate expires on a Saturday or Sunday. |
leapday_expiry |
Certificate expires on February 29. |
sensitive_date_matches |
Your supplied dates that matched, each with name and date. |
is_valid |
false if any of the above fired. |
It's about when, not whether
A false here doesn't mean the certificate is insecure. It means the expiry lands somewhere inconvenient. Use it to nudge renewals onto a business day well ahead of a freeze.
Reference¶
certmonitor.validators.sensitive_date.SensitiveDateValidator ¶
Bases: BaseCertValidator
A validator for checking if an SSL certificate expires on a sensitive/special date.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the validator. |
validate ¶
validate(cert: dict[str, Any], host: str, port: int, *, dates: list[SensitiveDateInput] | None = None) -> SensitiveDateResult
Validates the sensitivity of the expiry date of the provided SSL certificate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cert
|
dict
|
The SSL certificate. |
required |
host
|
str
|
The hostname (not used in this validator). |
required |
port
|
int
|
The port number (not used in this validator). |
required |
dates
|
list
|
Sensitive dates to match against the
certificate's expiration date. Each entry may be a
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
SensitiveDateResult
|
A dictionary containing:
|
Examples:
Example output (success):
```json
{
"is_valid": true,
"leapday_expiry": false,
"weekend_expiry": false,
"sensitive_date_matches": [],
"warnings": []
}
```
Example output (failure):
```json
{
"is_valid": false,
"leapday_expiry": false,
"weekend_expiry": true,
"sensitive_date_matches": [
{"name": "Busy Sunday", "date": "2025-11-16"}
],
"warnings": [
"Certificate expires on a weekend (Sunday)",
"Certificate is due to expire on sensitive date \"Busy Sunday\" (2025-11-16)"
],
"reason": "Certificate expires on a sensitive date: Certificate expires on a weekend (Sunday); Certificate is due to expire on sensitive date \"Busy Sunday\" (2025-11-16)"
}
```
Source code in certmonitor/validators/sensitive_date.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |