Skip to content

fix: nightly hardening - strict ISO date validation - #18

Open
mouse-value-add wants to merge 1 commit into
mainfrom
chore/nightly-hardening-20260512-strict-iso-date-validation
Open

fix: nightly hardening - strict ISO date validation#18
mouse-value-add wants to merge 1 commit into
mainfrom
chore/nightly-hardening-20260512-strict-iso-date-validation

Conversation

@mouse-value-add

Copy link
Copy Markdown
Collaborator

Problem

you.md metadata date validation accepted impossible calendar dates like 2025-02-30 and invalid timestamps like 2025-01-01T25:00:00Z because it relied mostly on format regex checks. This can let malformed profile metadata pass validation and weaken downstream reliability.

Approach

  • Hardened isValidDateFormat to validate both structure and semantic date correctness.
  • For YYYY-MM-DD, validate by round-tripping through UTC date components.
  • For full ISO timestamps, require strict timestamp shape and reject Invalid Date parses.
  • Added focused tests for impossible calendar dates and invalid ISO timestamps.

Verification

  • Ran: npm test -- --run test/core/validator.test.ts
  • Result: all validator tests pass (12/12).

Risks

  • Slightly stricter validation may warn on edge-case date strings that previously slipped through.
  • Behavior remains warning-based (non-breaking) for metadata date issues.

Rollback plan

  • Revert commit 9b1448e if strict validation causes unwanted regressions.
  • Alternatively relax only timestamp/date-only checks in isValidDateFormat while preserving new tests as guardrails.

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.

1 participant