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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.fr.md +165 -0
- package/README.md +164 -2
- package/bin/vigie.js +18 -0
- package/package.json +43 -4
- package/src/args.js +33 -0
- package/src/banner.js +62 -0
- package/src/catalog.js +139 -0
- package/src/checks/content.js +100 -0
- package/src/checks/exposure.js +83 -0
- package/src/checks/headers.js +118 -0
- package/src/checks/transport.js +79 -0
- package/src/cli.js +82 -0
- package/src/errors.js +7 -0
- package/src/html.js +424 -0
- package/src/i18n/en.js +351 -0
- package/src/i18n/fr.js +352 -0
- package/src/i18n/index.js +29 -0
- package/src/net.js +159 -0
- package/src/report.js +125 -0
- package/src/scan.js +103 -0
- package/src/ui.js +36 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to vigie are listed here. Versions follow [Semantic Versioning](https://semver.org).
|
|
4
|
+
|
|
5
|
+
## 1.0.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- 34 checks across HTTPS and certificates, security headers, cookies, exposed files, page content and information disclosure.
|
|
9
|
+
- Content signatures and a soft-404 baseline, so sites that answer every path with their home page do not cause false alarms.
|
|
10
|
+
- Score out of 100 and grades from A+ to F.
|
|
11
|
+
- Console output with the FreshDev logo, JSON output and a bilingual HTML audit report that prints to A4.
|
|
12
|
+
- nginx and Apache configuration examples for every fix that can be done in the server.
|
|
13
|
+
- English and French everywhere, with `--lang` and system language detection.
|
|
14
|
+
- `--fail-under` for CI and `--no-probe` for passive checks only.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FreshDev (Fresh&Dev)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.fr.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# vigie
|
|
4
|
+
|
|
5
|
+
**Vérifie la sécurité de n'importe quel site web en quelques secondes, avec un rapport que ton client peut lire.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/vigie)
|
|
8
|
+
[](https://github.com/FreshlapeufDev/vigie/actions/workflows/ci.yml)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](https://github.com/FreshlapeufDev/vigie/blob/main/LICENSE)
|
|
11
|
+
|
|
12
|
+
HTTPS · certificats · en-têtes de sécurité · cookies · fichiers exposés · bibliothèques vulnérables
|
|
13
|
+
|
|
14
|
+
[English](https://github.com/FreshlapeufDev/vigie/blob/main/README.md) · **Français**
|
|
15
|
+
|
|
16
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/console.png" alt="Sortie console de vigie" width="760">
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
## Pourquoi
|
|
21
|
+
|
|
22
|
+
La plupart des sites ne se font pas pirater par des attaques sophistiquées. Ils se font pirater parce qu'un fichier `.env` est téléchargeable, que le dossier `.git` est public, qu'une sauvegarde traîne dans le dossier du site, que les cookies circulent sans `Secure`, ou qu'un jQuery vieux de dix ans tourne encore sur la page d'accueil.
|
|
23
|
+
|
|
24
|
+
Des robots cherchent ces erreurs sur tout Internet, chaque jour. vigie les trouve avant eux, explique chacune simplement et donne la ligne exacte de configuration nginx ou Apache qui la corrige.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Il faut [Node.js](https://nodejs.org) 18 ou plus récent (prends la version **LTS**).
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g vigie
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
ou lance-le une seule fois sans rien installer :
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx vigie exemple.fr
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Utilisation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
vigie exemple.fr
|
|
44
|
+
vigie https://boutique.exemple.fr --html audit.html
|
|
45
|
+
vigie exemple.fr blog.exemple.fr --lang fr
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Option | |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `--html <fichier>` | rapport d'audit autonome en français et en anglais |
|
|
51
|
+
| `--json` | sortie exploitable par d'autres outils |
|
|
52
|
+
| `--lang <fr\|en>` | langue de la sortie (par défaut : langue du système) |
|
|
53
|
+
| `--fail-under <note>` | code de sortie `1` sous cette note, pour l'intégration continue |
|
|
54
|
+
| `--no-probe` | lire seulement la page d'accueil, sans chercher de fichiers exposés |
|
|
55
|
+
| `--timeout <secondes>` | délai par requête (`10` par défaut) |
|
|
56
|
+
| `-q, --quiet` | résumé uniquement |
|
|
57
|
+
| `--no-banner` | masquer le logo FreshDev |
|
|
58
|
+
|
|
59
|
+
## Ce qui est vérifié
|
|
60
|
+
|
|
61
|
+
| Sévérité | Contrôle | Ce qui est détecté |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| critique | `no-https` | le site n'a pas de HTTPS fonctionnel |
|
|
64
|
+
| critique | `tls-invalid-cert` | certificat expiré, auto-signé, incomplet ou émis pour un autre domaine |
|
|
65
|
+
| critique | `exposed-git` | `/.git/` téléchargeable : tout le code source et son historique |
|
|
66
|
+
| critique | `exposed-env` | `.env`, `.env.local`, `.env.production` téléchargeables |
|
|
67
|
+
| critique | `exposed-backup` | exports `.sql`, archives `.zip`, `wp-config.php.bak`… |
|
|
68
|
+
| critique | `exposed-config` | `.vscode/sftp.json`, `.npmrc`, `docker-compose.yml` avec des secrets |
|
|
69
|
+
| critique | `exposed-htpasswd` | fichier des mots de passe des zones protégées |
|
|
70
|
+
| élevée | `tls-old-protocol` | le serveur accepte encore TLS 1.0 ou 1.1 |
|
|
71
|
+
| élevée | `http-no-redirect` | `http://` affiche le site au lieu de rediriger |
|
|
72
|
+
| élevée | `cors-reflected-origin` | n'importe quel site peut lire les réponses des visiteurs connectés |
|
|
73
|
+
| élevée | `insecure-form` | formulaire de mot de passe envoyé en `http://` |
|
|
74
|
+
| élevée | `exposed-phpinfo` | page `phpinfo()` en ligne |
|
|
75
|
+
| moyenne | `tls-expiring` | certificat qui expire dans moins de 14 jours (faible sous 30) |
|
|
76
|
+
| moyenne | `hsts-missing` | pas de `Strict-Transport-Security` |
|
|
77
|
+
| moyenne | `csp-missing` / `csp-unsafe` | pas de Content Security Policy, ou une politique qui laisse passer les scripts injectés |
|
|
78
|
+
| moyenne | `clickjacking` | la page peut être intégrée par n'importe quel site |
|
|
79
|
+
| moyenne | `cookie-not-secure` | cookies sans `Secure` (élevée pour les cookies de session) |
|
|
80
|
+
| moyenne | `cookie-no-httponly` | cookies de session lisibles par JavaScript |
|
|
81
|
+
| moyenne | `directory-listing` | contenu des dossiers affiché |
|
|
82
|
+
| moyenne | `mixed-content` | ressources en `http://` sur une page HTTPS |
|
|
83
|
+
| moyenne | `outdated-library` | jQuery, Bootstrap, AngularJS, Lodash avec des failles connues |
|
|
84
|
+
| moyenne | `insecure-redirect` / `cors-wildcard-credentials` / `exposed-server-status` | |
|
|
85
|
+
| faible | `hsts-weak`, `nosniff-missing`, `referrer-policy`, `cookie-no-samesite`, `sri-missing`, `version-disclosure`, `exposed-ds-store` | |
|
|
86
|
+
| info | `permissions-policy-missing`, `security-txt-missing` | |
|
|
87
|
+
|
|
88
|
+
Chaque contrôle est associé à son identifiant [CWE](https://cwe.mitre.org), à une explication et à un correctif avec des exemples nginx et Apache.
|
|
89
|
+
|
|
90
|
+
## Notation
|
|
91
|
+
|
|
92
|
+
Le score part de 100 et perd 40, 20, 10 ou 5 points par constat critique, élevé, moyen ou faible.
|
|
93
|
+
|
|
94
|
+
| Note | Signification |
|
|
95
|
+
|---|---|
|
|
96
|
+
| **A+** | aucun constat au-dessus de « info » |
|
|
97
|
+
| **A** | 90 et plus |
|
|
98
|
+
| **B** | 75 et plus |
|
|
99
|
+
| **C** | 60 et plus |
|
|
100
|
+
| **D** | 40 et plus |
|
|
101
|
+
| **F** | moins de 40, ou au moins un constat critique |
|
|
102
|
+
|
|
103
|
+
## Rapport d'audit HTML
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
vigie exemple.fr --html audit.html --lang fr
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Un seul fichier autonome, présenté comme le rapport que remet un cabinet de sécurité : page de garde avec une référence, synthèse, actions prioritaires, matrice des risques, constats numérotés (`VG-01`, `VG-02`…) avec preuves et exemples de configuration, puis le périmètre avec le certificat, les redirections et les en-têtes de chaque site.
|
|
110
|
+
|
|
111
|
+
Il passe du **français à l'anglais** en un clic et s'imprime en PDF A4 propre.
|
|
112
|
+
|
|
113
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/report-cover.fr.png" alt="Page de garde du rapport vigie" width="760">
|
|
114
|
+
|
|
115
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/report-finding.fr.png" alt="Constat du rapport vigie" width="760">
|
|
116
|
+
|
|
117
|
+
## Pas de fausses alertes
|
|
118
|
+
|
|
119
|
+
Beaucoup de sites répondent à toutes les adresses avec leur page d'accueil (React, Vue, certains WordPress). Un scanner naïf signale alors `.env` et `.git` comme exposés partout. vigie ne signale un fichier que si son **contenu** correspond vraiment à ce type de fichier (`ref: refs/` pour Git, des lignes `CLE=valeur` pour `.env`, la signature ZIP pour une archive…), et compare chaque réponse avec une page aléatoire qui ne devrait pas exister.
|
|
120
|
+
|
|
121
|
+
Les secrets trouvés dans les fichiers exposés ne sont **jamais affichés** : seuls les noms des variables apparaissent, sous la forme `DB_PASSWORD=••••••`.
|
|
122
|
+
|
|
123
|
+
## En intégration continue
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
- run: npx vigie https://preprod.exemple.fr --fail-under B
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Le job échoue si la note passe sous B, par exemple après la suppression d'un en-tête de sécurité.
|
|
130
|
+
|
|
131
|
+
## Utilisation responsable
|
|
132
|
+
|
|
133
|
+
vigie n'envoie que des requêtes ordinaires, comme un navigateur : une trentaine par site, jamais de formulaire, jamais de connexion, jamais d'attaque. C'est tout de même un outil de sécurité : **ne vérifie que des sites qui t'appartiennent ou que tu es autorisé à tester.** Avec `--no-probe`, seule la page d'accueil est lue.
|
|
134
|
+
|
|
135
|
+
## Développement
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/FreshlapeufDev/vigie
|
|
139
|
+
cd vigie
|
|
140
|
+
npm test
|
|
141
|
+
npm link
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Les tests lancent de vrais serveurs HTTP et HTTPS sur ta machine : une boutique volontairement vulnérable et une application monopage bien protégée. Ils ont besoin d'`openssl` pour créer les certificats de test.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
src/
|
|
148
|
+
├─ net.js client HTTP/HTTPS : redirections, détails TLS, compression, limites de taille
|
|
149
|
+
├─ checks/ transport, en-têtes et cookies, fichiers exposés, contenu de la page
|
|
150
|
+
├─ catalog.js contrôles, sévérités, CWE, notation, exemples nginx/Apache
|
|
151
|
+
├─ i18n/ anglais et français
|
|
152
|
+
├─ report.js sortie console et JSON
|
|
153
|
+
└─ html.js rapport d'audit
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Aucune dépendance à l'exécution.
|
|
157
|
+
|
|
158
|
+
## Voir aussi
|
|
159
|
+
|
|
160
|
+
- [**fxguard**](https://github.com/FreshlapeufDev/fxguard) — scanner de sécurité pour resources FiveM
|
|
161
|
+
- [**fxforge**](https://github.com/FreshlapeufDev/fxforge) — créer, vérifier et empaqueter des resources FiveM
|
|
162
|
+
|
|
163
|
+
## Licence
|
|
164
|
+
|
|
165
|
+
MIT © FreshDev — Fresh&Dev
|
package/README.md
CHANGED
|
@@ -1,3 +1,165 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# vigie
|
|
4
|
+
|
|
5
|
+
**Check the security of any website in seconds, and get a report your client can read.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/vigie)
|
|
8
|
+
[](https://github.com/FreshlapeufDev/vigie/actions/workflows/ci.yml)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](https://github.com/FreshlapeufDev/vigie/blob/main/LICENSE)
|
|
11
|
+
|
|
12
|
+
HTTPS · certificates · security headers · cookies · exposed files · vulnerable libraries
|
|
13
|
+
|
|
14
|
+
**English** · [Français](https://github.com/FreshlapeufDev/vigie/blob/main/README.fr.md)
|
|
15
|
+
|
|
16
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/console.png" alt="vigie console output" width="760">
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
## Why
|
|
21
|
+
|
|
22
|
+
Most websites are not hacked through clever exploits. They are hacked because a `.env` file is downloadable, the `.git` folder is public, a backup sits in the web root, cookies travel without `Secure`, or a ten-year-old jQuery still runs on the home page.
|
|
23
|
+
|
|
24
|
+
Bots scan the whole Internet for these mistakes every day. vigie finds them first, explains each one in plain language and gives you the exact line of nginx or Apache configuration that fixes it.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
You need [Node.js](https://nodejs.org) 18 or newer (pick the **LTS** version).
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g vigie
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
or run it once without installing:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx vigie example.com
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
vigie example.com
|
|
44
|
+
vigie https://shop.example.com --html audit.html
|
|
45
|
+
vigie example.com blog.example.com --lang fr
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Option | |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `--html <file>` | standalone audit report in English and French |
|
|
51
|
+
| `--json` | machine-readable output |
|
|
52
|
+
| `--lang <en\|fr>` | output language (default: system language) |
|
|
53
|
+
| `--fail-under <grade>` | exit code `1` below this grade, for CI |
|
|
54
|
+
| `--no-probe` | only read the home page, skip the exposed-file checks |
|
|
55
|
+
| `--timeout <seconds>` | per request (default `10`) |
|
|
56
|
+
| `-q, --quiet` | summary only |
|
|
57
|
+
| `--no-banner` | hide the FreshDev logo |
|
|
58
|
+
|
|
59
|
+
## What it checks
|
|
60
|
+
|
|
61
|
+
| Severity | Check | What it catches |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| critical | `no-https` | the site has no working HTTPS |
|
|
64
|
+
| critical | `tls-invalid-cert` | expired, self-signed, incomplete or wrong-domain certificate |
|
|
65
|
+
| critical | `exposed-git` | `/.git/` downloadable: full source code and history |
|
|
66
|
+
| critical | `exposed-env` | `.env`, `.env.local`, `.env.production` downloadable |
|
|
67
|
+
| critical | `exposed-backup` | `.sql` dumps, `.zip` archives, `wp-config.php.bak`… |
|
|
68
|
+
| critical | `exposed-config` | `.vscode/sftp.json`, `.npmrc`, `docker-compose.yml` with secrets |
|
|
69
|
+
| critical | `exposed-htpasswd` | password file of protected areas |
|
|
70
|
+
| high | `tls-old-protocol` | server still accepts TLS 1.0 or 1.1 |
|
|
71
|
+
| high | `http-no-redirect` | `http://` serves the site instead of redirecting |
|
|
72
|
+
| high | `cors-reflected-origin` | any website can read authenticated responses |
|
|
73
|
+
| high | `insecure-form` | password form posted to `http://` |
|
|
74
|
+
| high | `exposed-phpinfo` | `phpinfo()` page online |
|
|
75
|
+
| medium | `tls-expiring` | certificate expires within 14 days (low within 30) |
|
|
76
|
+
| medium | `hsts-missing` | no `Strict-Transport-Security` |
|
|
77
|
+
| medium | `csp-missing` / `csp-unsafe` | no Content Security Policy, or one that still allows injected scripts |
|
|
78
|
+
| medium | `clickjacking` | page can be framed by any site |
|
|
79
|
+
| medium | `cookie-not-secure` | cookies without `Secure` (high for session cookies) |
|
|
80
|
+
| medium | `cookie-no-httponly` | session cookies readable by JavaScript |
|
|
81
|
+
| medium | `directory-listing` | folder content listed |
|
|
82
|
+
| medium | `mixed-content` | resources loaded over `http://` on an HTTPS page |
|
|
83
|
+
| medium | `outdated-library` | jQuery, Bootstrap, AngularJS, Lodash with known CVEs |
|
|
84
|
+
| medium | `insecure-redirect` / `cors-wildcard-credentials` / `exposed-server-status` | |
|
|
85
|
+
| low | `hsts-weak`, `nosniff-missing`, `referrer-policy`, `cookie-no-samesite`, `sri-missing`, `version-disclosure`, `exposed-ds-store` | |
|
|
86
|
+
| info | `permissions-policy-missing`, `security-txt-missing` | |
|
|
87
|
+
|
|
88
|
+
Every check carries its [CWE](https://cwe.mitre.org) identifier, an explanation and a fix with nginx and Apache examples.
|
|
89
|
+
|
|
90
|
+
## Rating
|
|
91
|
+
|
|
92
|
+
The score starts at 100 and loses 40, 20, 10 or 5 points per critical, high, medium or low finding.
|
|
93
|
+
|
|
94
|
+
| Grade | Meaning |
|
|
95
|
+
|---|---|
|
|
96
|
+
| **A+** | no finding above info |
|
|
97
|
+
| **A** | 90 and above |
|
|
98
|
+
| **B** | 75 and above |
|
|
99
|
+
| **C** | 60 and above |
|
|
100
|
+
| **D** | 40 and above |
|
|
101
|
+
| **F** | below 40, or any critical finding |
|
|
102
|
+
|
|
103
|
+
## HTML audit report
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
vigie example.com --html audit.html --lang fr
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A single self-contained file, laid out like the report a security firm hands over: cover page with a reference, executive summary, priority actions, risk matrix, numbered findings (`VG-01`, `VG-02`…) with evidence and configuration examples, then the scope with the certificate, redirects and response headers of every site.
|
|
110
|
+
|
|
111
|
+
It switches between **English and French** in one click and prints to a clean A4 PDF.
|
|
112
|
+
|
|
113
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/report-cover.en.png" alt="vigie report cover" width="760">
|
|
114
|
+
|
|
115
|
+
<img src="https://raw.githubusercontent.com/FreshlapeufDev/vigie/main/docs/report-finding.en.png" alt="vigie report finding" width="760">
|
|
116
|
+
|
|
117
|
+
## No false alarms
|
|
118
|
+
|
|
119
|
+
Many sites answer every address with their home page (React, Vue, WordPress with some plugins). A naive scanner then reports `.env` and `.git` as exposed everywhere. vigie only reports a file when its **content** matches what that file really looks like (`ref: refs/` for Git, `KEY=value` lines for `.env`, a ZIP signature for archives…), and compares every answer with a random page that should not exist.
|
|
120
|
+
|
|
121
|
+
Secrets found in exposed files are **never displayed**: only the variable names are shown, as `DB_PASSWORD=••••••`.
|
|
122
|
+
|
|
123
|
+
## Use it in CI
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
- run: npx vigie https://staging.example.com --fail-under B
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The job fails if the grade drops below B, for example after someone removes a security header.
|
|
130
|
+
|
|
131
|
+
## Be responsible
|
|
132
|
+
|
|
133
|
+
vigie only sends ordinary requests, like a browser: about thirty per site, never a form, never a login, never an attack. It is still a security tool: **only check websites you own or are allowed to test.** Use `--no-probe` to read the home page only.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/FreshlapeufDev/vigie
|
|
139
|
+
cd vigie
|
|
140
|
+
npm test
|
|
141
|
+
npm link
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The tests start real HTTP and HTTPS servers on your machine: a deliberately vulnerable shop and a hardened single-page app. They need `openssl` to create the test certificates.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
src/
|
|
148
|
+
├─ net.js HTTP/HTTPS client: redirects, TLS details, compression, size limits
|
|
149
|
+
├─ checks/ transport, headers & cookies, exposed files, page content
|
|
150
|
+
├─ catalog.js checks, severities, CWE, scoring, nginx/Apache examples
|
|
151
|
+
├─ i18n/ English and French
|
|
152
|
+
├─ report.js console and JSON output
|
|
153
|
+
└─ html.js audit report
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
No runtime dependency.
|
|
157
|
+
|
|
158
|
+
## Related
|
|
159
|
+
|
|
160
|
+
- [**fxguard**](https://github.com/FreshlapeufDev/fxguard) — security scanner for FiveM resources
|
|
161
|
+
- [**fxforge**](https://github.com/FreshlapeufDev/fxforge) — scaffold, lint and package FiveM resources
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT © FreshDev — Fresh&Dev
|
package/bin/vigie.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { run } from '../src/cli.js';
|
|
3
|
+
import { FxError } from '../src/errors.js';
|
|
4
|
+
import { c } from '../src/ui.js';
|
|
5
|
+
|
|
6
|
+
run(process.argv.slice(2))
|
|
7
|
+
.then((code) => {
|
|
8
|
+
process.exitCode = code ?? 0;
|
|
9
|
+
})
|
|
10
|
+
.catch((err) => {
|
|
11
|
+
if (err instanceof FxError) {
|
|
12
|
+
console.error(`${c.red('✖')} ${err.message}`);
|
|
13
|
+
if (err.hint) console.error(` ${c.gray(err.hint)}`);
|
|
14
|
+
} else {
|
|
15
|
+
console.error(c.red(process.env.VIGIE_DEBUG ? err.stack : err.message));
|
|
16
|
+
}
|
|
17
|
+
process.exitCode = 2;
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vigie-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Website security checker by FreshDev: HTTPS, certificates, security headers, cookies, exposed files and vulnerable libraries, with a bilingual HTML audit report. Zero dependencies.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vigie": "bin/vigie.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"README.fr.md",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "node --test test/unit.test.js test/scan.test.js test/cli.test.js"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"security",
|
|
25
|
+
"website",
|
|
26
|
+
"scanner",
|
|
27
|
+
"https",
|
|
28
|
+
"tls",
|
|
29
|
+
"headers",
|
|
30
|
+
"csp",
|
|
31
|
+
"hsts",
|
|
32
|
+
"audit",
|
|
33
|
+
"cli"
|
|
34
|
+
],
|
|
35
|
+
"author": "FreshDev (Fresh&Dev)",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/FreshlapeufDev/vigie.git"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/FreshlapeufDev/vigie#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/FreshlapeufDev/vigie/issues"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/args.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const BOOLEAN_FLAGS = new Set(['yes', 'y', 'force', 'help', 'h', 'version', 'v', 'json', 'strict', 'all', 'no-color', 'quiet', 'q', 'no-banner', 'no-probe']);
|
|
2
|
+
|
|
3
|
+
export function parseArgs(argv) {
|
|
4
|
+
const positional = [];
|
|
5
|
+
const flags = {};
|
|
6
|
+
for (let i = 0; i < argv.length; i++) {
|
|
7
|
+
const arg = argv[i];
|
|
8
|
+
if (arg === '--') {
|
|
9
|
+
positional.push(...argv.slice(i + 1));
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
if (arg.startsWith('--')) {
|
|
13
|
+
const eq = arg.indexOf('=');
|
|
14
|
+
const key = eq === -1 ? arg.slice(2) : arg.slice(2, eq);
|
|
15
|
+
if (eq !== -1) {
|
|
16
|
+
flags[key] = arg.slice(eq + 1);
|
|
17
|
+
} else if (BOOLEAN_FLAGS.has(key)) {
|
|
18
|
+
flags[key] = true;
|
|
19
|
+
} else if (argv[i + 1] !== undefined && !argv[i + 1].startsWith('-')) {
|
|
20
|
+
flags[key] = argv[++i];
|
|
21
|
+
} else {
|
|
22
|
+
flags[key] = true;
|
|
23
|
+
}
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (arg.startsWith('-') && arg.length > 1) {
|
|
27
|
+
for (const ch of arg.slice(1)) flags[ch] = true;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
positional.push(arg);
|
|
31
|
+
}
|
|
32
|
+
return { positional, flags };
|
|
33
|
+
}
|
package/src/banner.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const LOGO = [
|
|
2
|
+
'███████╗██████╗ ███████╗███████╗██╗ ██╗██████╗ ███████╗██╗ ██╗',
|
|
3
|
+
'██╔════╝██╔══██╗██╔════╝██╔════╝██║ ██║██╔══██╗██╔════╝██║ ██║',
|
|
4
|
+
'█████╗ ██████╔╝█████╗ ███████╗███████║██║ ██║█████╗ ██║ ██║',
|
|
5
|
+
'██╔══╝ ██╔══██╗██╔══╝ ╚════██║██╔══██║██║ ██║██╔══╝ ╚██╗ ██╔╝',
|
|
6
|
+
'██║ ██║ ██║███████╗███████║██║ ██║██████╔╝███████╗ ╚████╔╝ ',
|
|
7
|
+
'╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝ ╚═══╝ ',
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const STOPS = [
|
|
11
|
+
[0, 245, 160],
|
|
12
|
+
[0, 217, 245],
|
|
13
|
+
[123, 97, 255],
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
function colorSupport() {
|
|
17
|
+
if (process.env.NO_COLOR || process.argv.includes('--no-color') || (!process.stdout.isTTY && !process.env.FORCE_COLOR)) return 'none';
|
|
18
|
+
const term = `${process.env.COLORTERM ?? ''} ${process.env.TERM_PROGRAM ?? ''}`.toLowerCase();
|
|
19
|
+
if (/truecolor|24bit|vscode|wezterm|iterm|hyper/.test(term) || process.env.WT_SESSION || process.platform === 'win32') return 'truecolor';
|
|
20
|
+
return '256';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function mix(t) {
|
|
24
|
+
const scaled = t * (STOPS.length - 1);
|
|
25
|
+
const index = Math.min(Math.floor(scaled), STOPS.length - 2);
|
|
26
|
+
const local = scaled - index;
|
|
27
|
+
const [a, b] = [STOPS[index], STOPS[index + 1]];
|
|
28
|
+
return a.map((value, i) => Math.round(value + (b[i] - value) * local));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function toAnsi256([r, g, b]) {
|
|
32
|
+
const level = (value) => (value < 48 ? 0 : value < 115 ? 1 : Math.min(5, Math.round((value - 35) / 40)));
|
|
33
|
+
return 16 + 36 * level(r) + 6 * level(g) + level(b);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function paint(ch, rgb, mode, shade) {
|
|
37
|
+
const color = shade ? rgb.map((value) => Math.round(value * 0.38)) : rgb;
|
|
38
|
+
if (mode === 'truecolor') return `\x1b[38;2;${color[0]};${color[1]};${color[2]}m${ch}`;
|
|
39
|
+
return `\x1b[38;5;${toAnsi256(color)}m${ch}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function renderBanner(name, tagline) {
|
|
43
|
+
const mode = colorSupport();
|
|
44
|
+
const width = LOGO[0].length;
|
|
45
|
+
const lines = LOGO.map((row) => {
|
|
46
|
+
if (mode === 'none') return ` ${row}`;
|
|
47
|
+
let out = ' ';
|
|
48
|
+
for (let i = 0; i < row.length; i++) {
|
|
49
|
+
const ch = row[i];
|
|
50
|
+
if (ch === ' ') {
|
|
51
|
+
out += ' ';
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
out += paint(ch, mix(i / (width - 1)), mode, ch !== '█');
|
|
55
|
+
}
|
|
56
|
+
return `${out}\x1b[0m`;
|
|
57
|
+
});
|
|
58
|
+
const rule = '─'.repeat(width);
|
|
59
|
+
const dim = (text) => (mode === 'none' ? text : `\x1b[90m${text}\x1b[0m`);
|
|
60
|
+
const accent = (text) => (mode === 'none' ? text : `${paint('', mix(0.5), mode, false)}\x1b[1m${text}\x1b[0m`);
|
|
61
|
+
return ['', ...lines, ` ${dim(rule)}`, ` ${accent(name)} ${dim(tagline)}`, ''].join('\n');
|
|
62
|
+
}
|