Giter Site home page Giter Site logo

Comments (8)

ccojocar avatar ccojocar commented on June 14, 2024

This is because gosec executes the scan in the folder provider as input, and in this case in the ./cpu folder there ins't any go.mod file found.

If the scan is executed in the root of the folder where the go.mod is available, it will be successful. You can scan the whole module with: gosec -terse ./....

from gosec.

sudo-bmitch avatar sudo-bmitch commented on June 14, 2024

@ccojocar the error still occurs if the full project is scanned, there's just a lot more output to scan through to see it and I'm trying to keep the example a minimal real world demonstration.

from gosec.

ccojocar avatar ccojocar commented on June 14, 2024

I see but looking at the code, it seems that those functions are without body and they are implemented outside of Go in C/assembly.

https://go.googlesource.com/sys/+/refs/heads/master/cpu/cpu_gc_x86.go#11

I think you can ignore these errors.

from gosec.

sudo-bmitch avatar sudo-bmitch commented on June 14, 2024

They are not being ignored because the scanner exits with a non-zero return code.

from gosec.

ccojocar avatar ccojocar commented on June 14, 2024

The CFiles/SFiles are not included in the package loading just the CgoFiles (which are go files with import "C" inside). This is why the compilation fails in this case. You can use the -no-fail argument if you want to ignore them.

from gosec.

sudo-bmitch avatar sudo-bmitch commented on June 14, 2024

Using -no-fail effectively disables the scanner. That's something I can do by just removing the scanner from my project.

from gosec.

ccojocar avatar ccojocar commented on June 14, 2024

Unfortunately the packages.Load doesn't parse the assembly implementation for functions without body. Even when the SFiles are provided to the loader, it returns the following error:

Golang errors in file: [cpu]:

  > [line 0 : column 0] - loading files from package "cpu": -: named files must be .go files: cpu/cpu_x86.s

There isn't much we can do on gosec side about this. If you find a solution to this problem, I happy to include it. Just let me know.

You can exclude the folders that have assembly implementation for function without body and keep scanning for purego or cgo folder/packages in your module.

from gosec.

sudo-bmitch avatar sudo-bmitch commented on June 14, 2024

Why not give the ability to ignore the errors and not cause a non-zero exit when they are the only error encountered?

from gosec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.