Comments (8)
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.
@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.
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.
They are not being ignored because the scanner exits with a non-zero return code.
from gosec.
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.
Using -no-fail
effectively disables the scanner. That's something I can do by just removing the scanner from my project.
from gosec.
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.
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)
- Create Actions PR Mode HOT 1
- apply `nosec` to entire file HOT 2
- G306 triggered on executable bit set HOT 3
- G601 with go version 1.22 or later HOT 1
- nosec statement ignored when additionally defined in front of function, const or variable segment HOT 4
- Support for `// nolint:gosec` to skip lines on top of `// #nosec` HOT 2
- Support the `math/rand/v2` added in Go 1.22 HOT 4
- QA: wrap gosec to golangci-lint speed up to 10x HOT 7
- G601 does not catch all cases HOT 1
- Is it possible to integrate with VS Code? HOT 1
- G101: False positive of HIGH Severity on constant HOT 2
- G306 can be easily bypassed with `os.ModePerm`
- False positive on G304 (CWE-22) after `filepath.EvalSymlinks`
- no cache usage on 18.2 and 19.0 HOT 1
- Add detection of overflow during integer conversion HOT 1
- Regarding customizing a configuration file to load G101 rules, where keywords with "-" cannot be matched HOT 1
- Documentation on how to use sig files for release binaries HOT 1
- 'go install' doesn't work HOT 2
- Gosec Configuration file to integrate with GitHub ( as a workflow file) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosec.