Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Issue 2849353002: sanitizehtml: add a package to sanitize HTML (Closed)

Created:
3 years, 7 months ago by nodir
Modified:
3 years, 7 months ago
CC:
chromium-reviews, infra-reviews+luci-go_chromium.org, maruel+w_chromium.org, tandrii+luci-go_chromium.org
Target Ref:
refs/heads/master
Project:
luci-go
Visibility:
Public.

Description

sanitizehtml: add a package to sanitize HTML It is based on an existing HTML parser in golang.org/x/net/html. The motivation is to support user-supplied HTML in step_text in Milo. R=dnj@chromium.org, vadimsh@chromium.org BUG=704387 Review-Url: https://codereview.chromium.org/2849353002 Committed: https://github.com/luci/luci-go/commit/e3b4c50fa889a3825db10a0eb87adf7bc0807cb3

Patch Set 1 #

Patch Set 2 : nit #

Total comments: 22

Patch Set 3 : rewrite #

Patch Set 4 : nit #

Patch Set 5 : add test #

Total comments: 14

Patch Set 6 : address nigeltao's comments #

Patch Set 7 : re xtof #

Total comments: 4

Patch Set 8 : re nigeltao #

Patch Set 9 : malformed #

Total comments: 6

Patch Set 10 : final comments #

Patch Set 11 : fix comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+344 lines, -0 lines) Patch
A common/data/text/sanitizehtml/sanitize.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +203 lines, -0 lines 0 comments Download
A common/data/text/sanitizehtml/sanitize_test.go View 1 2 3 4 5 6 7 8 9 1 chunk +141 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (11 generated)
nodir
PTAL
3 years, 7 months ago (2017-05-01 23:31:41 UTC) #1
nodir
Package golang.org/x/net/html says "It is the caller's responsibility to ensure that the Reader provides UTF-8 ...
3 years, 7 months ago (2017-05-01 23:43:20 UTC) #2
nodir
On 2017/05/01 23:43:20, nodir wrote: > Package golang.org/x/net/html says "It is the caller's responsibility to ...
3 years, 7 months ago (2017-05-01 23:49:30 UTC) #3
mithro
You need someone from security to approve this. As mentioned SecOps doesn't let us write ...
3 years, 7 months ago (2017-05-02 00:11:42 UTC) #5
Vadim Sh.
https://codereview.chromium.org/2849353002/diff/20001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/20001/common/data/text/sanitizehtml/sanitize.go#newcode5 common/data/text/sanitizehtml/sanitize.go:5: // Package sanitizehtml implements a sanitizer of a very ...
3 years, 7 months ago (2017-05-02 00:16:24 UTC) #6
hinoka
I'm gonna think about if I can break this, since an escape could mean a ...
3 years, 7 months ago (2017-05-02 00:36:16 UTC) #8
xtof
https://codereview.chromium.org/2849353002/diff/20001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/20001/common/data/text/sanitizehtml/sanitize.go#newcode43 common/data/text/sanitizehtml/sanitize.go:43: return s On 2017/05/02 00:36:15, hinoka wrote: > return ...
3 years, 7 months ago (2017-05-04 18:26:18 UTC) #10
xtof
Generally this looks good. The approach you're taking is exactly the right one: parse the ...
3 years, 7 months ago (2017-05-04 18:31:10 UTC) #11
nodir
I've rewrote this thing. The map of elements was nice, but it leaked and we ...
3 years, 7 months ago (2017-05-04 22:11:01 UTC) #12
nigeltao1
Some drive-by comments by the author of the "golang.org/x/net/html" package. I hope it's not too ...
3 years, 7 months ago (2017-05-04 23:44:24 UTC) #14
nodir
https://codereview.chromium.org/2849353002/diff/80001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/80001/common/data/text/sanitizehtml/sanitize.go#newcode29 common/data/text/sanitizehtml/sanitize.go:29: if !unicode.IsDigit(r) { On 2017/05/04 23:44:23, nigeltao1 wrote: > ...
3 years, 7 months ago (2017-05-05 05:23:07 UTC) #15
xtof
On 2017/05/04 22:11:01, nodir wrote: > I've rewrote this thing. The map of elements was ...
3 years, 7 months ago (2017-05-05 15:28:46 UTC) #16
xtof
https://codereview.chromium.org/2849353002/diff/80001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/80001/common/data/text/sanitizehtml/sanitize.go#newcode40 common/data/text/sanitizehtml/sanitize.go:40: return false, "#invalid-url-stripped" It would be preferable to use ...
3 years, 7 months ago (2017-05-05 15:29:17 UTC) #17
nodir
I agree that table was easier to review/comprehend. However I felt that, although individually it ...
3 years, 7 months ago (2017-05-05 16:10:06 UTC) #18
nigeltao1
https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go#newcode31 common/data/text/sanitizehtml/sanitize.go:31: invalidityReason = err.Error() err.Error() can contain arbitrary unsanitized content, ...
3 years, 7 months ago (2017-05-06 01:03:31 UTC) #19
nodir
https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go#newcode31 common/data/text/sanitizehtml/sanitize.go:31: invalidityReason = err.Error() On 2017/05/06 01:03:31, nigeltao1 wrote: > ...
3 years, 7 months ago (2017-05-06 01:40:47 UTC) #20
xtof
On 2017/05/06 01:40:47, nodir wrote: > https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go > File common/data/text/sanitizehtml/sanitize.go (right): > > https://codereview.chromium.org/2849353002/diff/120001/common/data/text/sanitizehtml/sanitize.go#newcode31 > ...
3 years, 7 months ago (2017-05-09 16:03:55 UTC) #21
xtof
lgtm https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go#newcode31 common/data/text/sanitizehtml/sanitize.go:31: invalidityReason = "url-is-malformed" Nit: After the transformation, the ...
3 years, 7 months ago (2017-05-09 16:06:21 UTC) #22
nigeltao1
lgtm https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go#newcode185 common/data/text/sanitizehtml/sanitize.go:185: func Sanitize(r io.Reader, w io.Writer) (err error) { ...
3 years, 7 months ago (2017-05-10 02:27:20 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2849353002/220001
3 years, 7 months ago (2017-05-10 06:48:17 UTC) #27
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started once the ...
3 years, 7 months ago (2017-05-10 06:48:19 UTC) #29
nodir
nigeltao, xtof, thank you so much for review! https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go File common/data/text/sanitizehtml/sanitize.go (right): https://codereview.chromium.org/2849353002/diff/160001/common/data/text/sanitizehtml/sanitize.go#newcode31 common/data/text/sanitizehtml/sanitize.go:31: invalidityReason ...
3 years, 7 months ago (2017-05-10 06:48:48 UTC) #30
nodir
On 2017/05/10 06:48:19, commit-bot: I haz the power wrote: > No L-G-T-M from a valid ...
3 years, 7 months ago (2017-05-10 06:51:48 UTC) #31
Vadim Sh.
lgtm
3 years, 7 months ago (2017-05-10 17:06:12 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2849353002/220001
3 years, 7 months ago (2017-05-10 17:12:00 UTC) #34
commit-bot: I haz the power
3 years, 7 months ago (2017-05-10 17:19:16 UTC) #37
Message was sent while issue was closed.
Committed patchset #11 (id:220001) as
https://github.com/luci/luci-go/commit/e3b4c50fa889a3825db10a0eb87adf7bc0807cb3

Powered by Google App Engine
This is Rietveld 408576698