Skip to content

Commit 2840313

Browse files
ndpvt-webclaude
andcommitted
fix: address review feedback for URL dependency detection
- Scan all packages for URL deps, not just root (fixes transitive detection) - Align isUrlDependency with resolveVersion URL patterns - Use computed map for URL dep lookups in Dependencies.vue - Remove orphaned url field from ResolvedPackage interface Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 761e38e commit 2840313

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

app/components/Package/Dependencies.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ function getDeprecatedDepInfo(depName: string) {
3737
return vulnTree.value.deprecatedPackages.find(p => p.name === depName && p.depth === 'direct')
3838
}
3939
40+
// Cache URL dependency lookups with computed map
41+
const urlDepMap = computed(() => {
42+
if (!vulnTree.value) return new Map()
43+
return new Map(vulnTree.value.urlDependencies.map(dep => [dep.name, dep]))
44+
})
45+
4046
// Check if a dependency uses git: or https: URL
4147
function getUrlDepInfo(depName: string) {
42-
if (!vulnTree.value) return null
43-
return vulnTree.value.urlDependencies.find(p => p.name === depName)
48+
return urlDepMap.value.get(depName) ?? null
4449
}
4550
4651
// Expanded state for each section

server/utils/dependency-analysis.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,13 @@ function getSeverityLevel(vuln: OsvVulnerability): OsvSeverityLevel {
260260
* Check if a dependency URL is a git: or https: URL that should be flagged.
261261
*/
262262
function isUrlDependency(url: string): boolean {
263-
return url.startsWith('git:') || url.startsWith('https:') || url.startsWith('git+https:')
263+
return (
264+
url.startsWith('git:') ||
265+
url.startsWith('git+') ||
266+
url.startsWith('http:') ||
267+
url.startsWith('https:') ||
268+
url.startsWith('file:')
269+
)
264270
}
265271

266272
/**
@@ -336,8 +342,12 @@ export const analyzeDependencyTree = defineCachedFunction(
336342
return depthOrder[a.depth] - depthOrder[b.depth]
337343
})
338344

339-
// Scan for git: and https: URL dependencies in the root package
340-
const urlDependencies = await scanUrlDependencies(name, version, 'root', [])
345+
// Scan for git: and https: URL dependencies in all packages
346+
const urlDependencies: UrlDependencyInfo[] = []
347+
for (const pkg of packages) {
348+
const pkgUrlDeps = await scanUrlDependencies(pkg.name, pkg.version, pkg.depth, pkg.path)
349+
urlDependencies.push(...pkgUrlDeps)
350+
}
341351

342352
// Step 1: Use batch API to find which packages have vulnerabilities
343353
// This is much faster than individual queries - one request for all packages

server/utils/dependency-resolver.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ export interface ResolvedPackage {
106106
path?: string[]
107107
/** Deprecation message if the version is deprecated */
108108
deprecated?: string
109-
/** Original URL if this was a git: or https: dependency */
110-
url?: string
111109
}
112110

113111
/**

0 commit comments

Comments
 (0)