Skip to content

Commit 219bf3e

Browse files
committed
chore: add nolint annotations for gosec linter
Add //nolint:gosec annotations for intentional code patterns that are safe in context (path traversal in release tool, uintptr conversion for terminals, weak rand in tests, TLS skip verify for user-configured insecure mode). Assisted-by: Kimi-K2.5 via Crush <crush@charm.land>
1 parent b36fcfd commit 219bf3e

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

cmd/release/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func changelog(version *semver.Version) error {
117117
changelog = changelogReleaseRegex.ReplaceAllString(changelog, fmt.Sprintf("## v%s - %s", version, date))
118118

119119
// Write the changelog to the source file
120-
if err := os.WriteFile(changelogSource, []byte(changelog), 0o644); err != nil {
120+
if err := os.WriteFile(changelogSource, []byte(changelog), 0o644); err != nil { //nolint:gosec
121121
return err
122122
}
123123

@@ -129,7 +129,7 @@ func changelog(version *semver.Version) error {
129129
changelogWithFrontmatter := fmt.Sprintf("---\n%s\n---\n\n%s", frontmatter, changelogWithVPre)
130130

131131
// Write the changelog to the target file
132-
return os.WriteFile(changelogTarget, []byte(changelogWithFrontmatter), 0o644)
132+
return os.WriteFile(changelogTarget, []byte(changelogWithFrontmatter), 0o644) //nolint:gosec
133133
}
134134

135135
func setVersionFile(fileName string, version *semver.Version) error {

internal/term/term.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ import (
77
)
88

99
func IsTerminal() bool {
10-
return term.IsTerminal(int(os.Stdin.Fd())) && term.IsTerminal(int(os.Stdout.Fd()))
10+
return term.IsTerminal(int(os.Stdin.Fd())) && term.IsTerminal(int(os.Stdout.Fd())) //nolint:gosec
1111
}

task_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ func TestIncludesRemote(t *testing.T) {
10221022

10231023
for k, taskCall := range taskCalls {
10241024
t.Run(taskCall.Task, func(t *testing.T) {
1025-
expectedContent := fmt.Sprint(rand.Int64())
1025+
expectedContent := fmt.Sprint(rand.Int64()) //nolint:gosec
10261026
t.Setenv("CONTENT", expectedContent)
10271027

10281028
outputFile := fmt.Sprintf("%d.%d.txt", i, k)

taskfile/node_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func buildHTTPClient(insecure bool, caCert, cert, certKey string) (*http.Client,
3838
}
3939

4040
tlsConfig := &tls.Config{
41-
InsecureSkipVerify: insecure,
41+
InsecureSkipVerify: insecure, //nolint:gosec
4242
}
4343

4444
// Load custom CA certificate if provided

taskrc/reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (r *Reader) Read(node *Node) (*ast.TaskRC, error) {
6565
}
6666

6767
// Read the file
68-
b, err := os.ReadFile(node.entrypoint)
68+
b, err := os.ReadFile(node.entrypoint) //nolint:gosec
6969
if err != nil {
7070
return nil, err
7171
}

0 commit comments

Comments
 (0)