Hardening pass: input validation, origin checks, and default-safe field behaviour — main (v3-alpha) - #739
Conversation
3b081c2 to
04680fb
Compare
You were right that the old version hung — the query was passed directly to |
The concern isn't distrust of the originating server — it's that between the server delivering the prefilled payload and the browser submitting the form, the data lives in the page where a user (or MITM proxy) can modify it. The frontend can verify files it fetches ( |
…aults (no wildcard)
…xp (prevent ReDoS)
|
sorry what I meant was that without the fix, the test would hang instead of timing out. how can we make jest recover from this? |
|
we could try using vm.runInNewContext in this context for the test? |
…lid file submissions
…MAX_MATCHES_INPUT_LENGTH, bump to 1000
…ang on ReDoS regression
04680fb to
7cbf0e5
Compare
…odalStyles and imageReviewModalStyles
qroll
left a comment
There was a problem hiding this comment.
the unit tests are stuck when I run them locally. do you encounter this too?
…ModalStyles argType
…/location-modal/location-search/helper.spec.ts Co-authored-by: Ruo Ling <quek.ruoling@gmail.com>
…NPUT_LENGTH guard in hang test
…AX_MATCHES_INPUT_LENGTH guard
…CHES_INPUT_LENGTH guard
Hardening pass — main (v3-alpha)
Covers several hardening changes and default-safe behaviour updates across fields and shared utilities. One commit — review the diff directly since the changes span multiple independent areas with varying blast radius.
Four changes alter default runtime behaviour unconditionally, no opt-out, for every existing schema as soon as this ships:
IframepostMessageorigin check is now hard default-on. Messages from a mismatched origin are silently dropped.matches,notMatches, andfilenameMatchesrules.maxLengthnow defaults to 1000 whenevermaskRegexis set and nomax/lengthrule already narrows it./pattern/flagsslashes are no longer silently skipped. They previously landed in a catch block and validation was skipped entirely (value always passed). The shared parsing helper now falls back to treating the whole string as a raw pattern and applies it — any schema relying on the old silent no-op will now get real validation applied.Narrower breaking changes (only affect a consumer that relied on the specific permissive behaviour being fixed):
sanitize-htmlconfiguration: stricter attribute allowlist may now strip attributes that previously passed through unsanitized.locationModalStyles/imageReviewModalStyles:url()and@importare now stripped from these CSS strings before they are applied to the modal box. Any background image or external resource passed via these props will silently stop working. Verified against all known consumers — none currently use these props withurl()or@import.Changes covered
sanitize-htmlconfiguration tightened in Typography, FilterCheckbox, PopoverpostMessagenow validates origin by defaultRegExpstatefield documented as client-asserted (no code change)maxLengthdefaults to 1000 whenmaskRegexis set@importandurl()referenceslocationModalStylesandimageReviewModalStylesprop descriptions updated in Storybookmatchesrule no longer blocks valid submissions (pre-existing bug fix)Test plan
eslint+tsc --noEmitpass on this branch.