-
Notifications
You must be signed in to change notification settings - Fork 27
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: guided remediation dependency resolution #432
base: main
Are you sure you want to change the base?
Conversation
d50b67f
to
47998ea
Compare
// OSVRecord is a representation of an OSV record. | ||
// TODO: replace with https://github.com/ossf/osv-schema/pull/333 | ||
type OSVRecord struct { |
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.
I should be able to do this soon
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.
internally we have a policy that all TODOs need to have a bug attached - can you create a github issue for moving Guided Remediation and refer to it here?
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.
Initial pass, mostly just internal policy specific nits
) | ||
|
||
// Temporarily internal while migration is in progress. | ||
// Will need to be moved to publicly accessible location once external interface is created. |
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.
Maybe add a TODO here and link to a github issue about moving guided remediation
// OSVRecord is a representation of an OSV record. | ||
// TODO: replace with https://github.com/ossf/osv-schema/pull/333 | ||
type OSVRecord struct { |
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.
internally we have a policy that all TODOs need to have a bug attached - can you create a github issue for moving Guided Remediation and refer to it here?
} `yaml:"affected,omitempty"` | ||
} | ||
|
||
type OSVEvent struct { |
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.
Add comment
|
||
type mockVulnerabilityMatcher []*matcher.OSVRecord | ||
|
||
func (mvc mockVulnerabilityMatcher) MatchVulnerabilities(ctx context.Context, invs []*extractor.Inventory) ([][]*matcher.OSVRecord, error) { |
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.
Add comment
return mockVulnerabilityMatcher(vulns.Vulns) | ||
} | ||
|
||
// TODO: similar logic will need to be used elsewhere in guided remediation. |
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.
Add issue
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package resolution provides dependency graph resolution and vulnerability findings |
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.
Our internal linters only expect this comment for just one of the package's files (so it'll complain if it's there for multiple files)
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.
LGTM - probably need to patch #442 (sorry for the trouble!)
Agree with Erik's suggestions on code styles. maybe we should find a way to implement the linter equivalent to the internal one, so we don't rely on manual review on these.
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package maven provides the manifest parsing and writing for the npm package.json format. |
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.
npm
mavenResolve "deps.dev/util/resolve/maven" | ||
npmResolve "deps.dev/util/resolve/npm" |
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.
I think the convention is mavenresolve
and npmresolve
- though not sure whether the internal linter will alarm this or not...
Beginning the move of guided remediation from osv-scanner. Started with the dependency resolution & vulnerability detection.
I've also removed the
DependencyClient
interface, since we only really need the deps.devresolve.Client
(this will conflict with the change in #441, I'll fix it here after that's merged).Trying to keep this stuff mostly self-contained in
internal/guidedremediation
as I work on it, but it I will have to move some things around eventually.