-
Notifications
You must be signed in to change notification settings - Fork 4
fix: use html/template
instead text/template
for parse files
#7
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
Conversation
Reviewer's Guide by SourceryThis pull request fixes an issue where the Sequence diagram showing template parsing with html/templatesequenceDiagram
participant C as Client
participant T as Template Parser
participant H as HTML Output
C->>T: Request template parsing
Note over T: Now using html/template
T->>T: Automatically escape<br/>HTML special characters
T->>H: Generate safe HTML
H->>C: Return escaped output
Class diagram showing template package changeclassDiagram
class Template {
-fs FileSystem
+Parse()
+Execute()
}
note for Template "Changed import from text/template to html/template"
class HTMLTemplate {
+AutoEscapeHTML
+PreventXSS
}
Template --|> HTMLTemplate : Now uses
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
html/template
instead text/template
for parse template f…html/template
instead text/template
for parse files
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.
Hey @giautm - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding tests to verify the HTML escaping behavior works as expected
- It would be helpful to add a brief comment explaining why html/template is preferred over text/template for security reasons
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
No tests was run? |
@giautm good job. thanks. re Tests, I have no chance to enable it on github. let me fix it now. by the way, could you also add this PR on https://github.com/yaitoo/xun/blob/main/CHANGELOG.md#unreleased |
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.
Excellent PR. thanks @giautm
It will be merged when CHANGELOG.md is updated.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
=======================================
Coverage 82.28% 82.28%
=======================================
Files 21 21
Lines 988 988
=======================================
Hits 813 813
Misses 138 138
Partials 37 37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Update changelog manually is boring stuff, you can have all changes on the GitHub release. They do generate it automatic for you, also https://goreleaser.com support generate Changelog file too. Use this button when create new release: |
I will check it , thanks. |
…iles
Close: #6
Summary by Sourcery
Bug Fixes:
text/template
which caused issues with HTML rendering.