Add empty folder export, folder comments, and / escaping#6
Conversation
- Add AddFolder(folder, comment) API for creating empty folders and folder comments - Add "Folder Comment" CSV column - Support / in folder names by escaping as \/ in the joined path - Reject folder segments ending with \ to prevent ambiguity with \/ escape - Replace json.Marshal with jsonMarshal (SetEscapeHTML=false) to avoid mangling &, <, > in JSON fields - Preserve folder insertion order instead of sorting alphabetically - Add functional test examples for manual import verification - Add *.csv to .gitignore
Summary of ChangesHello @AndrianBdn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces valuable features like empty folder exports, folder comments, and support for slashes in folder names, with well-implemented changes and tests. However, a security audit revealed a high-severity Stored XSS vulnerability due to disabled HTML escaping during JSON marshalling, and a medium-severity CSV Injection vulnerability from unsanitized folder comments. Addressing these security concerns is critical. Additionally, there's a suggestion to improve code consistency.
- Introduce Folder struct with validation tags for AddFolder API - Use go-validator consistently for folder validation (same as TestCase) - Refactor examples/functional to return errors instead of log.Fatal
qascsv.go
Outdated
| LegacyID string `validate:"max=255"` | ||
| // The complete folder path to the test case. (required) | ||
| Folder []string `validate:"min=1,dive,required,max=255,excludesall=/"` | ||
| Folder []string `validate:"min=1,dive,required,max=255"` |
There was a problem hiding this comment.
This should also be renamed to FolderPath, it will make the purpose of the field more clear.
closes https://github.com/Hypersequent/tms-issues/issues/2215
Implements features from Hypersequent/tms-issues#2215 (partially covered by #5, which had review feedback that is addressed here):
AddFolder(folder, comment)API to create folders with no test cases. Folder-only rows are written when a folder is empty or has a comment."Folder Comment"CSV column. Comments are set viaAddFolderand rendered on a dedicated folder row — this feature has been tested on staging of 26W06/in folder names — Removedexcludesall=/validation./in folder segments is escaped as\/in the joined path. Folder segments ending with\are rejected to prevent ambiguity.jsonMarshalwithSetEscapeHTML(false)— Prevents Go's defaultjson.Marshalfrom mangling&,<,>into\u0026,\u003c,\u003ein JSON fields.PR #5 review feedback addressed
excludesall=/validation\at the end of folder name"\are rejectedstrings.Join(tc.Folder, "/")instead of escaped map keyfolderTCaseMapjsonMarshalnewline: "Is there some TrimSuffix function for this"bytes.TrimSuffixTest plan
go run examples/functional/main.go(generatesfolder_comments.csv,empty_folders.csv,escaping.csv)