Escape user content in notebook HTML - #155
Conversation
Coding-Agent: Codex Codex-Version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
njzjz-bot
left a comment
There was a problem hiding this comment.
Review result: one medium-severity issue found.
The user-content escaping closes the intended injection paths, but the escaping order introduces a tooltip-formatting regression. See the inline suggestion.
I reproduced the literal <br/> output with the PR head; the security-focused tests and CI otherwise pass.
Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh
| ) | ||
| # Escape generated text before selectively restoring the small | ||
| # set of formatting markers supported by the tooltip. | ||
| doc_head = html.escape(doc_head, quote=False) |
There was a problem hiding this comment.
[P2] Escape before inserting the trusted line-break markup
doc_head has already converted newlines into <br/> before this call, so html.escape() turns every intended tooltip line break into visible <br/> text. I reproduced output such as child: <br/> type: .... Recompute from the unformatted generated text, escape it, and only then add renderer-owned line breaks:
| doc_head = html.escape(doc_head, quote=False) | |
| doc_head = html.escape( | |
| self.arg.gen_doc_head().replace("| type:", "type:"), | |
| quote=False, | |
| ).replace("\n", linebreak) |
After applying this suggestion, the earlier doc_head assignment at lines 274–278 is redundant and should be removed.
Summary
Fixes #120.
Validation
AI attribution
Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh