@preventive/triage 1.0.0-alpha.41 → 1.0.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/managed/report-filter.ts +2 -1
- package/common/security-links.d.ts +5 -0
- package/common/security-links.js +33 -0
- package/out/{chunk-TY4RZD3Z.js → chunk-7RU5EDRO.js} +61 -61
- package/out/{chunk-XL35ZV6R.js → chunk-A7M4GV7M.js} +1 -1
- package/out/{chunk-2AFQKRAM.js → chunk-CLPKNNC7.js} +7 -7
- package/out/{chunk-UZAZM2SX.js → chunk-LAAB5SZT.js} +1 -1
- package/out/{chunk-KVEUXIEU.js → chunk-NWZ4PVPN.js} +1 -1
- package/out/{chunk-QZ3A376W.js → chunk-OSIMGFUF.js} +1 -1
- package/out/{chunk-U6OPEXIA.js → chunk-XOCAPDCM.js} +1 -1
- package/out/client-managed.js +19 -19
- package/out/index.html +3 -3
- package/out/view.js +54 -54
- package/package.json +9 -3
- package/risk/files/runs-code.js +13 -5
- package/risk/index.d.ts +26 -0
- package/risk/index.js +1 -1
- package/risk/npm/assess.js +60 -14
- package/risk/npm/combined.js +4 -1
- package/risk/npm/compare.js +10 -5
- package/risk/npm/dependencies.js +11 -3
- package/risk/npm/diff.js +42 -6
- package/risk/npm/held.js +5 -2
- package/risk/npm/new-dependency.js +42 -12
- package/risk/npm/registry.js +122 -21
- package/server-managed/http.ts +63 -26
- package/server-managed/locked-packages.ts +18 -6
- package/server-managed/npm-kept.ts +38 -14
- package/server-managed/npm-packages.ts +27 -13
- package/server-managed/npm-risk.ts +69 -11
- package/server-managed/pretty-print.ts +1 -1
- package/server-managed/queue.ts +23 -0
- package/server-managed/report-sources.ts +1 -1
- package/server-managed/repository-risk-assess.ts +105 -0
- package/server-managed/repository-risk-audit.ts +66 -0
- package/server-managed/repository-risk.ts +255 -201
- package/server-managed/scan-downloads.ts +87 -0
- package/server-managed/sql.ts +1 -1
- package/server-managed/team-reports.ts +6 -11
- package/server-managed/type-only-worker.js +3 -3
- package/server-managed/type-only.ts +4 -2
- package/server-managed/upstream-cache.ts +16 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// access is per finding: App, own source, and the own-source organizations stay.
|
|
4
4
|
import { inheritReportMeta, isAppFinding, reportRepoGithub, stampSecurityGroups } from '@preventive/report'
|
|
5
5
|
import { readManagedReport } from './report-content.ts'
|
|
6
|
+
import { revalidationLinks, securityLinks } from '../security-links.js'
|
|
6
7
|
|
|
7
8
|
export interface ViewerPermissions {
|
|
8
9
|
dependencies: boolean
|
|
@@ -80,7 +81,7 @@ export function filterReportData(data: unknown, perms: ViewerPermissions, repo?:
|
|
|
80
81
|
entry, members: (Array.isArray(entry) ? entry : [entry]).map(original => ({ original, finding: projectFinding(original, report) })),
|
|
81
82
|
}))
|
|
82
83
|
const groups = entries.map(({ members }) => members.flatMap(({ finding }) => finding ? [finding] : []))
|
|
83
|
-
if (!perms.security) stampSecurityGroups(groups)
|
|
84
|
+
if (!perms.security) stampSecurityGroups(groups, { linkedIds: securityLinks(revalidationLinks(groups.flat())).linkedIds })
|
|
84
85
|
const githubOrgs = new Set<string>(), npmScopes = new Set<string>()
|
|
85
86
|
const addOrgs = (finding: Finding) => {
|
|
86
87
|
const github = githubOrg(finding), npm = npmScope(finding)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Links as stampSecurityGroups reads them, shared by the managed server's
|
|
2
|
+
// permission filter and the view's security lens. A star per link is enough
|
|
3
|
+
// for transitive propagation, without a quadratic expansion for large links.
|
|
4
|
+
// `add` extends the lookup while a stamp is running: rows the finding index
|
|
5
|
+
// returns can carry links of their own.
|
|
6
|
+
export function securityLinks(links = []) {
|
|
7
|
+
const edges = new Map()
|
|
8
|
+
const connect = (a, b) => {
|
|
9
|
+
if (!edges.has(a)) edges.set(a, new Set())
|
|
10
|
+
edges.get(a).add(b)
|
|
11
|
+
}
|
|
12
|
+
const add = (ids) => {
|
|
13
|
+
for (const id of ids.slice(1)) { connect(ids[0], id); connect(id, ids[0]) }
|
|
14
|
+
}
|
|
15
|
+
for (const ids of links) add(ids)
|
|
16
|
+
return { add, linkedIds: (id) => edges.get(id) ?? [] }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// An App finding can name the source findings it revalidated only by ID, in
|
|
20
|
+
// another row or report. The App view counts those as represented by it, so
|
|
21
|
+
// they are one issue for security too: hiding one side alone would leave the
|
|
22
|
+
// App answer to a hidden security finding, or a source row without its App row.
|
|
23
|
+
// Only App findings: the view ignores inputs on any other finding
|
|
24
|
+
// (finding-filters.js confirmedCoverage, revalidation-input-groups.js).
|
|
25
|
+
export function revalidationLinks(findings) {
|
|
26
|
+
const links = []
|
|
27
|
+
for (const finding of findings) {
|
|
28
|
+
const inputs = finding?.revalidateInputs
|
|
29
|
+
if (finding?.isApp !== true || typeof finding.id !== 'string' || !Array.isArray(inputs)) continue
|
|
30
|
+
links.push([finding.id, ...inputs.filter((id) => typeof id === 'string' && id !== '')])
|
|
31
|
+
}
|
|
32
|
+
return links
|
|
33
|
+
}
|