Skip to content
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

Improve gosec plugin validation and typing #262

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ZoogieZork
Copy link
Contributor

Description

This improves our handling of the JSON report from running gosec by defining the expected data model. Parsing and validation is handled by Pydantic, which was already a transient dependency but is now a direct
dependency.

Additionally, we have migrated from the unmaintained cwe library to the newer cwe2 library.

Motivation and Context

Makes the plugin behave more reliably if gosec produces unexpected results, which will make it easier to upgrade gosec in the future.

How Has This Been Tested?

TODO

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist

  • My code follows conforms to the coding standards.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This improves our handling of the JSON report from running gosec by
defining the expected data model. Parsing and validation is handled by
Pydantic, which was already a transient dependency but is now a direct
dependency.
Unline the cwe library, cwe2 raises an InvalidCWEError exception when
the CWE is not found.  We provide the original default value in that
case.
Fixes "attempted relative import with no known parent package" when run
from the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant