prepublic 0.0.0-stage → 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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/SECURITY.md +18 -0
- package/bin/prepublic.js +12 -0
- package/package.json +50 -4
- package/scripts/make-examples.mjs +200 -0
- package/src/checks/history.js +210 -0
- package/src/checks/project.js +351 -0
- package/src/checks/worktree.js +268 -0
- package/src/cli.js +203 -0
- package/src/config.js +59 -0
- package/src/findings.js +53 -0
- package/src/git.js +164 -0
- package/src/gitleaks.js +118 -0
- package/src/index.js +5 -0
- package/src/report/fonts/OFL.txt +192 -0
- package/src/report/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/src/report/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/src/report/fonts/ibm-plex-sans-latin-wght.woff2 +0 -0
- package/src/report/html.js +58 -0
- package/src/report/markdown.js +63 -0
- package/src/report/ui/app.js +590 -0
- package/src/report/ui/styles.css +356 -0
- package/src/report/ui/template.html +87 -0
- package/src/rules/files.js +78 -0
- package/src/rules/personal.js +76 -0
- package/src/rules/secrets.js +241 -0
- package/src/scan.js +221 -0
- package/src/version.js +2 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/* Prepublic report: a clearance record. Paper and carbon themes, ink typography
|
|
2
|
+
(IBM Plex), color reserved for meaning. The one motif is the redaction mark:
|
|
3
|
+
it is the logo, the evidence treatment and the unit of the exposure ledger. */
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--bg: #edefea;
|
|
7
|
+
--sheet: #fafaf8;
|
|
8
|
+
--raised: #ffffff;
|
|
9
|
+
--sunken: #e6e8e3;
|
|
10
|
+
--rule: #d3d6cf;
|
|
11
|
+
--rule-strong: #b9bdb4;
|
|
12
|
+
--field: #858a80;
|
|
13
|
+
--ink: #141513;
|
|
14
|
+
--ink-2: #464943;
|
|
15
|
+
--muted: #62665e;
|
|
16
|
+
--invert: #141513;
|
|
17
|
+
--invert-ink: #fafaf8;
|
|
18
|
+
--focus: #1f57c8;
|
|
19
|
+
--critical: #bf241e;
|
|
20
|
+
--high: #a04806;
|
|
21
|
+
--medium: #8a5d00;
|
|
22
|
+
--medium-fill: #b88600;
|
|
23
|
+
--low: #1f57c8;
|
|
24
|
+
--info: #62665e;
|
|
25
|
+
--pass: #1b7543;
|
|
26
|
+
--shadow: 0 1px 2px rgba(20, 21, 19, .06), 0 10px 30px rgba(20, 21, 19, .08);
|
|
27
|
+
--sans: "Prepublic Sans", "IBM Plex Sans", "Segoe UI", -apple-system, system-ui, sans-serif;
|
|
28
|
+
--mono: "Prepublic Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
29
|
+
--ease: cubic-bezier(.2, .7, .2, 1);
|
|
30
|
+
color-scheme: light;
|
|
31
|
+
}
|
|
32
|
+
:root[data-theme="dark"] {
|
|
33
|
+
--bg: #0e0f11;
|
|
34
|
+
--sheet: #15171a;
|
|
35
|
+
--raised: #1b1d21;
|
|
36
|
+
--sunken: #101114;
|
|
37
|
+
--rule: #272a2f;
|
|
38
|
+
--rule-strong: #3a3e45;
|
|
39
|
+
--field: #6d727a;
|
|
40
|
+
--ink: #eceee9;
|
|
41
|
+
--ink-2: #b6bab1;
|
|
42
|
+
--muted: #8d9189;
|
|
43
|
+
--invert: #eceee9;
|
|
44
|
+
--invert-ink: #121315;
|
|
45
|
+
--focus: #82aaff;
|
|
46
|
+
--critical: #ff6159;
|
|
47
|
+
--high: #f59145;
|
|
48
|
+
--medium: #e0b346;
|
|
49
|
+
--medium-fill: #e0b346;
|
|
50
|
+
--low: #6fa8ff;
|
|
51
|
+
--info: #8d9189;
|
|
52
|
+
--pass: #52c287;
|
|
53
|
+
--shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 14px 36px rgba(0, 0, 0, .35);
|
|
54
|
+
color-scheme: dark;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
* { box-sizing: border-box; }
|
|
58
|
+
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 116px; }
|
|
59
|
+
@media (pointer: fine) { html { overscroll-behavior: none; } }
|
|
60
|
+
body {
|
|
61
|
+
margin: 0; background: var(--bg); color: var(--ink);
|
|
62
|
+
font: 400 14.5px/1.55 var(--sans);
|
|
63
|
+
-webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
|
|
64
|
+
font-variant-numeric: tabular-nums; font-feature-settings: "ss02";
|
|
65
|
+
}
|
|
66
|
+
h1, h2, h3 { margin: 0; font-family: var(--sans); text-wrap: balance; }
|
|
67
|
+
p { margin: 0; }
|
|
68
|
+
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
|
|
69
|
+
a:hover { text-decoration-color: currentColor; }
|
|
70
|
+
button, input { font: inherit; color: inherit; touch-action: manipulation; }
|
|
71
|
+
code, kbd, pre, .mono { font-family: var(--mono); font-size: .9em; }
|
|
72
|
+
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
|
|
73
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
74
|
+
.ic { display: contents; }
|
|
75
|
+
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 12px; background: var(--invert); color: var(--invert-ink); text-decoration: none; }
|
|
76
|
+
.skip:focus { top: 12px; }
|
|
77
|
+
|
|
78
|
+
/* Severity: shape and color both carry the level. */
|
|
79
|
+
.glyph { width: 11px; height: 11px; flex: none; display: inline-block; vertical-align: -1px; }
|
|
80
|
+
.s-critical { color: var(--critical); } .s-high { color: var(--high); } .s-medium { color: var(--medium); } .s-low { color: var(--low); } .s-info { color: var(--info); }
|
|
81
|
+
.s-pass { color: var(--pass); } .s-fail { color: var(--critical); } .s-warn { color: var(--medium); } .s-manual { color: var(--low); } .s-skipped { color: var(--muted); }
|
|
82
|
+
.c-critical { --c: var(--critical); } .c-high { --c: var(--high); } .c-medium { --c: var(--medium); } .c-low { --c: var(--low); } .c-info { --c: var(--info); }
|
|
83
|
+
|
|
84
|
+
/* Top bar */
|
|
85
|
+
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px) saturate(130%); border-bottom: 1px solid var(--rule); padding-top: env(safe-area-inset-top); }
|
|
86
|
+
.bar-in { max-width: 1320px; margin: 0 auto; height: 56px; padding: 0 max(24px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 20px; }
|
|
87
|
+
.brand { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
|
|
88
|
+
.mark { width: 22px; height: 22px; color: var(--ink); }
|
|
89
|
+
.wordmark { font-weight: 600; font-size: 17px; letter-spacing: -.025em; }
|
|
90
|
+
.crumb { min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-left: 20px; border-left: 1px solid var(--rule); overflow: hidden; font-family: var(--mono); font-size: 13px; }
|
|
91
|
+
.crumb b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
92
|
+
.crumb span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
93
|
+
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
|
|
94
|
+
.btn, .icon-btn {
|
|
95
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
|
|
96
|
+
border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--sheet); cursor: pointer;
|
|
97
|
+
font-size: 13.5px; font-weight: 500; transition: border-color .15s, background-color .15s, color .15s;
|
|
98
|
+
}
|
|
99
|
+
.btn:hover, .icon-btn:hover { border-color: var(--ink-2); }
|
|
100
|
+
.btn:active, .icon-btn:active { transform: translateY(1px); }
|
|
101
|
+
.btn svg, .icon-btn svg { width: 16px; height: 16px; flex: none; }
|
|
102
|
+
.icon-btn { width: 34px; padding: 0; }
|
|
103
|
+
.menu-wrap { position: relative; }
|
|
104
|
+
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; padding: 6px; background: var(--raised); border: 1px solid var(--rule-strong); border-radius: 8px; box-shadow: var(--shadow); display: grid; gap: 2px; z-index: 30; transform-origin: top right; animation: pop .14s var(--ease); }
|
|
105
|
+
.menu[hidden] { display: none; }
|
|
106
|
+
.menu button { display: grid; gap: 1px; text-align: left; padding: 8px 10px; border: 0; border-radius: 5px; background: none; cursor: pointer; font-size: 13.5px; font-weight: 500; }
|
|
107
|
+
.menu button small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
|
|
108
|
+
.menu button:hover, .menu button:focus-visible { background: var(--sunken); outline: none; }
|
|
109
|
+
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-2px); } to { opacity: 1; transform: none; } }
|
|
110
|
+
|
|
111
|
+
.page { max-width: 1320px; margin: 0 auto; padding: 32px max(24px, env(safe-area-inset-left)) 56px; }
|
|
112
|
+
|
|
113
|
+
/* The record: one framed sheet that holds the decision. */
|
|
114
|
+
.record { background: var(--sheet); border: 1px solid var(--rule); padding: 0 44px 8px; }
|
|
115
|
+
.fields { display: grid; grid-template-columns: 1.2fr 1.1fr 1.1fr 1.1fr 1fr; margin: 0 -44px; padding: 0 44px; border-bottom: 1px solid var(--rule); box-shadow: inset 0 3px 0 var(--ink); }
|
|
116
|
+
.fields div { padding: 16px 16px 14px; border-left: 1px solid var(--rule); min-width: 0; }
|
|
117
|
+
.fields div:first-child { padding-left: 0; border-left: 0; }
|
|
118
|
+
.fields dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
|
|
119
|
+
.fields dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
120
|
+
|
|
121
|
+
.record-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; align-items: end; padding: 40px 0 36px; }
|
|
122
|
+
.stamp { display: inline-flex; align-items: center; gap: 9px; padding: 5px 11px 5px 9px; border: 1.5px solid currentColor; font: 500 12.5px var(--mono); letter-spacing: .08em; margin-bottom: 22px; }
|
|
123
|
+
.stamp svg { width: 12px; height: 12px; }
|
|
124
|
+
.verdict h1 { font-size: clamp(38px, 5vw, 68px); line-height: .98; font-weight: 600; letter-spacing: -.038em; max-width: 13ch; }
|
|
125
|
+
.verdict .lede { margin-top: 20px; font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 54ch; text-wrap: pretty; }
|
|
126
|
+
.verdict .lede b { color: var(--ink); font-weight: 600; }
|
|
127
|
+
|
|
128
|
+
.gauge { display: grid; gap: 12px; padding: 18px 0 4px; border-top: 1px solid var(--rule); }
|
|
129
|
+
.gauge-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
|
|
130
|
+
.gauge-top b { font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
|
|
131
|
+
.gauge-top b small { font-size: 15px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
|
|
132
|
+
.gauge-top span { color: var(--muted); font-size: 13px; }
|
|
133
|
+
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 10px; }
|
|
134
|
+
.segments i { background: currentColor; border-radius: 1px; }
|
|
135
|
+
.segments i.s-warn, .gauge-legend .s-warn i { background: var(--medium-fill); }
|
|
136
|
+
.segments i.s-skipped { background: none; box-shadow: inset 0 0 0 1px var(--rule-strong); }
|
|
137
|
+
.gauge-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
|
|
138
|
+
.gauge-legend span { display: inline-flex; align-items: center; gap: 6px; }
|
|
139
|
+
.gauge-legend i { width: 8px; height: 8px; background: currentColor; display: inline-block; border-radius: 1px; }
|
|
140
|
+
.gauge-legend .s-skipped i { background: none; box-shadow: inset 0 0 0 1px var(--rule-strong); }
|
|
141
|
+
.gauge-legend em { font-style: normal; color: var(--ink-2); }
|
|
142
|
+
.gauge-score { font-size: 13px; color: var(--muted); }
|
|
143
|
+
|
|
144
|
+
/* Exposure ledger: one redaction mark per finding. */
|
|
145
|
+
.ledger-wrap { border-top: 1px solid var(--rule); padding: 22px 0 28px; }
|
|
146
|
+
.ledger-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 14px; }
|
|
147
|
+
.ledger-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
|
|
148
|
+
.ledger-head p { color: var(--muted); font-size: 13px; }
|
|
149
|
+
.legend { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
|
|
150
|
+
.sevbtn { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: 5px; background: none; cursor: pointer; font-size: 13px; color: var(--ink-2); }
|
|
151
|
+
.sevbtn b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
|
|
152
|
+
.sevbtn:hover { border-color: var(--rule-strong); }
|
|
153
|
+
.sevbtn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--raised); }
|
|
154
|
+
.sevbtn.zero { opacity: .5; }
|
|
155
|
+
.ledger { display: grid; grid-template-columns: 170px minmax(0, 1fr) 40px; border-top: 1px solid var(--rule); }
|
|
156
|
+
.lrow { display: contents; }
|
|
157
|
+
.lrow > * { border-bottom: 1px solid var(--rule); }
|
|
158
|
+
.lcat { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 0; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; }
|
|
159
|
+
.lcat:hover span, .lcat[aria-pressed="true"] span { text-decoration: underline; text-decoration-color: var(--ink); text-underline-offset: 4px; }
|
|
160
|
+
.lcat[aria-pressed="true"] span { text-decoration-thickness: 2px; }
|
|
161
|
+
.marks { display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 5px; padding: 10px 0; min-height: 44px; }
|
|
162
|
+
.mk.c-medium { --c: var(--medium-fill); }
|
|
163
|
+
.mk { width: 34px; height: 16px; border: 0; padding: 0; border-radius: 2px; background: var(--c); cursor: pointer; transition: transform .2s var(--ease), box-shadow .15s, opacity .2s; }
|
|
164
|
+
.mk:hover { transform: translateY(-2px); box-shadow: 0 3px 0 -1px color-mix(in srgb, var(--c) 45%, transparent); }
|
|
165
|
+
.mk.reviewed { opacity: .32; }
|
|
166
|
+
.mk[aria-current="true"] { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink); }
|
|
167
|
+
.ledger.intro .mk { transform: scaleX(0); transform-origin: left center; }
|
|
168
|
+
.clear { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
|
|
169
|
+
.clear svg { width: 15px; height: 15px; color: var(--pass); }
|
|
170
|
+
.lcount { display: flex; align-items: center; justify-content: flex-end; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
|
|
171
|
+
|
|
172
|
+
/* Tabs */
|
|
173
|
+
main { margin-top: 28px; }
|
|
174
|
+
main:focus { outline: none; }
|
|
175
|
+
.tabs-row { border-bottom: 1px solid var(--rule); position: sticky; top: 56px; z-index: 10; background: var(--bg); }
|
|
176
|
+
.tabs { display: flex; gap: 26px; }
|
|
177
|
+
.tab { position: relative; background: none; border: 0; padding: 14px 0 13px; cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--muted); display: inline-flex; gap: 8px; align-items: baseline; }
|
|
178
|
+
.tab span { font: 500 12px var(--mono); color: var(--ink-2); }
|
|
179
|
+
.tab:hover { color: var(--ink); }
|
|
180
|
+
.tab[aria-selected="true"] { color: var(--ink); }
|
|
181
|
+
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ink); }
|
|
182
|
+
.panel { padding-top: 18px; }
|
|
183
|
+
.panel[hidden] { display: none; }
|
|
184
|
+
|
|
185
|
+
/* Findings tools */
|
|
186
|
+
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
|
|
187
|
+
.search { position: relative; flex: 0 1 380px; min-width: 200px; display: flex; align-items: center; }
|
|
188
|
+
.search svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
|
|
189
|
+
.search input { width: 100%; height: 36px; padding: 0 34px; border: 1px solid var(--field); border-radius: 6px; background: var(--sheet); color: var(--ink); }
|
|
190
|
+
.search input::placeholder { color: var(--muted); }
|
|
191
|
+
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
|
|
192
|
+
.search kbd { position: absolute; right: 9px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 0 5px; line-height: 17px; }
|
|
193
|
+
.search input:focus ~ kbd { display: none; }
|
|
194
|
+
.check-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
|
|
195
|
+
.check-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
|
|
196
|
+
.count { margin-left: auto; color: var(--muted); font-size: 13px; }
|
|
197
|
+
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
|
|
198
|
+
.filters:empty { display: none; }
|
|
199
|
+
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 5px; border: 1px solid var(--rule-strong); background: var(--sheet); font-size: 12.5px; cursor: pointer; }
|
|
200
|
+
.chip svg { width: 14px; height: 14px; color: var(--muted); }
|
|
201
|
+
.chip:hover svg { color: var(--ink); }
|
|
202
|
+
.chip.clearall { padding: 0 10px; border-style: dashed; color: var(--ink-2); }
|
|
203
|
+
|
|
204
|
+
/* Master-detail */
|
|
205
|
+
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; margin-top: 18px; align-items: start; }
|
|
206
|
+
.split.solo { grid-template-columns: minmax(0, 1fr); }
|
|
207
|
+
.list { min-width: 0; }
|
|
208
|
+
.group { margin-bottom: 24px; }
|
|
209
|
+
.group > h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 12px 7px; display: flex; gap: 8px; }
|
|
210
|
+
.group > h3 span { font: 500 12px var(--mono); color: var(--muted); padding-top: 1px; }
|
|
211
|
+
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
|
|
212
|
+
.rows > li { border-bottom: 1px solid var(--rule); }
|
|
213
|
+
.row { width: 100%; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 11px 12px; background: none; border: 0; text-align: left; cursor: pointer; position: relative; transition: background-color .12s; }
|
|
214
|
+
.row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
|
|
215
|
+
.row[aria-current="true"] { background: var(--sheet); }
|
|
216
|
+
.row[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--ink)); }
|
|
217
|
+
.row .glyph { margin-top: 5px; }
|
|
218
|
+
.row-main { min-width: 0; }
|
|
219
|
+
.row-title { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
220
|
+
.row-where { display: block; color: var(--muted); font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
|
|
221
|
+
.row-side { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
|
|
222
|
+
.flag { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
|
223
|
+
.flag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); }
|
|
224
|
+
.flag.hot::before { background: var(--critical); }
|
|
225
|
+
.flag.ok::before { background: var(--pass); }
|
|
226
|
+
.row .done { width: 16px; height: 16px; color: var(--pass); }
|
|
227
|
+
.row.is-reviewed .row-title { color: var(--muted); }
|
|
228
|
+
.row.is-reviewed .glyph { opacity: .45; }
|
|
229
|
+
|
|
230
|
+
.detail { position: sticky; top: 120px; max-height: calc(100vh - 136px); overflow: auto; overscroll-behavior: contain; background: var(--sheet); border: 1px solid var(--rule); box-shadow: inset 0 3px 0 var(--c, var(--ink)); }
|
|
231
|
+
.detail:empty { display: none; }
|
|
232
|
+
.inline-detail { padding: 0 0 14px; }
|
|
233
|
+
.inline-detail .d { border: 1px solid var(--rule); background: var(--sheet); box-shadow: inset 0 3px 0 var(--c, var(--ink)); }
|
|
234
|
+
|
|
235
|
+
.d { padding: 26px 28px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
|
|
236
|
+
.d > * { min-width: 0; }
|
|
237
|
+
.d-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
|
|
238
|
+
.sev { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--c); }
|
|
239
|
+
.d h2 { font-size: 25px; line-height: 1.15; font-weight: 600; letter-spacing: -.022em; }
|
|
240
|
+
.d-summary { margin-top: 10px; color: var(--ink-2); max-width: 68ch; text-wrap: pretty; }
|
|
241
|
+
.d h3 { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
|
|
242
|
+
.d section p, .d ol { color: var(--ink-2); max-width: 68ch; }
|
|
243
|
+
.d ol { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 8px; }
|
|
244
|
+
.d ol li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); }
|
|
245
|
+
.d ol li::before { content: counter(step); font: 500 12px/1.9 var(--mono); color: var(--muted); }
|
|
246
|
+
.d :not(pre) > code { font-family: var(--mono); background: var(--sunken); padding: 1px 5px; color: var(--ink); overflow-wrap: anywhere; border-radius: 3px; }
|
|
247
|
+
.evidence { margin: 0; padding: 14px 16px; background: var(--sunken); border-left: 3px solid var(--ink); font-size: 13px; line-height: 1.95; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
248
|
+
.redact { display: inline-block; vertical-align: -3px; height: 1.15em; width: 10ch; background: var(--ink); }
|
|
249
|
+
.cmd { position: relative; margin: 0; padding: 12px 78px 12px 14px; background: var(--sunken); font-size: 13px; color: var(--ink); white-space: pre; overflow-x: auto; }
|
|
250
|
+
.cmd .btn { position: absolute; top: 7px; right: 7px; height: 28px; padding: 0 10px; font-size: 12.5px; }
|
|
251
|
+
.locs { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
252
|
+
.locs th { text-align: left; font-weight: 500; color: var(--muted); padding: 0 12px 6px 0; font-size: 12px; }
|
|
253
|
+
.locs td { padding: 6px 12px 6px 0; border-top: 1px solid var(--rule); font-family: var(--mono); color: var(--ink-2); vertical-align: top; overflow-wrap: anywhere; }
|
|
254
|
+
.locs td.n { width: 1%; white-space: nowrap; }
|
|
255
|
+
.locs-more { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
|
|
256
|
+
.refs { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; }
|
|
257
|
+
.refs svg { width: 12px; height: 12px; vertical-align: -1px; margin-left: 3px; color: var(--muted); }
|
|
258
|
+
.d-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--rule); }
|
|
259
|
+
.rule { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
|
|
260
|
+
.review-btn[aria-pressed="true"] { background: var(--invert); color: var(--invert-ink); border-color: var(--invert); }
|
|
261
|
+
.d-enter { animation: d-in .2s var(--ease); }
|
|
262
|
+
@keyframes d-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
263
|
+
|
|
264
|
+
.empty { padding: 36px 32px; background: var(--sheet); border: 1px solid var(--rule); box-shadow: inset 0 3px 0 var(--pass); max-width: 760px; }
|
|
265
|
+
.empty.filtered { box-shadow: inset 0 3px 0 var(--ink); }
|
|
266
|
+
.empty h3 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 8px; }
|
|
267
|
+
.empty p { color: var(--ink-2); max-width: 60ch; }
|
|
268
|
+
.empty .btn { margin-top: 18px; }
|
|
269
|
+
|
|
270
|
+
/* Checklist and coverage */
|
|
271
|
+
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
|
|
272
|
+
.panel h2.sub { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
|
|
273
|
+
.panel p.sub { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; max-width: 60ch; }
|
|
274
|
+
.checks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
|
|
275
|
+
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--rule); align-items: start; }
|
|
276
|
+
.checks .st { width: 18px; height: 18px; margin-top: 2px; }
|
|
277
|
+
.checks .lbl { font-weight: 500; }
|
|
278
|
+
.checks .det { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
|
|
279
|
+
.checks .stw { font: 500 12px var(--mono); white-space: nowrap; margin-top: 3px; }
|
|
280
|
+
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; cursor: pointer; font-size: 13px; margin-top: 6px; }
|
|
281
|
+
.linkbtn:hover { text-decoration-color: currentColor; }
|
|
282
|
+
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0; border-top: 1px solid var(--rule); }
|
|
283
|
+
.facts dt, .facts dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); }
|
|
284
|
+
.facts dt { color: var(--muted); padding-right: 28px; font-size: 13.5px; }
|
|
285
|
+
.limits { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--ink-2); max-width: 68ch; }
|
|
286
|
+
|
|
287
|
+
.foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
|
|
288
|
+
.foot .mark { width: 16px; height: 16px; color: var(--muted); }
|
|
289
|
+
|
|
290
|
+
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; background: var(--invert); color: var(--invert-ink); padding: 9px 14px; font-size: 13.5px; font-weight: 500; pointer-events: none; transition: opacity .18s, transform .18s var(--ease); }
|
|
291
|
+
.toast.show { opacity: 1; transform: translate(-50%, 0); }
|
|
292
|
+
|
|
293
|
+
/* Responsive */
|
|
294
|
+
@media (max-width: 1100px) {
|
|
295
|
+
.split { grid-template-columns: minmax(0, 1fr); }
|
|
296
|
+
.detail { display: none; }
|
|
297
|
+
.record-main { grid-template-columns: minmax(0, 1fr); gap: 30px; align-items: start; }
|
|
298
|
+
.gauge { max-width: 560px; }
|
|
299
|
+
.fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
300
|
+
.fields div:nth-child(4) { padding-left: 0; border-left: 0; }
|
|
301
|
+
.fields div:nth-child(n+4) { border-top: 1px solid var(--rule); }
|
|
302
|
+
}
|
|
303
|
+
@media (max-width: 760px) {
|
|
304
|
+
.cols2 { grid-template-columns: minmax(0, 1fr); gap: 32px; }
|
|
305
|
+
.legend { margin-left: 0; }
|
|
306
|
+
}
|
|
307
|
+
@media (max-width: 640px) {
|
|
308
|
+
body { font-size: 14px; }
|
|
309
|
+
.bar-in { gap: 12px; height: 52px; padding: 0 16px; }
|
|
310
|
+
.wordmark { display: none; }
|
|
311
|
+
.crumb { padding-left: 12px; }
|
|
312
|
+
.crumb span { display: none; }
|
|
313
|
+
.tabs-row { top: 52px; }
|
|
314
|
+
.page { padding: 16px 12px 40px; }
|
|
315
|
+
.record { padding: 0 18px 4px; }
|
|
316
|
+
.fields { margin: 0 -18px; padding: 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
317
|
+
.fields div { padding: 12px 10px 10px; }
|
|
318
|
+
.fields div:nth-child(odd) { padding-left: 0; border-left: 0; }
|
|
319
|
+
.fields div:nth-child(4) { padding-left: 10px; border-left: 1px solid var(--rule); }
|
|
320
|
+
.fields div:nth-child(n+3) { border-top: 1px solid var(--rule); }
|
|
321
|
+
.fields div:last-child { grid-column: 1 / -1; }
|
|
322
|
+
.fields dd { white-space: normal; }
|
|
323
|
+
.record-main { padding: 28px 0 26px; }
|
|
324
|
+
.verdict .lede { font-size: 16px; }
|
|
325
|
+
.ledger { grid-template-columns: minmax(0, 1fr) 32px; }
|
|
326
|
+
.lcat { grid-column: 1 / -1; min-height: 0; padding: 12px 0 0; border-bottom: 0 !important; }
|
|
327
|
+
.lrow > .marks { padding-top: 6px; }
|
|
328
|
+
.mk { width: 26px; height: 14px; }
|
|
329
|
+
.tabs { gap: 22px; overflow-x: auto; scrollbar-width: none; }
|
|
330
|
+
.tab { white-space: nowrap; }
|
|
331
|
+
.search { flex-basis: 100%; }
|
|
332
|
+
.count { margin-left: 0; }
|
|
333
|
+
.row { padding: 11px 6px; }
|
|
334
|
+
.d { padding: 20px 16px 16px; gap: 18px; }
|
|
335
|
+
.d h2 { font-size: 20px; }
|
|
336
|
+
.facts { grid-template-columns: minmax(0, 1fr); }
|
|
337
|
+
.facts dt { padding-bottom: 0; border-bottom: 0; }
|
|
338
|
+
.facts dd { padding-top: 2px; }
|
|
339
|
+
.empty { padding: 26px 20px; }
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@media (prefers-reduced-motion: reduce) {
|
|
343
|
+
*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
|
|
344
|
+
.ledger.intro .mk { transform: none; }
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Print / PDF: everything expanded, no controls. */
|
|
348
|
+
@media print {
|
|
349
|
+
.bar { position: static; backdrop-filter: none; }
|
|
350
|
+
.bar-actions, .tools, .filters, .tabs-row, .ledger-head p, .skip, .linkbtn, .cmd .btn, .review-btn, .detail { display: none !important; }
|
|
351
|
+
.panel[hidden] { display: block !important; }
|
|
352
|
+
.split { grid-template-columns: minmax(0, 1fr); }
|
|
353
|
+
.d { break-inside: avoid; }
|
|
354
|
+
.page { padding-top: 0; }
|
|
355
|
+
body { font-size: 12px; }
|
|
356
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-theme="light">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="__CSP__">
|
|
7
|
+
<meta name="referrer" content="no-referrer">
|
|
8
|
+
<meta name="color-scheme" content="light dark">
|
|
9
|
+
<meta name="theme-color" content="#edefea">
|
|
10
|
+
<meta name="generator" content="Prepublic">
|
|
11
|
+
<title>Prepublic report</title>
|
|
12
|
+
<style>__STYLES__</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<a class="skip" href="#main">Skip to findings</a>
|
|
16
|
+
<header class="bar">
|
|
17
|
+
<div class="bar-in">
|
|
18
|
+
<span class="brand" aria-label="Prepublic">
|
|
19
|
+
<svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><rect x="4" y="3" width="3.2" height="18" rx=".7" fill="currentColor"/><path d="M8.7 3h6.1a5 5 0 0 1 0 10H8.7z" fill="currentColor"/></svg>
|
|
20
|
+
<span class="wordmark" aria-hidden="true">prepublic</span>
|
|
21
|
+
</span>
|
|
22
|
+
<span class="crumb" id="crumb"></span>
|
|
23
|
+
<span class="bar-actions">
|
|
24
|
+
<button class="icon-btn" type="button" id="theme" aria-label="Switch to dark theme"></button>
|
|
25
|
+
<span class="menu-wrap">
|
|
26
|
+
<button class="btn" type="button" id="export" aria-haspopup="menu" aria-expanded="false" aria-controls="export-menu">Export<svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4 6 4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
|
|
27
|
+
<span class="menu" id="export-menu" role="menu" hidden>
|
|
28
|
+
<button type="button" role="menuitem" data-export="md">Markdown report<small>Sanitized, ready to share</small></button>
|
|
29
|
+
<button type="button" role="menuitem" data-export="json">JSON data<small>For scripts and CI</small></button>
|
|
30
|
+
<button type="button" role="menuitem" data-export="print">Print or save as PDF<small>Every finding expanded</small></button>
|
|
31
|
+
</span>
|
|
32
|
+
</span>
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
</header>
|
|
36
|
+
|
|
37
|
+
<div class="page">
|
|
38
|
+
<section class="record" aria-labelledby="verdict-title">
|
|
39
|
+
<dl class="fields" id="fields"></dl>
|
|
40
|
+
<div class="record-main">
|
|
41
|
+
<div class="verdict" id="verdict"></div>
|
|
42
|
+
<div class="gauge" id="gauge"></div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="ledger-wrap">
|
|
45
|
+
<div class="ledger-head">
|
|
46
|
+
<h2 id="ledger-title">Exposure ledger</h2>
|
|
47
|
+
<p id="ledger-hint">One mark per finding. Select a mark to open it, a category to filter.</p>
|
|
48
|
+
<div class="legend" id="legend" role="group" aria-label="Filter by severity"></div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="ledger" id="ledger" role="list" aria-labelledby="ledger-title"></div>
|
|
51
|
+
</div>
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<main id="main" tabindex="-1">
|
|
55
|
+
<div class="tabs-row">
|
|
56
|
+
<div class="tabs" role="tablist" aria-label="Report sections" id="tabs"></div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<section class="panel" id="panel-findings" role="tabpanel" aria-labelledby="tab-findings">
|
|
60
|
+
<div class="tools">
|
|
61
|
+
<label class="search">
|
|
62
|
+
<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.6" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="m10.5 10.5 3 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
|
|
63
|
+
<span class="sr-only">Filter findings</span>
|
|
64
|
+
<input type="search" id="q" name="q" placeholder="Filter by path, rule or text" autocomplete="off" spellcheck="false">
|
|
65
|
+
<kbd aria-hidden="true">/</kbd>
|
|
66
|
+
</label>
|
|
67
|
+
<label class="check-toggle"><input type="checkbox" id="hide-reviewed" name="hide-reviewed"> Hide reviewed</label>
|
|
68
|
+
<span class="count" id="result-count" aria-live="polite"></span>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="filters" id="filters"></div>
|
|
71
|
+
<div class="split">
|
|
72
|
+
<div class="list" id="list"></div>
|
|
73
|
+
<aside class="detail" id="detail" aria-label="Finding details"></aside>
|
|
74
|
+
</div>
|
|
75
|
+
</section>
|
|
76
|
+
|
|
77
|
+
<section class="panel" id="panel-checklist" role="tabpanel" aria-labelledby="tab-checklist" hidden></section>
|
|
78
|
+
<section class="panel" id="panel-coverage" role="tabpanel" aria-labelledby="tab-coverage" hidden></section>
|
|
79
|
+
</main>
|
|
80
|
+
|
|
81
|
+
<footer class="foot" id="foot"></footer>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|
|
84
|
+
<script type="application/json" id="rr-data">__DATA__</script>
|
|
85
|
+
<script>__SCRIPT__</script>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Path-based classification of files that should rarely be published.
|
|
2
|
+
|
|
3
|
+
const base = (p) => p.slice(p.lastIndexOf('/') + 1);
|
|
4
|
+
|
|
5
|
+
/** Files that usually contain credentials or private data. */
|
|
6
|
+
export const SENSITIVE_FILE_RULES = [
|
|
7
|
+
{ id: 'env-file', title: 'Environment file', severity: 'high',
|
|
8
|
+
test: (p) => /^\.env(\.[\w-]+)?$/i.test(base(p)) && !/\.(example|sample|template|dist|defaults?)$/i.test(base(p)) && !/^\.env\.(test|ci)$/i.test(base(p)),
|
|
9
|
+
why: 'Environment files usually hold API keys, database passwords and service tokens.' },
|
|
10
|
+
{ id: 'private-key-file', title: 'Private key or certificate store', severity: 'critical',
|
|
11
|
+
test: (p) => /^(id_(rsa|dsa|ecdsa|ed25519)|.*\.(pem|key|p12|pfx|jks|keystore|ppk|p8))$/i.test(base(p)) && !/\.pub$/i.test(p),
|
|
12
|
+
why: 'Private keys grant access to servers, signing identities or encrypted data.' },
|
|
13
|
+
{ id: 'cloud-credentials', title: 'Cloud or tool credential file', severity: 'critical',
|
|
14
|
+
test: (p) => /(^|\/)\.aws\/credentials$/i.test(p) || /(^|\/)\.docker\/config\.json$/i.test(p) || /(^|\/)\.kube\/config$/i.test(p)
|
|
15
|
+
|| /^(credentials|client_secrets?|service[-_]?account.*|gcp[-_].*key.*|firebase[-_]adminsdk.*)\.json$/i.test(base(p))
|
|
16
|
+
|| /^(\.git-credentials|\.netrc|_netrc|\.pgpass|\.htpasswd|\.pypirc|kubeconfig)$/i.test(base(p)),
|
|
17
|
+
why: 'These files store reusable credentials for cloud accounts, registries or services.' },
|
|
18
|
+
{ id: 'package-auth-config', title: 'Package manager config (may contain auth token)', severity: 'medium',
|
|
19
|
+
test: (p) => /^(\.npmrc|\.yarnrc\.yml|pip\.conf|\.gem\/credentials|settings-security\.xml|nuget\.config)$/i.test(base(p)),
|
|
20
|
+
why: 'Registry configuration files often carry authentication tokens.', contentCheck: /(_authToken|_auth|npmAuthToken|password|:_password|apikey)\s*[=:]/i },
|
|
21
|
+
{ id: 'infra-state', title: 'Infrastructure state or variables', severity: 'high',
|
|
22
|
+
test: (p) => /\.(tfstate|tfstate\.backup)$/i.test(p) || /\.tfvars(\.json)?$/i.test(p) && !/example/i.test(p),
|
|
23
|
+
why: 'Terraform state and variable files frequently contain plaintext secrets and internal topology.' },
|
|
24
|
+
{ id: 'password-database', title: 'Password manager or keychain database', severity: 'critical',
|
|
25
|
+
test: (p) => /\.(kdbx?|keychain|keychain-db|1pif|agilekeychain)$/i.test(p),
|
|
26
|
+
why: 'Credential vaults must never be published, even when encrypted.' },
|
|
27
|
+
{ id: 'vpn-or-ssh-config', title: 'VPN profile or SSH configuration', severity: 'high',
|
|
28
|
+
test: (p) => /\.(ovpn|rdp)$/i.test(p) || /(^|\/)\.ssh\//.test(p),
|
|
29
|
+
why: 'Connection profiles expose hostnames, users and sometimes embedded keys.' },
|
|
30
|
+
{ id: 'http-archive', title: 'HTTP archive (HAR) capture', severity: 'high',
|
|
31
|
+
test: (p) => /\.har$/i.test(p),
|
|
32
|
+
why: 'HAR captures include cookies, authorization headers and session tokens.' },
|
|
33
|
+
{ id: 'database-dump', title: 'Database file or dump', severity: 'medium',
|
|
34
|
+
test: (p) => /\.(sqlite3?|db|mdb|accdb|dump|bak\.sql)$/i.test(p) || (/\.sql$/i.test(p) && /(dump|backup|prod|export)/i.test(p)),
|
|
35
|
+
why: 'Databases and dumps can contain personal data, customer records or password hashes.' },
|
|
36
|
+
{ id: 'app-secrets-config', title: 'Application secrets file', severity: 'high',
|
|
37
|
+
test: (p) => /^(secrets?\.(ya?ml|json|toml|ini)|wp-config\.php|local\.settings\.json|appsettings\.(production|prod)\.json|master\.key|credentials\.yml\.enc)$/i.test(base(p)),
|
|
38
|
+
why: 'Framework secrets files hold signing keys and production credentials.' },
|
|
39
|
+
{ id: 'shell-history', title: 'Shell or tool history file', severity: 'high',
|
|
40
|
+
test: (p) => /^\.(bash|zsh|sh|psql|mysql|python|node_repl)_history$/i.test(base(p)) || /^\.lesshst$/i.test(base(p)),
|
|
41
|
+
why: 'History files often contain typed passwords, tokens and internal hostnames.' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/** Clutter that is harmless but looks unprofessional or leaks environment details. */
|
|
45
|
+
export const JUNK_FILE_RULES = [
|
|
46
|
+
{ id: 'os-metadata', title: 'Operating system metadata files', severity: 'low',
|
|
47
|
+
test: (p) => /^(\.DS_Store|Thumbs\.db|desktop\.ini|ehthumbs\.db|\._.+)$/i.test(base(p)),
|
|
48
|
+
why: 'OS metadata files can reveal local folder names and are noise for users.' },
|
|
49
|
+
{ id: 'dependency-dir', title: 'Committed dependency or virtualenv directory', severity: 'medium',
|
|
50
|
+
test: (p) => /(^|\/)(node_modules|bower_components|\.venv|venv|env\/lib|vendor\/bundle|\.pnpm-store)\//.test(p),
|
|
51
|
+
why: 'Vendored dependencies bloat the repository and may embed third-party licences or binaries.' },
|
|
52
|
+
{ id: 'build-artifacts', title: 'Build or cache artefacts', severity: 'low',
|
|
53
|
+
test: (p) => /(^|\/)(__pycache__|\.pytest_cache|\.mypy_cache|\.ruff_cache|\.next|\.nuxt|\.turbo|\.parcel-cache|\.gradle|coverage|\.nyc_output|target\/debug|target\/release)\//.test(p) || /\.(pyc|pyo|class|o|obj)$/i.test(p),
|
|
54
|
+
why: 'Generated files belong in .gitignore; they often contain absolute local paths.' },
|
|
55
|
+
{ id: 'log-files', title: 'Log files', severity: 'medium',
|
|
56
|
+
test: (p) => /\.log$/i.test(p) || /(^|\/)(npm-debug|yarn-error|pnpm-debug)\.log/i.test(p),
|
|
57
|
+
why: 'Logs routinely capture tokens, user data, stack traces and local paths.' },
|
|
58
|
+
{ id: 'editor-backup', title: 'Editor backup or swap files', severity: 'low',
|
|
59
|
+
test: (p) => /\.(swp|swo|bak|orig|rej|tmp)$/i.test(p) || /~$/.test(p),
|
|
60
|
+
why: 'Backup and swap files can contain older revisions with removed content.' },
|
|
61
|
+
{ id: 'ide-workspace', title: 'Personal IDE workspace files', severity: 'low',
|
|
62
|
+
test: (p) => /(^|\/)\.idea\/(workspace|usage\.statistics|tasks|shelf)/.test(p) || /\.(suo|user|code-workspace)$/i.test(p) || /(^|\/)\.vs\//.test(p),
|
|
63
|
+
why: 'Workspace files store personal paths, recent files and machine-specific settings.' },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export const LARGE_FILE_WARN = 10 * 1024 * 1024; // 10 MB
|
|
67
|
+
export const LARGE_FILE_HIGH = 50 * 1024 * 1024; // GitHub warns at 50 MB
|
|
68
|
+
export const LARGE_FILE_BLOCK = 100 * 1024 * 1024; // GitHub rejects files over 100 MB
|
|
69
|
+
|
|
70
|
+
export function classifySensitive(path) {
|
|
71
|
+
return SENSITIVE_FILE_RULES.find((r) => r.test(path)) || null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function classifyJunk(path) {
|
|
75
|
+
return JUNK_FILE_RULES.find((r) => r.test(path)) || null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const KNOWN_TEXT_EXTENSIONS = /\.(md|txt|json|ya?ml|toml|ini|cfg|conf|env|js|mjs|cjs|ts|tsx|jsx|py|rb|go|rs|java|kt|cs|php|sh|ps1|bat|html?|css|scss|xml|sql|properties|gradle|tf|dockerfile)$/i;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Personal and organisational data that tends to leak into source trees.
|
|
2
|
+
|
|
3
|
+
const GENERIC_USERS = new Set([
|
|
4
|
+
'user', 'username', 'users', 'you', 'yourname', 'your-name', 'your_name', 'me', 'name', 'default', 'public', 'all users',
|
|
5
|
+
'runner', 'runneradmin', 'vsts', 'vssadministrator', 'ubuntu', 'ec2-user', 'node', 'app', 'admin', 'administrator',
|
|
6
|
+
'docker', 'circleci', 'travis', 'jenkins', 'build', 'builder', 'vagrant', 'pi', 'example', 'john', 'jane', 'foo', 'bar',
|
|
7
|
+
'shared', 'guest', 'linuxbrew', 'runner-admin', 'codespace', 'gitpod', 'developer', 'dev', 'test', 'tester', 'someone',
|
|
8
|
+
'<user>', '$user', '%username%', '{user}', '~', 'xxx', 'tim', 'joe',
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const PATH_PATTERNS = [
|
|
12
|
+
// Windows: C:\Users\name\ or C:/Users/name/ (also escaped backslashes in JSON/strings)
|
|
13
|
+
/\b[A-Za-z]:(?:\\\\|\\|\/)(?:Users|Documents and Settings)(?:\\\\|\\|\/)([^\\/\s"'<>|:*?`$%{}]{2,64})(?=\\|\/)/g,
|
|
14
|
+
// macOS
|
|
15
|
+
/(?<![\w.])\/Users\/([A-Za-z0-9._-]{2,64})(?=\/)/g,
|
|
16
|
+
// Linux
|
|
17
|
+
/(?<![\w.])\/home\/([A-Za-z0-9._-]{2,64})(?=\/)/g,
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/** Mask a user name: keep the first character only. */
|
|
21
|
+
export const maskName = (name) => `${name.slice(0, 1)}•••`;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Detect absolute paths into a personal home directory.
|
|
25
|
+
* @returns {{index:number, length:number, user:string, masked:string}[]}
|
|
26
|
+
*/
|
|
27
|
+
export function findPersonalPaths(line) {
|
|
28
|
+
if (line.length > 20000) return [];
|
|
29
|
+
if (!/users|home|documents and settings/i.test(line)) return [];
|
|
30
|
+
const hits = [];
|
|
31
|
+
for (const re of PATH_PATTERNS) {
|
|
32
|
+
re.lastIndex = 0;
|
|
33
|
+
let m;
|
|
34
|
+
while ((m = re.exec(line)) !== null) {
|
|
35
|
+
const user = m[1];
|
|
36
|
+
if (GENERIC_USERS.has(user.toLowerCase())) continue;
|
|
37
|
+
if (/^[<{$%[]/.test(user) || /^x+$/i.test(user)) continue;
|
|
38
|
+
hits.push({ index: m.index, length: m[0].length, user, masked: m[0].replace(user, maskName(user)) });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return hits;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function maskPersonalPaths(text) {
|
|
45
|
+
let out = text;
|
|
46
|
+
for (const h of findPersonalPaths(text).sort((a, b) => b.index - a.index)) {
|
|
47
|
+
out = out.slice(0, h.index) + h.masked + out.slice(h.index + h.length);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const INTERNAL_MARKERS = /\b(company confidential|strictly confidential|internal use only|internal only|do not distribute|not for distribution|not for public release|proprietary and confidential|confidential and proprietary)\b/i;
|
|
53
|
+
|
|
54
|
+
const PRIVATE_IP = /(?<![\d.])(10\.(?:\d{1,3}\.){2}\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3})(?![\d.])/;
|
|
55
|
+
const INTERNAL_HOST = /\b[a-z0-9][a-z0-9-]*(?:\.[a-z0-9-]+)*\.(?:internal|corp|intranet|lan|localdomain)\b/i;
|
|
56
|
+
|
|
57
|
+
export function findInternalNetworkRef(line) {
|
|
58
|
+
if (line.length > 20000) return null;
|
|
59
|
+
const ip = line.match(PRIVATE_IP);
|
|
60
|
+
if (ip) return { kind: 'private IP address', value: ip[1] };
|
|
61
|
+
const host = line.match(INTERNAL_HOST);
|
|
62
|
+
if (host && !/docker\.internal|cluster\.local|svc\.cluster/i.test(host[0])) return { kind: 'internal hostname', value: host[0] };
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const NOREPLY = /(noreply|no-reply)[.@]|users\.noreply\.github\.com$|@users\.noreply\.gitlab\.com$|@noreply\.codeberg\.org$|^(actions|github-actions|dependabot|renovate)\b/i;
|
|
67
|
+
|
|
68
|
+
export function isNoreplyEmail(email) {
|
|
69
|
+
return NOREPLY.test(email) || /\[bot\]@/.test(email);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function maskEmail(email) {
|
|
73
|
+
const at = email.lastIndexOf('@');
|
|
74
|
+
if (at < 1) return '•••';
|
|
75
|
+
return `${email.slice(0, 1)}•••@${email.slice(at + 1)}`;
|
|
76
|
+
}
|