vigie-cli 0.0.0-stage → 1.0.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/src/i18n/en.js ADDED
@@ -0,0 +1,351 @@
1
+ const list = (items) => items.join(', ');
2
+ const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
3
+
4
+ const TLS_REASONS = {
5
+ CERT_HAS_EXPIRED: 'the certificate has expired',
6
+ DEPTH_ZERO_SELF_SIGNED_CERT: 'the certificate is self-signed',
7
+ SELF_SIGNED_CERT_IN_CHAIN: 'the chain ends with a self-signed certificate',
8
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: 'the certificate chain is incomplete',
9
+ UNABLE_TO_GET_ISSUER_CERT_LOCALLY: 'the issuer is unknown or the chain is incomplete',
10
+ ERR_TLS_CERT_ALTNAME_INVALID: 'the certificate was issued for another domain',
11
+ CERT_NOT_YET_VALID: 'the certificate is not valid yet',
12
+ };
13
+
14
+ const CSP_REASONS = {
15
+ 'unsafe-inline': "inline scripts ('unsafe-inline')",
16
+ 'unsafe-eval': "eval() ('unsafe-eval')",
17
+ wildcard: 'scripts from any host (*, https: or data:)',
18
+ 'no-script-src': 'scripts from anywhere (no script-src or default-src)',
19
+ };
20
+
21
+ export default {
22
+ code: 'en',
23
+ severities: { critical: 'critical', high: 'high', medium: 'medium', low: 'low', info: 'info' },
24
+ severityTitles: { critical: 'Critical', high: 'High', medium: 'Medium', low: 'Low', info: 'Informational' },
25
+ categories: {
26
+ transport: 'HTTPS & certificate',
27
+ headers: 'Security headers',
28
+ cookies: 'Cookies',
29
+ exposure: 'Exposed files',
30
+ content: 'Page content',
31
+ disclosure: 'Information disclosure',
32
+ },
33
+ rules: {
34
+ 'no-https': {
35
+ title: 'HTTPS is not available',
36
+ description: 'The site cannot be reached over HTTPS. Everything visitors send or receive, passwords included, travels in clear text and can be read or modified on public Wi-Fi.',
37
+ fix: 'Get a free certificate from Let\'s Encrypt (certbot) or enable HTTPS in your host\'s panel, then redirect all HTTP traffic to HTTPS.',
38
+ },
39
+ 'tls-invalid-cert': {
40
+ title: 'Certificate rejected by browsers',
41
+ description: 'Browsers show a full-page security warning before your site. Most visitors leave, and those who click through become easy targets for interception.',
42
+ fix: 'Install a valid certificate for this exact domain with its full chain (fullchain.pem with Let\'s Encrypt) and set up automatic renewal.',
43
+ },
44
+ 'tls-old-protocol': {
45
+ title: 'Obsolete TLS version accepted',
46
+ description: 'TLS 1.0 and 1.1 have known weaknesses and were retired by every major browser in 2020. Accepting them only helps attackers force a weaker connection.',
47
+ fix: 'Allow TLS 1.2 and TLS 1.3 only.',
48
+ },
49
+ 'tls-expiring': {
50
+ title: 'Certificate expires soon',
51
+ description: 'When it expires, every visitor gets a security warning and the site becomes unusable.',
52
+ fix: 'Renew the certificate now and check that automatic renewal works (certbot renew --dry-run).',
53
+ },
54
+ 'http-no-redirect': {
55
+ title: 'HTTP does not redirect to HTTPS',
56
+ description: 'Visitors who type the address without https:// stay on an unencrypted connection, even though HTTPS exists.',
57
+ fix: 'Redirect every http:// request to https:// with a permanent 301 redirect.',
58
+ },
59
+ 'insecure-redirect': {
60
+ title: 'Redirect back to HTTP',
61
+ description: 'A redirect sends visitors from an HTTPS page to an HTTP one, which cancels the protection of HTTPS.',
62
+ fix: 'Make every redirect point to an https:// address.',
63
+ },
64
+ 'hsts-missing': {
65
+ title: 'HSTS is not enabled',
66
+ description: 'Without Strict-Transport-Security, the browser may still try HTTP first, which leaves a window for an attacker on the same network to downgrade the connection.',
67
+ fix: 'Send Strict-Transport-Security with a max-age of at least one year.',
68
+ },
69
+ 'hsts-weak': {
70
+ title: 'HSTS duration too short',
71
+ description: 'The browser forgets the HTTPS-only rule too quickly, which reopens the downgrade window.',
72
+ fix: 'Use max-age=63072000 (two years) and add includeSubDomains once every subdomain supports HTTPS.',
73
+ },
74
+ 'csp-missing': {
75
+ title: 'No Content Security Policy',
76
+ description: 'A Content-Security-Policy tells the browser which scripts may run. Without it, a single XSS flaw lets an attacker run any script in your visitors\' browsers.',
77
+ fix: "Start with default-src 'self' and object-src 'none', then allow only the domains you really use. Test it first with Content-Security-Policy-Report-Only.",
78
+ },
79
+ 'csp-unsafe': {
80
+ title: 'Content Security Policy too permissive',
81
+ description: 'The policy exists but lets injected scripts run anyway, which removes most of its protection against XSS.',
82
+ fix: "Remove 'unsafe-inline' and 'unsafe-eval', replace wildcards with exact domains, and use nonces or hashes for the inline scripts you need.",
83
+ },
84
+ clickjacking: {
85
+ title: 'Page can be framed by any site',
86
+ description: 'Another site can load your page in an invisible frame and trick visitors into clicking buttons (clickjacking).',
87
+ fix: "Send X-Frame-Options: SAMEORIGIN, or frame-ancestors 'self' in your Content-Security-Policy.",
88
+ },
89
+ 'cors-reflected-origin': {
90
+ title: 'CORS trusts every website',
91
+ description: 'The server copies any Origin into Access-Control-Allow-Origin and allows credentials. Any website a logged-in visitor opens can read their private data from your site.',
92
+ fix: 'Check the Origin against a fixed list of trusted domains before returning it, or never allow credentials.',
93
+ },
94
+ 'cors-wildcard-credentials': {
95
+ title: 'CORS wildcard with credentials',
96
+ description: 'Access-Control-Allow-Origin: * combined with credentials is invalid and shows the CORS policy was never thought through.',
97
+ fix: 'Return an explicit trusted origin when credentials are needed, or drop Access-Control-Allow-Credentials.',
98
+ },
99
+ 'nosniff-missing': {
100
+ title: 'MIME sniffing not blocked',
101
+ description: 'Without X-Content-Type-Options: nosniff, a browser may execute an uploaded file as a script if it looks like one.',
102
+ fix: 'Send X-Content-Type-Options: nosniff on every response.',
103
+ },
104
+ 'referrer-policy': {
105
+ title: 'Full URLs leak to other sites',
106
+ description: 'Links to other sites can send them the full address of the page, including tokens or private paths it may contain.',
107
+ fix: 'Send Referrer-Policy: strict-origin-when-cross-origin.',
108
+ },
109
+ 'permissions-policy-missing': {
110
+ title: 'No Permissions-Policy',
111
+ description: 'Permissions-Policy turns off browser features the site never uses (camera, microphone, location), so injected code cannot use them either.',
112
+ fix: 'Disable the features you do not need, for example camera=(), microphone=(), geolocation=().',
113
+ },
114
+ 'cookie-not-secure': {
115
+ title: 'Cookies sent without Secure',
116
+ description: 'Cookies without the Secure flag can be sent over plain HTTP, where anyone on the network can steal them, session cookies included.',
117
+ fix: 'Add Secure to every cookie, and HttpOnly plus SameSite=Lax to session cookies.',
118
+ },
119
+ 'cookie-no-httponly': {
120
+ title: 'Session cookie readable by JavaScript',
121
+ description: 'Without HttpOnly, any XSS flaw lets an attacker steal the session cookie and log in as the visitor.',
122
+ fix: 'Add HttpOnly to session and authentication cookies.',
123
+ },
124
+ 'cookie-no-samesite': {
125
+ title: 'Cookies without SameSite',
126
+ description: 'Without SameSite, older browsers attach the cookie to requests made by other sites, which enables cross-site request forgery (CSRF).',
127
+ fix: 'Add SameSite=Lax, or SameSite=Strict for sensitive cookies.',
128
+ },
129
+ 'exposed-git': {
130
+ title: 'Git repository downloadable',
131
+ description: 'The .git folder is public. Anyone can rebuild your entire source code and history with free tools, including passwords and keys ever committed.',
132
+ fix: 'Block every path starting with a dot except /.well-known/, remove .git from the web root, and change every secret that was ever committed.',
133
+ },
134
+ 'exposed-env': {
135
+ title: '.env file downloadable',
136
+ description: 'The .env file usually holds database passwords, API keys and tokens. Bots scan the whole Internet for it every day.',
137
+ fix: 'Move .env outside the web root, block dotfiles, and change every secret it contains right now.',
138
+ },
139
+ 'exposed-backup': {
140
+ title: 'Backup or dump downloadable',
141
+ description: 'A database dump, archive or configuration backup is public. It often contains user data and passwords.',
142
+ fix: 'Delete the file from the web root, keep backups outside it, and block .sql, .zip, .bak and ~ files.',
143
+ },
144
+ 'exposed-config': {
145
+ title: 'Configuration file with credentials exposed',
146
+ description: 'A tool configuration file (SFTP, npm, Docker) with hosts, passwords or tokens is publicly readable.',
147
+ fix: 'Remove it from the web root, block dotfiles and change the credentials it contains.',
148
+ },
149
+ 'exposed-htpasswd': {
150
+ title: '.htpasswd downloadable',
151
+ description: 'The password file of your protected areas is public. Its hashes can be cracked offline.',
152
+ fix: 'Block .ht* files and move .htpasswd outside the web root.',
153
+ },
154
+ 'exposed-phpinfo': {
155
+ title: 'phpinfo() page exposed',
156
+ description: 'phpinfo() reveals the exact PHP version, modules, paths and sometimes environment variables: a ready-made map for an attacker.',
157
+ fix: 'Delete the file.',
158
+ },
159
+ 'exposed-server-status': {
160
+ title: 'Server status page public',
161
+ description: 'The Apache status page lists live requests, client IPs and internal URLs.',
162
+ fix: 'Restrict /server-status to localhost or disable mod_status.',
163
+ },
164
+ 'directory-listing': {
165
+ title: 'Directory listing enabled',
166
+ description: 'The server lists the content of folders, so anyone can browse and download files that were never linked.',
167
+ fix: 'Disable automatic indexes.',
168
+ },
169
+ 'exposed-ds-store': {
170
+ title: '.DS_Store file exposed',
171
+ description: 'This macOS file lists the names of the files in a folder, including ones that were never meant to be found.',
172
+ fix: 'Delete .DS_Store files from the server and add them to .gitignore.',
173
+ },
174
+ 'security-txt-missing': {
175
+ title: 'No security.txt',
176
+ description: 'security.txt (RFC 9116) tells researchers how to report a vulnerability to you instead of publishing it.',
177
+ fix: 'Create /.well-known/security.txt with at least a Contact and an Expires line.',
178
+ },
179
+ 'insecure-form': {
180
+ title: 'Password sent over HTTP',
181
+ description: 'A login form sends the password to an http:// address. It travels in clear text, even if the page itself uses HTTPS.',
182
+ fix: 'Point every form action to https://, or use a relative URL.',
183
+ },
184
+ 'mixed-content': {
185
+ title: 'Mixed content',
186
+ description: 'The HTTPS page loads resources over http://. Browsers block scripts and styles loaded this way, and images can be swapped in transit.',
187
+ fix: 'Load every resource over https:// or with a relative URL.',
188
+ },
189
+ 'outdated-library': {
190
+ title: 'Vulnerable JavaScript library',
191
+ description: 'The page loads a library version with publicly known vulnerabilities that attackers know how to exploit.',
192
+ fix: 'Update the library to a fixed version and remove old copies from the server.',
193
+ },
194
+ 'sri-missing': {
195
+ title: 'External scripts without integrity check',
196
+ description: 'If the CDN serving these scripts is compromised, the modified code runs on your site. Subresource Integrity lets the browser refuse it.',
197
+ fix: 'Add integrity="sha384-…" and crossorigin="anonymous" to scripts loaded from a CDN.',
198
+ },
199
+ 'version-disclosure': {
200
+ title: 'Software versions disclosed',
201
+ description: 'Exact versions let attackers look up the matching vulnerabilities in seconds.',
202
+ fix: 'Hide version numbers in server headers and remove the generator meta tag.',
203
+ },
204
+ },
205
+ messages: {
206
+ 'no-https': (p) => `https://${p.host} cannot be reached (${p.error})`,
207
+ 'tls-invalid-cert': (p) => `Browsers reject the certificate: ${TLS_REASONS[p.reason] ?? p.reason}`,
208
+ 'tls-old-protocol': (p) => `The server still accepts ${p.protocol}`,
209
+ 'tls-expiring': (p) => `The certificate expires in ${plural(p.days, 'day', 'days')} (${p.date})`,
210
+ 'http-no-redirect': (p) => `http:// serves the site (HTTP ${p.status}) instead of redirecting to https://`,
211
+ 'insecure-redirect': (p) => `${p.from} redirects to ${p.to}`,
212
+ 'hsts-missing': () => 'No Strict-Transport-Security header',
213
+ 'hsts-weak': (p) => `max-age is ${plural(p.days, 'day', 'days')}, below the recommended 180 days`,
214
+ 'csp-missing': (p) => (p.reportOnly ? 'Only a report-only policy is set: nothing is blocked' : 'No Content-Security-Policy header or meta tag'),
215
+ 'csp-unsafe': (p) => `The policy allows ${list(p.reasons.map((reason) => CSP_REASONS[reason] ?? reason))}`,
216
+ clickjacking: () => 'Neither X-Frame-Options nor frame-ancestors is set',
217
+ 'cors-reflected-origin': (p) => `The server trusts Origin ${p.origin} and allows credentials`,
218
+ 'cors-wildcard-credentials': () => 'Access-Control-Allow-Origin: * is sent with Access-Control-Allow-Credentials: true',
219
+ 'nosniff-missing': () => 'X-Content-Type-Options: nosniff is missing',
220
+ 'referrer-policy': (p) => (p.value ? `Referrer-Policy "${p.value}" sends full URLs to other sites` : 'No Referrer-Policy'),
221
+ 'permissions-policy-missing': () => 'No Permissions-Policy header',
222
+ 'cookie-not-secure': (p) => `${list(p.names)} ${p.names.length === 1 ? 'is' : 'are'} set without Secure`,
223
+ 'cookie-no-httponly': (p) => `${list(p.names)} ${p.names.length === 1 ? 'is' : 'are'} readable by JavaScript`,
224
+ 'cookie-no-samesite': (p) => `${list(p.names)} ${p.names.length === 1 ? 'has' : 'have'} no SameSite attribute`,
225
+ 'exposed-git': (p) => `${list(p.paths)} publicly downloadable`,
226
+ 'exposed-env': (p) => `${list(p.paths)} publicly downloadable`,
227
+ 'exposed-backup': (p) => `${list(p.paths)} publicly downloadable`,
228
+ 'exposed-config': (p) => `${list(p.paths)} publicly downloadable`,
229
+ 'exposed-htpasswd': (p) => `${list(p.paths)} publicly downloadable`,
230
+ 'exposed-phpinfo': (p) => `${list(p.paths)} shows phpinfo()`,
231
+ 'exposed-server-status': (p) => `${list(p.paths)} is public`,
232
+ 'directory-listing': (p) => `Folder content listed at ${list(p.paths ?? [p.path])}`,
233
+ 'exposed-ds-store': (p) => `${list(p.paths)} publicly downloadable`,
234
+ 'security-txt-missing': () => 'No /.well-known/security.txt with a Contact line',
235
+ 'insecure-form': (p) => `Password form submitted to ${list(p.actions)}`,
236
+ 'mixed-content': (p) => `${plural(p.active, 'active resource', 'active resources')} and ${plural(p.passive, 'image', 'images')} loaded over http://`,
237
+ 'outdated-library': (p) => (p.name === 'AngularJS' ? `AngularJS ${p.version} has been unmaintained since 2022` : `${p.name} ${p.version} is affected by ${p.advisory} (fixed in ${p.fixed})`),
238
+ 'sri-missing': (p) => `${plural(p.count, 'script', 'scripts')} from ${list(p.hosts)} without integrity attribute`,
239
+ 'version-disclosure': (p) => `${plural(p.items.length, 'header or tag reveals', 'headers or tags reveal')} software versions`,
240
+ },
241
+ verdicts: {
242
+ 'A+': 'Excellent. Keep checking after every change.',
243
+ A: 'Very good. Only small improvements left.',
244
+ B: 'Good base, a few weaknesses to fix.',
245
+ C: 'Several weaknesses. Plan the fixes soon.',
246
+ D: 'Weak. Visitors and data are exposed.',
247
+ F: 'Critical. Fix the critical findings now.',
248
+ },
249
+ ui: {
250
+ tagline: (v) => `v${v} · website security checker · crafted by FreshDev`,
251
+ target: 'target',
252
+ final: 'landed on',
253
+ tls: 'tls',
254
+ requests: 'requests',
255
+ unreachable: 'unreachable',
256
+ findings: (n) => plural(n, 'finding', 'findings'),
257
+ score: 'score',
258
+ fix: 'fix',
259
+ evidence: 'evidence',
260
+ written: { html: 'HTML report', json: 'JSON' },
261
+ probeOff: 'exposed-file checks skipped (--no-probe)',
262
+ certValid: (to) => `valid until ${to}`,
263
+ },
264
+ report: {
265
+ documentTitle: 'Website security report',
266
+ reference: 'Reference',
267
+ date: 'Date',
268
+ scope: 'Scope',
269
+ tool: 'Tool',
270
+ overallRisk: 'Overall rating',
271
+ preparedWith: 'Prepared with vigie by FreshDev',
272
+ contents: 'Contents',
273
+ sections: { summary: 'Executive summary', matrix: 'Risk matrix', findings: 'Findings', scope: 'Scope and method' },
274
+ summary: (s) => {
275
+ const parts = [`vigie checked ${plural(s.targets, 'website', 'websites')} with ${plural(s.requests, 'request', 'requests')}.`];
276
+ if (s.total === 0) parts.push('No finding was raised.');
277
+ else parts.push(`It raised ${plural(s.total, 'finding', 'findings')} (${s.breakdown.map(([sev, n]) => `${n} ${sev}`).join(', ')}).`);
278
+ return parts.join(' ');
279
+ },
280
+ statement: {
281
+ 'A+': 'The site follows current best practices for HTTPS, security headers, cookies and file exposure.',
282
+ A: 'The configuration is solid. The remaining points are hardening measures.',
283
+ B: 'The essentials are in place, but some protections are missing.',
284
+ C: 'Several common attacks are not mitigated. The fixes are usually a few lines of server configuration.',
285
+ D: 'Important protections are missing and some weaknesses can be exploited directly.',
286
+ F: 'At least one finding exposes the site, its data or its visitors right now. It must be fixed before anything else.',
287
+ },
288
+ priorities: 'Priority actions',
289
+ noPriorities: 'No action required.',
290
+ category: 'Category',
291
+ total: 'Total',
292
+ severity: 'Severity',
293
+ rule: 'Check',
294
+ location: 'Website',
295
+ weakness: 'Weakness',
296
+ description: 'Description',
297
+ observation: 'Observation',
298
+ evidence: 'Evidence',
299
+ recommendation: 'Recommendation',
300
+ example: 'Example',
301
+ noFindings: 'No finding.',
302
+ scopeIntro: 'The following websites were checked. Only public pages were requested, as any visitor would.',
303
+ website: 'Website',
304
+ findingsCol: 'Findings',
305
+ landed: 'Landed on',
306
+ grade: 'Rating',
307
+ score: 'Score',
308
+ status: 'Status',
309
+ unreachable: 'Unreachable',
310
+ certificate: 'Certificate',
311
+ headersTitle: 'Response headers',
312
+ redirects: 'Redirects',
313
+ method: 'Method',
314
+ methodText: 'vigie sends ordinary HTTP requests, like a browser: it follows redirects, reads the TLS certificate, the response headers, the cookies and the HTML of the home page, then requests a short list of sensitive paths (.git, .env, backups, phpinfo…). A file is only reported when its content matches what that file really looks like, so sites that answer every address with their home page do not cause false alarms. Secrets found in exposed files are never displayed.',
315
+ limits: 'Limits',
316
+ limitsText: 'vigie does not log in, submit forms or attempt any attack. It only sees what an anonymous visitor sees on the address given. A good rating does not prove the application itself is free of vulnerabilities.',
317
+ print: 'Print / PDF',
318
+ filter: 'Show',
319
+ scoreOf: (n) => `${n}/100`,
320
+ },
321
+ help: (c) => ` ${c.bold('Usage')}
322
+ vigie ${c.gray('<url> [url…]')} check one or more websites
323
+
324
+ ${c.bold('Options')}
325
+ --html <file> write a bilingual HTML audit report
326
+ --json print JSON instead of the console report
327
+ --lang <en|fr> language of the output ${c.gray('(default: system language)')}
328
+ --fail-under <grade> exit code 1 below this grade (A+, A, B, C, D) ${c.gray('(for CI)')}
329
+ --no-probe only read the home page, skip the exposed-file checks
330
+ --timeout <seconds> per request ${c.gray('(default: 10)')}
331
+ -q, --quiet only print the summary
332
+ --no-banner hide the FreshDev logo
333
+
334
+ ${c.bold('Examples')}
335
+ ${c.gray('$')} vigie example.com
336
+ ${c.gray('$')} vigie https://shop.example.com --html audit.html --lang fr
337
+ ${c.gray('$')} vigie example.com --fail-under B
338
+
339
+ ${c.gray('Only check websites you own or are allowed to test.')}
340
+ `,
341
+ errors: {
342
+ noTarget: 'Missing website address',
343
+ noTargetHint: 'Example: vigie example.com',
344
+ invalidUrl: (value) => `Invalid address: ${value}`,
345
+ invalidGrade: (value) => `Invalid grade '${value}'`,
346
+ gradeHint: 'Use A+, A, B, C or D',
347
+ invalidLang: (value) => `Unsupported language '${value}'`,
348
+ needsFile: (flag) => `--${flag} needs a file name`,
349
+ invalidTimeout: (value) => `Invalid timeout '${value}'`,
350
+ },
351
+ };