All checks were successful
check / check (push) Successful in 2m36s
The pinned CI linter's gosec G120 flagged r.FormValue in buildDatabaseTargetConfig because the MaxBytesReader guard lives one function up in processTargetCreate, out of static-analysis sight. Read the expiry alongside the other form values in processTargetCreate and pass it down as a string, matching how the http and slack config builders receive their URL.
35 lines
859 B
Go
35 lines
859 B
Go
package handlers
|
|
|
|
import "net/http"
|
|
|
|
// RenderTemplateForTest exposes renderTemplate for use in the
|
|
// handlers_test package.
|
|
func (s *Handlers) RenderTemplateForTest(
|
|
w http.ResponseWriter,
|
|
r *http.Request,
|
|
pageTemplate string,
|
|
data any,
|
|
) {
|
|
s.renderTemplate(w, r, pageTemplate, data)
|
|
}
|
|
|
|
// BuildSlackTargetConfigForTest exposes buildSlackTargetConfig
|
|
// for use in the handlers_test package.
|
|
func (s *Handlers) BuildSlackTargetConfigForTest(
|
|
w http.ResponseWriter,
|
|
r *http.Request,
|
|
targetURL string,
|
|
) (string, error) {
|
|
return s.buildSlackTargetConfig(w, r, targetURL)
|
|
}
|
|
|
|
// BuildDatabaseTargetConfigForTest exposes
|
|
// buildDatabaseTargetConfig for use in the handlers_test
|
|
// package.
|
|
func (s *Handlers) BuildDatabaseTargetConfigForTest(
|
|
w http.ResponseWriter,
|
|
expiry string,
|
|
) (string, error) {
|
|
return s.buildDatabaseTargetConfig(w, expiry)
|
|
}
|