Skip to content

Some of the inline code annotation stopped working #736

Closed
@roytman

Description

@roytman

Summary

The code annotations in the format:

/* #nosec G306 */
// Avoid nosec "Expect WriteFile permissions to be 0600 or less" error
some code

or annotations without justification stopped working

Annotations with inline justification, work as expected.

// #nosec G306 -- Avoid nosec "Expect WriteFile permissions to be 0600 or less" error
some code

Steps to reproduce the behavior

run gosec with the following code

func main() {
	/* #nosec G306 */
	// Avoid nosec "Expect WriteFile permissions to be 0600 or less" error
	err := ioutil.WriteFile("test", []byte("someData"), 0644)
	if err != nil {}
}

gosec version

Just installed the latest version,

gosec  -version                                                                                                                                                                   
Version: dev
Git tag: 
Build date: 

Go version (output of 'go version')

go version go1.16.3 linux/amd64

Operating system / Environment

Linux alexey-VB2 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Expected behavior

Do not print security warnings

Actual behavior

Warnings are printed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions