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

feat(osv): add osv support #161

Merged
merged 15 commits into from
Jan 11, 2022
Merged

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Nov 19, 2021

}
}

func MustParse(layout, value string) *time.Time {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it's public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made it private

},
},
{
name: "single range version and references Go",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you name it better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed test names

Rust = "crates.io"
)

var defaultEcosystem = []ecosystem{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using map here this way getEcoSystem() won't be required

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also variable name should be in plural form

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made map, remove getEcoSystem()

}

func (vs VulnSrc) Name() string {
switch vs.ecosystem.name {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add vulnerability.OsvPyPI, vulnerability.OsvGo and vulnerability.OsvCratesio as separate property to defaultEcosystems map entries above. Get entry and return that property when name is required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added new field in ecosystem, changed Name()

return ecosystem{}
}

func (vs VulnSrc) Get(pkgName string) ([]types.Advisory, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used GetAdvisories

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after latest trivy change it may be not required at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed Get()

return ecosystem{}
}

func (vs VulnSrc) Get(pkgName string) ([]types.Advisory, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after latest trivy change it may be not required at all

}

type VulnSrc struct {
ecosystem ecosystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

func Get removed, ecosystem is pointer now

const (
osvDir = "osv"
platformFormat = "%s::Osv Security Advisories"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can this function.

func Name(ecosystem, dataSource string) (string, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used this function

"github.com/aquasecurity/trivy-db/pkg/types"
"github.com/aquasecurity/trivy-db/pkg/utils"
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/vulnerability"
vtypes "github.com/aquasecurity/vuln-list-update/osv"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't depend on vuln-list-udpate. You can define a new struct having necessary fields only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@DmitriyLewen
Copy link
Contributor Author

Hello @knqyf263 !
I fixed errors after merging main branch, can you check?

@knqyf263 knqyf263 merged commit 0766abf into aquasecurity:main Jan 11, 2022
This was referenced Jan 13, 2022
@DmitriyLewen DmitriyLewen deleted the osv-support branch January 18, 2022 10:39
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.

3 participants