fix: parse cookie Expires using RFC 6265 cookie-date algorithm #6217
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.38) × (1 − Review Confidence (0.67)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 251 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.55 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Real PR Conversation Timeline
4 items
@khafradev ptal
Approved
lgtm
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 91.70%. Comparing base (
02c4f8c) to head (52f09e5).:warning: Report is 2 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #6217 +/- ##
==========================================
+ Coverage 91.68% 91.70% +0.02%
==========================================
Files 113 113
Lines 44462 44644 +182
==========================================
+ Hits 40763 40943 +180
- Misses 3699 3701 +2
</details>
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
mcollina
matthewalberto
This relates to...
Fixes #6216
Rationale
The current
Expiresparser uses JavaScript's general-purposeDateparser instead of the cookie-date algorithm specified in RFC 6265 section 5.1.1.This produces incorrect results for timezone-less dates, explicit timezone offsets and two-digit years. It also accepts values that do not satisfy the cookie-date algorithm.
Changes
Features
N/A
Bug Fixes
parseCookieDate()inlib/web/cookies/parse.jsto implement the RFC 6265 cookie-date algorithm.Expiresattribute.test/cookie/cookies.js, covering valid and invalid cookie dates, timezone independence, two-digit years, token ordering and date boundaries.nullfor invalid cookie dates so the existing cookie handling logic ignores the attribute.Breaking Changes and Deprecations
ISO timestamps and date-only strings that were previously accepted by JavaScript's date parser will no longer be accepted as
Expiresvalues unless they satisfy the RFC 6265 cookie-date algorithm.This is an intentional compatibility change to align parsing with the specification. Whether this change requires a semver-major release is left to the maintainers.
Status
Verification details
TZ=UTC.AI assistance disclosure
The
parseCookieDate()implementation and the new test cases were written with an AI coding agent. I reviewed the change, ran the verification probe and the cookie test suite myself, and checked the results against RFC 6265 section 5.1.1.