-
-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
authhelper: Tweak auth report escaping #6212
base: main
Are you sure you want to change the base?
Conversation
Great job, no security vulnerabilities found in this Pull Request |
9f579dd
to
d59176c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stats need update too
addOns/authhelper/src/main/zapHomeFiles/reports/auth-report-json/report.json
Show resolved
Hide resolved
d59176c
to
3f42a7a
Compare
I believe this is as expected now. |
ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault()); | ||
String current = zonedDateTime.format(DateTimeFormatter.RFC_1123_DATE_TIME); | ||
String expected = | ||
"{\n\t\"@programName\": \"ZAP\",\n\t\"@version\": \"Test Build\",\n\t\"@generated\": \"@@@replace@@@\",\n\t\"site\": \"https:\\/\\/www.example.com\"\n\t\n\t,\"summaryItems\": [\n\t\t{\n\t\t\t\"description\": \"Bob's \\\"Item\\\"\",\n\t\t\t\"passed\": true,\n\t\t\t\"key\": \"summary.1\"\n\t\t},\n\t\t{\n\t\t\t\"description\": \"Foo bar\",\n\t\t\t\"passed\": true,\n\t\t\t\"key\": \"summary.\\\"2\\\"\"\n\t\t}\n\t]\n\t\n\t\n\t,\"afEnv\": \" env:\\n contexts:\\n name: 'some \\\"quote\\\" name'\\n\"\n\t\n\t\n\t,\"statistics\": [\n\t\t{\n\t\t\t\"key\": \"stats.auth.1\",\n\t\t\t\"scope\": \"foo \\\"random\\\" bar\",\n\t\t\t\"value\": 123\n\t\t},\n\t\t{\n\t\t\t\"key\": \"stats.foo.oops \\\"foo\\\" bar\",\n\t\t\t\"scope\": \"global\",\n\t\t\t\"value\": 0\n\t\t}\n\t]\n\t\n}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would still be good to use text block to improve the readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see what I can do.
I think I actually got it in this form from the tests or something...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escapes should be dropped.
...per/src/test/java/org/zaproxy/addon/authhelper/report/ExtensionAuthhelperReportUnitTest.java
Outdated
Show resolved
Hide resolved
3f42a7a
to
9945c29
Compare
Done & done |
Signed-off-by: kingthorin <[email protected]>
9945c29
to
b1ecf62
Compare
And fixed 😀 |
Overview
Ensure output is escaped as expected. Booleans without quotes, strings with inner quotes escaped etc.
Related Issues
n/a
Note: Some of these tests fail on windows, likely due to line ending differences. But work fine via git bash/gradle.
Checklist
./gradlew spotlessApply
for code formatting