Skip to content

reject non-RFC3339 timestamp strings in timestamp() conversion#1338

Merged
TristonianJones merged 5 commits into
cel-expr:masterfrom
alhudz:timestamp-rfc3339-strict
Jul 15, 2026
Merged

reject non-RFC3339 timestamp strings in timestamp() conversion#1338
TristonianJones merged 5 commits into
cel-expr:masterfrom
alhudz:timestamp-rfc3339-strict

Conversation

@alhudz

@alhudz alhudz commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Repro: timestamp("2025-01-17T01:00:00,001Z"), timestamp("2025-01-17T1:00:00Z"), timestamp("2025-01-18T01:01:01.001+24:01") and timestamp("2025-01-17T01:01:01.001+00:60") all evaluate to a value instead of erroring.
Cause: the string-to-timestamp conversion parses with time.Parse(time.RFC3339, ...), which accepts inputs RFC 3339 forbids: a , fractional separator, single-digit time fields, and offset hours past 23 or minutes past 59. These silently shift the parsed instant or get wrongly accepted.
Fix: gate the conversion on a strict RFC 3339 pattern in the callee before time.Parse runs, so the listed forms report the usual conversion error while time.Parse keeps doing the calendar validation.

Closes #1108

Comment thread common/types/string.go Outdated
@alhudz

alhudz commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

any update?

@TristonianJones

Copy link
Copy Markdown
Collaborator

Hi @alhudz, I was OOO for a couple weeks. I'll take a look this week.

Comment thread common/types/timestamp.go Outdated
@TristonianJones

Copy link
Copy Markdown
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit 41d9149 into cel-expr:master Jul 15, 2026
8 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.

cel-go inherits RFC 3339 parsing bugs from Golang's time.Parse()

2 participants