-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark diff colors safe and escape raw diff input
For HTML escaping of the diff view we have to consider two things. 1. Diff input comes from two git checkouts of the project at specific revisions. The revisions sdocs are considered untrusted user input, could contain special characters and must be escaped. 2. After analyzing with difflib we add a bit HTML to colorize the output. This specific HTML fragments are trusted and safe. Relates to #1920.
- Loading branch information
Showing
9 changed files
with
141 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tests/integration/features/diff/120__escaping__basic/lhs/input.sdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[DOCUMENT] | ||
TITLE: Doc Title with special characters <> | ||
|
||
[SECTION] | ||
TITLE: To be removed section with special characters <> | ||
|
||
[REQUIREMENT] | ||
TITLE: To be removed title with special characters <> | ||
STATEMENT: To be removed statement with special characters <> | ||
|
||
[/SECTION] | ||
|
||
[SECTION] | ||
UID: SECT-1 | ||
TITLE: To be changed section with special characters <> | ||
|
||
[REQUIREMENT] | ||
UID: REQ-1 | ||
TITLE: To be changed title with special characters <> | ||
STATEMENT: To be changed statement with special characters <> | ||
|
||
[/SECTION] |
22 changes: 22 additions & 0 deletions
22
tests/integration/features/diff/120__escaping__basic/rhs/input.sdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[DOCUMENT] | ||
TITLE: Doc Title with more special characters <>&"' | ||
|
||
[SECTION] | ||
TITLE: Added section with more special characters <>&"' | ||
|
||
[REQUIREMENT] | ||
TITLE: Added title with more special characters <>&"' | ||
STATEMENT: Added statement with more special characters <>&"' | ||
|
||
[/SECTION] | ||
|
||
[SECTION] | ||
UID: SECT-1 | ||
TITLE: Changed section with more special characters <>&"' | ||
|
||
[REQUIREMENT] | ||
UID: REQ-1 | ||
TITLE: Changed title with more special characters <>&"' | ||
STATEMENT: Changed statement with more special characters <>&"' | ||
|
||
[/SECTION] |
6 changes: 6 additions & 0 deletions
6
tests/integration/features/diff/120__escaping__basic/strictdoc.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[project] | ||
title = "Test Project" | ||
|
||
features = [ | ||
"DIFF", | ||
] |
Oops, something went wrong.