-
-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on adding new rules and analyzers #1262
Conversation
Add some docs for developers who want to extend gosec
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1262 +/- ##
==========================================
- Coverage 68.49% 66.66% -1.84%
==========================================
Files 75 75
Lines 4384 5186 +802
==========================================
+ Hits 3003 3457 +454
- Misses 1233 1581 +348
Partials 148 148 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together. I left a few comments, it would be great if you could address them.
I would also add a link in the README to this doc. Maybe in the development section https://github.com/securego/gosec?tab=readme-ov-file#development. |
Co-authored-by: Oleksandr Redko <[email protected]>
Co-authored-by: Oleksandr Redko <[email protected]>
Co-authored-by: Oleksandr Redko <[email protected]>
Co-authored-by: Oleksandr Redko <[email protected]>
Co-authored-by: Oleksandr Redko <[email protected]>
Fix phrasing to be clearer
|
||
### Adding an Analyzer | ||
|
||
1. Create a new go file under `./analyzers/` with the following scaffolding in it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking
1. Create a new go file under `./analyzers/` with the following scaffolding in it: | |
1. Create a new Go file under `./analyzers/` with the following scaffolding in it: |
1. Create a new go file under `./analyzers/` with the following scaffolding in it: | |
1. Create a new .go file under `./analyzers/` with the following scaffolding in it: |
|
||
2. Add the analyzer to `./analyzers/analyzerslist.go` in the `defaultAnalyzers` variable under an entry like `{"G999", "My test analyzer", newMyAnalyzer}` | ||
3. Add a RuleID to CWE ID mapping for your rule to the `ruleToCWE` map in `./issue/issue.go`. If you need a CWE that isn't already defined in `./cwe/data.go`, add it to the `idWeaknessess` map in that file. | ||
4. `make`; then run the `gosec` binary produced. You should see the output from our print statement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's about the make command
4. `make`; then run the `gosec` binary produced. You should see the output from our print statement. | |
4. Run `make`; then run the `gosec` binary produced. You should see the output from our print statement. |
Or anything like that
Add some docs for developers who want to extend gosec-- this is based on my personal notes I took while attempting to add a taint analyzer (it didn't pan out, but I intend to keep looking into it).
I've also drawn a diagram in miro, which I will add in a future PR once I figure out how to export it to useful file format.