@extenshi/cli 0.0.8 → 0.1.0
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/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +92 -3
- package/dist/cli.js.map +1 -1
- package/dist/html-report.d.ts +44 -0
- package/dist/html-report.d.ts.map +1 -0
- package/dist/html-report.js +527 -0
- package/dist/html-report.js.map +1 -0
- package/dist/render.d.ts +22 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +82 -2
- package/dist/render.js.map +1 -1
- package/dist/report.d.ts +30 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +130 -0
- package/dist/report.js.map +1 -0
- package/dist/review-archive.d.ts +29 -0
- package/dist/review-archive.d.ts.map +1 -0
- package/dist/review-archive.js +106 -0
- package/dist/review-archive.js.map +1 -0
- package/dist/review-catalog.d.ts +43 -0
- package/dist/review-catalog.d.ts.map +1 -0
- package/dist/review-catalog.js +82 -0
- package/dist/review-catalog.js.map +1 -0
- package/dist/review-checks.d.ts +139 -0
- package/dist/review-checks.d.ts.map +1 -0
- package/dist/review-checks.js +560 -0
- package/dist/review-checks.js.map +1 -0
- package/dist/review-render.d.ts +10 -0
- package/dist/review-render.d.ts.map +1 -0
- package/dist/review-render.js +94 -0
- package/dist/review-render.js.map +1 -0
- package/dist/review-risk.d.ts +29 -0
- package/dist/review-risk.d.ts.map +1 -0
- package/dist/review-risk.js +85 -0
- package/dist/review-risk.js.map +1 -0
- package/dist/scan.d.ts +82 -2
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +164 -17
- package/dist/scan.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* review-risk — pure check logic for the pre-publish "will the store reject /
|
|
3
|
+
* slow-walk / silently disable this?" suite.
|
|
4
|
+
*
|
|
5
|
+
* Every finding maps to ONE of three real-world consequences, never a generic
|
|
6
|
+
* lint level:
|
|
7
|
+
*
|
|
8
|
+
* REJECTED — the store will reject the submission (you cannot ship as-is).
|
|
9
|
+
* SLOW — it ships, but review moves from <24h to several days.
|
|
10
|
+
* ATTRITION — it ships and passes review, but installed users are silently
|
|
11
|
+
* dropped on the update until they re-accept a new permission.
|
|
12
|
+
*
|
|
13
|
+
* Each check's `citation` points to the relevant official Chrome Web Store /
|
|
14
|
+
* Chrome for Developers documentation so the user can verify the rule at the
|
|
15
|
+
* source. (We do not cite third-party books in product output.)
|
|
16
|
+
*
|
|
17
|
+
* This module is PURE (no I/O) so the rules are unit-testable against fixtures.
|
|
18
|
+
* Archive extraction lives in review-archive.ts; the network manifest fetch in
|
|
19
|
+
* review-catalog.ts; rendering in review-render.ts.
|
|
20
|
+
*/
|
|
21
|
+
export type Verdict = 'REJECTED' | 'SLOW' | 'ATTRITION';
|
|
22
|
+
export interface ReviewFinding {
|
|
23
|
+
/** The real-world consequence — drives the label shown to the user. */
|
|
24
|
+
verdict: Verdict;
|
|
25
|
+
/** Stable machine id (for --json consumers / suppression later). */
|
|
26
|
+
check: string;
|
|
27
|
+
/** One-line headline. */
|
|
28
|
+
title: string;
|
|
29
|
+
/** Why it matters, in plain language. */
|
|
30
|
+
detail: string;
|
|
31
|
+
/** The offending value or `file:line`, when there is one. */
|
|
32
|
+
evidence?: string;
|
|
33
|
+
/** The concrete fix. */
|
|
34
|
+
recommendation: string;
|
|
35
|
+
/** Official Chrome documentation backing the rule (shown to the user). */
|
|
36
|
+
citation: string;
|
|
37
|
+
}
|
|
38
|
+
/** A parsed manifest.json — only the fields the checks read are typed. */
|
|
39
|
+
export interface Manifest {
|
|
40
|
+
manifest_version?: number;
|
|
41
|
+
name?: string;
|
|
42
|
+
version?: string;
|
|
43
|
+
permissions?: unknown;
|
|
44
|
+
optional_permissions?: unknown;
|
|
45
|
+
host_permissions?: unknown;
|
|
46
|
+
optional_host_permissions?: unknown;
|
|
47
|
+
content_scripts?: Array<{
|
|
48
|
+
matches?: unknown;
|
|
49
|
+
js?: unknown;
|
|
50
|
+
[k: string]: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
background?: {
|
|
53
|
+
service_worker?: string;
|
|
54
|
+
scripts?: unknown;
|
|
55
|
+
page?: string;
|
|
56
|
+
type?: string;
|
|
57
|
+
[k: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
action?: {
|
|
60
|
+
default_popup?: string;
|
|
61
|
+
[k: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
browser_action?: {
|
|
64
|
+
default_popup?: string;
|
|
65
|
+
[k: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
options_ui?: {
|
|
68
|
+
page?: string;
|
|
69
|
+
[k: string]: unknown;
|
|
70
|
+
};
|
|
71
|
+
options_page?: string;
|
|
72
|
+
side_panel?: {
|
|
73
|
+
default_path?: string;
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
};
|
|
76
|
+
devtools_page?: string;
|
|
77
|
+
chrome_url_overrides?: Record<string, string>;
|
|
78
|
+
sandbox?: {
|
|
79
|
+
pages?: unknown;
|
|
80
|
+
[k: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
[k: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
/** A text file pulled out of the artifact: package-relative path → contents. */
|
|
85
|
+
export type FileMap = Map<string, string>;
|
|
86
|
+
export declare const PERMISSION_WARNINGS: Readonly<Record<string, string>>;
|
|
87
|
+
export declare function isGlobalHost(value: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Required API permissions only (host patterns stripped out). In MV2 hosts and
|
|
90
|
+
* API permissions share the `permissions` array, so we split by shape.
|
|
91
|
+
*/
|
|
92
|
+
export declare function requiredApiPermissions(m: Manifest): string[];
|
|
93
|
+
/** Required host patterns: `host_permissions` (MV3) plus any host-shaped entry in `permissions` (MV2). */
|
|
94
|
+
export declare function requiredHostPermissions(m: Manifest): string[];
|
|
95
|
+
/** Normalise a manifest-declared path to the package-relative key used in the file map. */
|
|
96
|
+
export declare function normalizePath(p: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* HTML pages the browser renders inside the extension's own CSP — popup,
|
|
99
|
+
* options, side panel, devtools, newtab/history/bookmarks overrides, sandbox
|
|
100
|
+
* pages, and the MV2 background page. These are exactly where inline scripts and
|
|
101
|
+
* eval get the extension rejected.
|
|
102
|
+
*/
|
|
103
|
+
export declare function htmlEntrypoints(m: Manifest): string[];
|
|
104
|
+
export declare function checkSlowReviewQueue(m: Manifest): ReviewFinding[];
|
|
105
|
+
/**
|
|
106
|
+
* Static advisory — there is nothing in the package to inspect; it's a
|
|
107
|
+
* publishing-process fact developers routinely get burned by. Emitted once.
|
|
108
|
+
*/
|
|
109
|
+
export declare function checkListingChangeReReview(): ReviewFinding[];
|
|
110
|
+
/**
|
|
111
|
+
* Diff the local manifest against the last-published one. A newly-added
|
|
112
|
+
* *required* permission that shows a warning silently disables the extension for
|
|
113
|
+
* the whole installed base on update (only a small toolbar icon appears) →
|
|
114
|
+
* silent attrition. Newly-added permissions of any kind also re-trip the slow
|
|
115
|
+
* review queue (ch.10).
|
|
116
|
+
*
|
|
117
|
+
* `prior` is the manifest fetched from the catalog's last snapshot; pass null
|
|
118
|
+
* when it could not be fetched (the caller surfaces why and this returns []).
|
|
119
|
+
*/
|
|
120
|
+
export declare function checkAutoDisableOnUpdate(local: Manifest, prior: Manifest | null): ReviewFinding[];
|
|
121
|
+
export declare function checkRemoteCode(files: FileMap): ReviewFinding[];
|
|
122
|
+
export declare function checkHtmlCsp(m: Manifest, files: FileMap): ReviewFinding[];
|
|
123
|
+
export declare function checkServiceWorker(m: Manifest, files: FileMap): ReviewFinding[];
|
|
124
|
+
export declare function checkActiveTabAdvisor(m: Manifest): ReviewFinding[];
|
|
125
|
+
export interface ReviewInputs {
|
|
126
|
+
manifest: Manifest;
|
|
127
|
+
files: FileMap;
|
|
128
|
+
/** Last-published manifest from the catalog, or null when unavailable. */
|
|
129
|
+
priorManifest: Manifest | null;
|
|
130
|
+
}
|
|
131
|
+
export declare function runChecks(input: ReviewInputs): ReviewFinding[];
|
|
132
|
+
export interface ReviewSummary {
|
|
133
|
+
findings: ReviewFinding[];
|
|
134
|
+
counts: Record<Verdict, number>;
|
|
135
|
+
/** True when at least one finding will block publishing. */
|
|
136
|
+
blocking: boolean;
|
|
137
|
+
}
|
|
138
|
+
export declare function summarize(findings: ReviewFinding[]): ReviewSummary;
|
|
139
|
+
//# sourceMappingURL=review-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-checks.d.ts","sourceRoot":"","sources":["../src/review-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,CAAA;AAEvD,MAAM,WAAW,aAAa;IAC7B,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAA;IAChB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAA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