-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdependency_source.go
More file actions
43 lines (40 loc) · 1.7 KB
/
Copy pathdependency_source.go
File metadata and controls
43 lines (40 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package sdk
// DependencySource describes how a dependency occurrence is resolved.
type DependencySource string
const (
DependencySourceRegistry DependencySource = "registry"
DependencySourceProject DependencySource = "project"
DependencySourceWorkspace DependencySource = "workspace"
DependencySourceFile DependencySource = "file"
DependencySourceGit DependencySource = "git"
DependencySourceURL DependencySource = "url"
)
// RegistryMatchEligible reports whether this dependency may be sent to
// external package matchers. Ownership and structure are the node kind
// under the union — module and manifest nodes cannot reach this method —
// so only the source classification decides. Project, workspace, file,
// Git, and arbitrary URL records are normally excluded. Swift
// source-control packages remain eligible because their repository URL is
// the canonical SwiftURL package identity used by vulnerability sources.
// An omitted source stays eligible for protocol-v1 and legacy detector
// compatibility. Graph insertion folds eligibility toward eligible: when
// records of one identity disagree, the eligible witness's source
// survives.
func (d *DependencyNode) RegistryMatchEligible() bool {
if d == nil {
return false
}
if d.Ecosystem == EcosystemSwift && d.Source == DependencySourceGit {
return true
}
switch d.Source {
case DependencySourceProject, DependencySourceWorkspace, DependencySourceFile, DependencySourceGit, DependencySourceURL:
return false
case DependencySourceRegistry, "":
return true
default:
// Custom plugin source values predate this classification. Preserve
// matching until the plugin explicitly adopts a non-registry source.
return true
}
}