redpanda-data / redpanda-data/connect
Use `SetEscapeHTML` when marshalling JSON everywhere
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 969
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 64
Description
Following up on https://github.com/benthosdev/benthos/discussions/1244, as discussed on Discord, we want to set SetEscapeHTML when marshalling JSON to avoid certain characters, namely &, < and >, being escaped to \u0026, \u003c and \u003e.
For now, this impacts the following, but I could be missing others:
string()- Leverages Gabs hereformat_json()- Uses the Go json lib directly, but doesn't set this flagthis.bytes()triggers it too, but need to dig into it to see why
Workarounds:
this.string().replace_all_many(["\\u0026", "&", "\\u003c", "<", "\\u003e", ">"])- A new
escape_htmlflag (defaulttrue) was added toformat_json()in https://github.com/redpanda-data/benthos/pull/39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with internal/bloblang/query/type_helpers.go at the Gabs call linked in the issue, then inspect format_json and the path triggered by this.bytes(). Trace the other JSON marshalling sites and verify that the listed behaviors no longer emit the escaped forms \u0026, \u003c, and \u003e.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100