@preventive/triage 1.0.0-alpha.27 → 1.0.0-alpha.28
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/LICENSE-APACHE +202 -0
- package/client/linked-findings.js +1 -1
- package/common/bundle-metadata.js +12 -10
- package/common/code-language.js +17 -2
- package/common/default-scan-models.ts +3 -3
- package/common/finding-id.js +1 -1
- package/common/managed/report-content.ts +1 -1
- package/common/managed/report-filter.ts +1 -1
- package/out/client-managed-import.js +16 -16
- package/out/client-managed.js +93 -68
- package/out/graph.js +11 -11
- package/out/index.html +1 -1
- package/out/prism.js +2 -2
- package/out/stasis.svg +0 -25
- package/out/terminal.js +163 -163
- package/out/view.css +1 -1
- package/out/view.js +223 -190
- package/package.json +18 -28
- package/server-e2e/static.ts +3 -4
- package/server-managed/bundle-advisories.ts +53 -0
- package/server-managed/bundle-advisory-inventory.ts +75 -0
- package/server-managed/bundle-build-leases.ts +41 -0
- package/server-managed/bundle-build-worker.js +44 -0
- package/server-managed/bundle-build.ts +141 -0
- package/server-managed/bundle-cache.ts +22 -13
- package/server-managed/bundle-summary-cache.ts +27 -9
- package/server-managed/bundle.ts +66 -1
- package/server-managed/cache-storage.ts +4 -0
- package/server-managed/content-access.ts +1 -1
- package/server-managed/db-methods.ts +122 -20
- package/server-managed/db-neon.ts +121 -32
- package/server-managed/db-schema.ts +2 -0
- package/server-managed/db.ts +5 -1
- package/server-managed/github-app.ts +10 -15
- package/server-managed/github-errors.ts +21 -0
- package/server-managed/github-issues.ts +1 -1
- package/server-managed/github-metadata.ts +34 -1
- package/server-managed/github-pulls.ts +142 -30
- package/server-managed/http.ts +244 -131
- package/server-managed/index.ts +25 -9
- package/server-managed/management-catalog.ts +45 -0
- package/server-managed/object-storage-vercel.ts +1 -1
- package/server-managed/public-workspace.ts +20 -14
- package/server-managed/report-migration.ts +1 -1
- package/server-managed/report-sources.ts +14 -4
- package/server-managed/repository-browser.ts +3 -0
- package/server-managed/repository-discovery.ts +1 -1
- package/server-managed/revisions.ts +35 -0
- package/server-managed/sql-postgres.ts +1 -0
- package/server-managed/sql.ts +14 -3
- package/server-managed/storage-db.ts +12 -5
- package/server-managed/storage-maintenance.ts +37 -22
- package/server-managed/storage-payload.ts +16 -4
- package/server-managed/storage-stores.ts +2 -2
- package/server-managed/storage.ts +6 -4
- package/server-managed/team-feed.ts +50 -5
- package/server-managed/team-reports.ts +85 -22
- package/server-managed/workspace-shares.ts +15 -3
- package/report/index.js +0 -260
- package/report/src/finding-id.js +0 -80
- package/report/src/finding.js +0 -314
- package/report/src/labels.js +0 -35
- package/report/src/md-structure.js +0 -471
- package/report/src/md-text.js +0 -167
- package/report/src/meta.js +0 -76
- package/report/src/parse-codex.js +0 -149
- package/report/src/parse-deepsec.js +0 -199
- package/report/src/parse-deepview-fields.js +0 -375
- package/report/src/parse-deepview-md.js +0 -186
- package/report/src/parse-md-id.js +0 -137
- package/report/src/parse-md.js +0 -323
- package/report/src/parse-piolium-id.js +0 -79
- package/report/src/parse-piolium-rows.js +0 -126
- package/report/src/parse-piolium-tokens.js +0 -185
- package/report/src/parse-piolium.js +0 -399
- package/report/src/security.js +0 -63
- package/report/src/severity.js +0 -18
- package/report/src/utf8.js +0 -21
- package/report/src/write-md-finding.js +0 -273
- package/report/src/write-md.js +0 -291
- /package/{LICENSE → LICENSE-MIT} +0 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// no severity, no title, no file, no prose. That is the whole format.
|
|
9
9
|
//
|
|
10
10
|
// It is NOT a report, and this module deliberately sits outside
|
|
11
|
-
// `
|
|
11
|
+
// `@preventive/report` because of it. A report carries findings; a links file
|
|
12
12
|
// carries only ids of findings that must already live in reports the
|
|
13
13
|
// reader holds. So it never reaches `ingestReport` / `state.reports`,
|
|
14
14
|
// it has its own view (`ui/view/render-links.js`) that points at the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bundleCodeStats } from './bundle-stats.js'
|
|
2
2
|
import { Bundle } from '@exodus/stasis-core/bundle'
|
|
3
|
-
import { computeFileHash } from '
|
|
3
|
+
import { computeFileHash } from '@preventive/report'
|
|
4
4
|
import { utf8ByteLength } from './utf8.js'
|
|
5
5
|
import { bundleFileSizes, bundleSourcesAsMap, bundleUnsizedFiles } from './bundle-sources.js'
|
|
6
6
|
|
|
@@ -10,7 +10,8 @@ import { bundleFileSizes, bundleSourcesAsMap, bundleUnsizedFiles } from './bundl
|
|
|
10
10
|
// and a base64 resource for its spelling; after, it left every resource
|
|
11
11
|
// out. Either way its sizes are not file sizes, so it is read for its
|
|
12
12
|
// hashes alone and rebuilt on open.
|
|
13
|
-
|
|
13
|
+
// Version 3 also retains the bundle's repository and package origin metadata.
|
|
14
|
+
export const BUNDLE_METADATA_VERSION = 3
|
|
14
15
|
const INDEX_VERSION = BUNDLE_METADATA_VERSION
|
|
15
16
|
const hashJobs = new WeakMap()
|
|
16
17
|
const SOURCE_TABS = new Set(['terminal', 'code', 'search', 'compare'])
|
|
@@ -76,7 +77,7 @@ export async function createBundleMetadata(details) {
|
|
|
76
77
|
result.namesCount = names?.length ?? null
|
|
77
78
|
} else {
|
|
78
79
|
const b = details.bundle
|
|
79
|
-
const bundle = { version: b.version, config: b.config, formats: mapObject(b.formats), imports: mapObject(b.imports), reason: b.reason, executable: [...b.executable] }
|
|
80
|
+
const bundle = { version: b.version, config: b.config, repo: b.repo, package: b.package, formats: mapObject(b.formats), imports: mapObject(b.imports), reason: b.reason, executable: [...b.executable] }
|
|
80
81
|
if (b.version === 0) {
|
|
81
82
|
bundle.sources = Object.fromEntries([...sizes.keys()].map((path) => [path, null]))
|
|
82
83
|
} else {
|
|
@@ -108,20 +109,21 @@ export function createBundleSummary(details, metadata) {
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
// `stale` marks an index this version did not write: its hashes still
|
|
111
|
-
// answer report lookups, but
|
|
112
|
-
// and
|
|
112
|
+
// answer report lookups, but an open rebuilds it for current sizes, line
|
|
113
|
+
// counts and origin metadata.
|
|
113
114
|
export function parseBundleMetadata(data, integrity) {
|
|
114
|
-
if (
|
|
115
|
+
if (![1, 2, INDEX_VERSION].includes(data?.version) || data.integrity !== integrity || !['stasis', 'sourcemap'].includes(data.kind)
|
|
115
116
|
|| !Number.isSafeInteger(data.size) || data.size < 0 || !Array.isArray(data.files)) throw new Error('Invalid bundle metadata')
|
|
116
117
|
const stale = data.version !== INDEX_VERSION
|
|
118
|
+
const legacySizes = data.version === 1
|
|
117
119
|
const fileHashes = new Map(), fileSizes = new Map(), lineCounts = new Map()
|
|
118
120
|
for (const row of data.files) {
|
|
119
121
|
// Version 1 rows predate the line count, and gave every sized entry a hash.
|
|
120
|
-
if (!Array.isArray(row) || (row.length !== 4 && !(
|
|
122
|
+
if (!Array.isArray(row) || (row.length !== 4 && !(legacySizes && row.length === 3))) throw new Error('Invalid bundle metadata file')
|
|
121
123
|
const [path, size, hash, lines] = row
|
|
122
124
|
if (typeof path !== 'string' || fileSizes.has(path) || (size !== null && (!Number.isSafeInteger(size) || size < 0))
|
|
123
125
|
|| (hash !== null && (typeof hash !== 'string' || !/^sha512-[A-Za-z0-9+/]{86}==$/u.test(hash)))
|
|
124
|
-
|| (size === null && hash !== null) || (
|
|
126
|
+
|| (size === null && hash !== null) || (legacySizes && size !== null && hash === null)
|
|
125
127
|
|| (lines !== undefined && lines !== null && (!Number.isSafeInteger(lines) || lines < 0))) throw new Error('Invalid bundle metadata file')
|
|
126
128
|
fileSizes.set(path, size)
|
|
127
129
|
if (hash !== null) fileHashes.set(path, hash)
|
|
@@ -129,7 +131,7 @@ export function parseBundleMetadata(data, integrity) {
|
|
|
129
131
|
}
|
|
130
132
|
// Only a sizeless row can name a mounted file with no size, and only once.
|
|
131
133
|
const unsized = new Set(data.unsized ?? [])
|
|
132
|
-
if ((data.unsized !== undefined && (
|
|
134
|
+
if ((data.unsized !== undefined && (legacySizes || !Array.isArray(data.unsized) || unsized.size !== data.unsized.length))
|
|
133
135
|
|| [...unsized].some((path) => typeof path !== 'string' || !fileSizes.has(path) || fileSizes.get(path) !== null)) throw new Error('Invalid bundle metadata')
|
|
134
136
|
const details = { integrity, kind: data.kind, size: data.size, metadataOnly: true, fileSizes, fileHashes, lineCounts, unsizedFiles: unsized, stale }
|
|
135
137
|
if (data.kind === 'stasis') {
|
|
@@ -140,7 +142,7 @@ export function parseBundleMetadata(data, integrity) {
|
|
|
140
142
|
// no hash. And only a base64 resource can be mounted without a size.
|
|
141
143
|
// Both are checked against the formats, which only the bundle carries.
|
|
142
144
|
const formats = details.bundle.formats
|
|
143
|
-
if (!
|
|
145
|
+
if (!legacySizes && [...fileSizes].some(([path, size]) => fileHashes.has(path) !== (size !== null && !Bundle.isResourceFormat(formats.get(path))))) {
|
|
144
146
|
throw new Error('Invalid bundle metadata inventory')
|
|
145
147
|
}
|
|
146
148
|
if ([...unsized].some((path) => formats.get(path) !== 'resource:base64')) throw new Error('Invalid bundle metadata inventory')
|
package/common/code-language.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const EXT_TO_LANG = {
|
|
2
|
+
__proto__: null,
|
|
2
3
|
js: 'javascript', mjs: 'javascript', cjs: 'javascript',
|
|
3
4
|
jsx: 'jsx',
|
|
4
5
|
ts: 'typescript', mts: 'typescript', cts: 'typescript',
|
|
@@ -13,6 +14,7 @@ const EXT_TO_LANG = {
|
|
|
13
14
|
php: 'php', phtml: 'php',
|
|
14
15
|
rs: 'rust',
|
|
15
16
|
rb: 'ruby',
|
|
17
|
+
py: 'python', pyw: 'python', pyi: 'python',
|
|
16
18
|
java: 'java',
|
|
17
19
|
// .h is claimed by C, C++ and Objective-C alike. The C++ grammar
|
|
18
20
|
// extends the C one, so it is the superset that colours a header
|
|
@@ -24,7 +26,21 @@ const EXT_TO_LANG = {
|
|
|
24
26
|
m: 'objectivec', mm: 'objectivec',
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
// Stasis records loader formats as well as language names. Resolve those to
|
|
30
|
+
// the grammars we ship before consulting the filename.
|
|
31
|
+
const FORMAT_TO_LANG = {
|
|
32
|
+
__proto__: null,
|
|
33
|
+
module: 'javascript', commonjs: 'javascript',
|
|
34
|
+
'module-typescript': 'typescript', 'commonjs-typescript': 'typescript',
|
|
35
|
+
json: 'json', solidity: 'solidity', php: 'php', shell: 'bash', rust: 'rust',
|
|
36
|
+
java: 'java', objc: 'objectivec', objcpp: 'objectivec',
|
|
37
|
+
c: 'c', 'c-header': 'c', cpp: 'cpp', 'cpp-header': 'cpp',
|
|
38
|
+
ruby: 'ruby', podspec: 'ruby', podfile: 'ruby', fastlane: 'ruby',
|
|
39
|
+
'podfile-lock': 'yaml', xml: 'markup',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function langForPath(path, format) {
|
|
43
|
+
if (typeof format === 'string' && FORMAT_TO_LANG[format]) return FORMAT_TO_LANG[format]
|
|
28
44
|
if (typeof path !== 'string') return null
|
|
29
45
|
// Only the filename can contribute an extension. A dotted directory such
|
|
30
46
|
// as `.abc/edf` is a path segment, not an extension on `edf`.
|
|
@@ -33,4 +49,3 @@ export function langForPath(path) {
|
|
|
33
49
|
if (dot <= 0) return null
|
|
34
50
|
return EXT_TO_LANG[basename.slice(dot + 1).toLowerCase()] ?? null
|
|
35
51
|
}
|
|
36
|
-
|
|
@@ -4,12 +4,12 @@ export function defaultScanModels(provider: string | null = null) {
|
|
|
4
4
|
const ids = [
|
|
5
5
|
'anthropic/claude-opus-5.5',
|
|
6
6
|
'anthropic/claude-fable-5.1',
|
|
7
|
-
'anthropic/claude-sonnet-5',
|
|
7
|
+
'anthropic/claude-sonnet-5.5',
|
|
8
8
|
'anthropic/claude-haiku-4.5',
|
|
9
9
|
'openai/gpt-6-astra',
|
|
10
10
|
'openai/gpt-6-astra-pro',
|
|
11
|
-
'openai/gpt-6-sol',
|
|
12
|
-
'openai/gpt-6-sol-pro',
|
|
11
|
+
'openai/gpt-6.1-sol',
|
|
12
|
+
'openai/gpt-6.1-sol-pro',
|
|
13
13
|
'openai/gpt-6-luna',
|
|
14
14
|
'openai/gpt-6-luna-pro',
|
|
15
15
|
'moonshotai/kimi-k3',
|
package/common/finding-id.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// finding after a reload — including in the SENDER's own tab. Those are
|
|
6
6
|
// refused up front rather than silently mis-resolving. Everything else
|
|
7
7
|
// the app treats as persistent — the analyzer's uuids, the deterministic
|
|
8
|
-
// uuids
|
|
8
|
+
// uuids `@preventive/report/src/finding-id.js` derives, and the codex importer's
|
|
9
9
|
// finding-URL ids — is linkable, which is why this is a
|
|
10
10
|
// "not session-local" test rather than a uuid-shape test.
|
|
11
11
|
const SESSION_ID_RE = /^\d+$/u
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseLinkedFindings } from '../../client/linked-findings.js'
|
|
2
|
-
import { detectFormat, loadFindings, parseCodexCsvToScans, readReport } from '
|
|
2
|
+
import { detectFormat, loadFindings, parseCodexCsvToScans, readReport } from '@preventive/report'
|
|
3
3
|
|
|
4
4
|
// A managed blob retains one server identity even when a CSV contains several
|
|
5
5
|
// scans. Keep all their findings (and upstream ids) under that identity. CSV
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Apply report permissions before serving findings, triage, or source files.
|
|
2
2
|
// Security uses the same complete-row classification as the UI. Dependency
|
|
3
3
|
// access is per finding: App, own source, and the own-source organizations stay.
|
|
4
|
-
import { inheritReportMeta, isAppFinding, reportRepoGithub, stampSecurityGroups } from '
|
|
4
|
+
import { inheritReportMeta, isAppFinding, reportRepoGithub, stampSecurityGroups } from '@preventive/report'
|
|
5
5
|
import { readManagedReport } from './report-content.ts'
|
|
6
6
|
|
|
7
7
|
export interface ViewerPermissions {
|