Skip to content

fix(workflow): sanitize newlines in HTTP node key-value fields - #39650

Open
SpiliosDimakopoulos wants to merge 10 commits into
langgenius:mainfrom
SpiliosDimakopoulos:fix/http-node-keyvalue-newline
Open

fix(workflow): sanitize newlines in HTTP node key-value fields#39650
SpiliosDimakopoulos wants to merge 10 commits into
langgenius:mainfrom
SpiliosDimakopoulos:fix/http-node-keyvalue-newline

Conversation

@SpiliosDimakopoulos

Copy link
Copy Markdown
Contributor

The HTTP request node's header/param editor uses PromptEditor — the same rich multi-line component used for prompt templates — so nothing prevents a literal newline from being typed (Enter) or pasted into a header/param value.

However, rows are serialized internally as a single newline-delimited string (hooks/use-key-value-list.ts: stringifyList joins rows with \n, strToKeyValueList splits on \n). An embedded newline inside a value gets mistaken for a row separator on the next parse, splitting/corrupting that row.

Added sanitizeKeyValueField (in nodes/http/utils.ts) to collapse any \r\n sequences to a single space before the value reaches storage — newlines aren't valid in HTTP header/param values anyway. Applied at the point of change in key-value-edit/item.tsx. Added unit tests covering plain values, embedded \n, CRLF, repeated newlines, all-newline input, and empty string.

…ΘΜΟ>)

'Runing docker container' -> 'Running docker container'.
…ΘΜΟΣ>)

ar-SA: unescape the quick-start-guide link and point it at the real heading slug (#البداية-السريعة). hi-IN: point the community link at the real bilingual heading slug (#समुदाय-और-संपर्क-community--contact). Verified both slugs with github-slugger.
validate_credentials() -> _get_request() called httpx.get() with no explicit timeout, unlike the Jina/Firecrawl/Nacos/Marketplace auth providers which were recently hardened with bounded httpx.Timeout values. A slow or hanging WaterCrawl endpoint could block the worker indefinitely during credential validation.

Updated the existing unit test to assert the new timeout kwarg.
The HTTP node's header/param editor reuses PromptEditor, the same rich multi-line component used for prompt templates, so nothing stops a literal newline from being typed or pasted into a value. But rows are serialized as a single newline-delimited string in use-key-value-list.ts (stringifyList joins with '\n', strToKeyValueList splits on '\n'), so an embedded newline gets mistaken for a row separator and corrupts the list on the next parse.

Added sanitizeKeyValueField, which collapses any \r\n sequences to a single space before the value reaches storage. Newlines aren't valid in HTTP header/param values regardless.

fixes #<ISSUE_NUMBER>
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 27, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 55.20% 55.20% 0.00%
Strict coverage 54.71% 54.71% 0.00%
Typed symbols 35,893 35,893 0
Untyped symbols 29,395 29,395 0
Modules 3078 3078 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant