aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-06 21:10:22 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-06 21:10:22 +0800
commit39aba302878fcffba7496d0892268c8f1467fcd2 (patch)
tree5c80ebd5d844f41393515c430036f5707942b522
parentlint: Add lint script (diff)
downloadforge-39aba302878fcffba7496d0892268c8f1467fcd2.tar.gz
forge-39aba302878fcffba7496d0892268c8f1467fcd2.tar.zst
forge-39aba302878fcffba7496d0892268c8f1467fcd2.zip
repo/tree, readme: nosec G203
-rw-r--r--http_handle_repo_tree.go2
-rw-r--r--reamde_to_html.go8
2 files changed, 5 insertions, 5 deletions
diff --git a/http_handle_repo_tree.go b/http_handle_repo_tree.go
index 190f082..ae9efbc 100644
--- a/http_handle_repo_tree.go
+++ b/http_handle_repo_tree.go
@@ -84,7 +84,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request, params map[string]
http.Error(w, "Error formatting code: "+err.Error(), http.StatusInternalServerError)
return
}
- formatted_encapsulated = template.HTML(formatted_unencapsulated.Bytes())
+ formatted_encapsulated = template.HTML(formatted_unencapsulated.Bytes()) //#nosec G203
params["file_contents"] = formatted_encapsulated
render_template(w, "repo_tree_file", params)
diff --git a/reamde_to_html.go b/reamde_to_html.go
index 4564344..29c61ca 100644
--- a/reamde_to_html.go
+++ b/reamde_to_html.go
@@ -29,7 +29,7 @@ func render_readme_at_tree(tree *object.Tree) (readme_filename string, readme_co
return "Error fetching README", string_escape_html("Unable to fetch contents of README: " + err.Error())
}
- return "README", template.HTML("<pre>" + html.EscapeString(readme_file_contents) + "</pre>")
+ return "README", template.HTML("<pre>" + html.EscapeString(readme_file_contents) + "</pre>") //#nosec G203
}
if readme_file, err = tree.File("README.md"); err == nil {
@@ -41,7 +41,7 @@ func render_readme_at_tree(tree *object.Tree) (readme_filename string, readme_co
return "Error fetching README", string_escape_html("Unable to render README: " + err.Error())
}
- return "README.md", template.HTML(bluemonday.UGCPolicy().SanitizeBytes(readme_rendered_unsafe.Bytes()))
+ return "README.md", template.HTML(bluemonday.UGCPolicy().SanitizeBytes(readme_rendered_unsafe.Bytes())) //#nosec G203
}
if readme_file, err = tree.File("README.org"); err == nil {
@@ -54,12 +54,12 @@ func render_readme_at_tree(tree *object.Tree) (readme_filename string, readme_co
return "Error fetching README", string_escape_html("Unable to render README: " + err.Error())
}
- return "README.org", template.HTML(bluemonday.UGCPolicy().Sanitize(org_html))
+ return "README.org", template.HTML(bluemonday.UGCPolicy().Sanitize(org_html)) //#nosec G203
}
return "", ""
}
func string_escape_html(s string) template.HTML {
- return template.HTML(html.EscapeString(s))
+ return template.HTML(html.EscapeString(s)) //#nosec G203
}