beforeopen 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BeforeOpen contributors
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.es.md ADDED
@@ -0,0 +1,138 @@
1
+ <h1 align="center" id="title">BEFOREOPEN</h1>
2
+
3
+ <p align="center"><img src="https://socialify.git.ci/willor16/beforeopen/image?description=1&amp;descriptionEditable=Mira%20qu%C3%A9%20ejecutar%C3%A1%20un%20repositorio%20en%20tu%20m%C3%A1quina%20antes%20de%20abrirlo.&amp;font=Inter&amp;forks=1&amp;issues=1&amp;language=1&amp;name=1&amp;owner=1&amp;pattern=Circuit%20Board&amp;pulls=1&amp;stargazers=1&amp;theme=Dark" alt="imagen del proyecto"></p>
4
+
5
+ <p id="description">Abrir una carpeta puede bastar para ejecutar código ajeno: tareas del editor, hooks de agentes de IA, servidores MCP, scripts de instalación o hooks de git. BeforeOpen lee un repositorio sin ejecutar nada y muestra qué se ejecutaría, cuándo y por qué parece peligroso. No busca malware conocido: dibuja el mapa de lo que se puede ejecutar, así que no depende de haber visto antes un ataque.</p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/willor16/beforeopen"><img src="https://img.shields.io/badge/willor16%2Fbeforeopen-black?style=social&amp;logo=github" alt="repositorio"></a>
9
+ <a href="https://github.com/willor16/beforeopen/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/willor16/beforeopen/ci.yml?branch=main&amp;label=CI" alt="CI"></a>
10
+ <a href="https://www.npmjs.com/package/beforeopen"><img src="https://img.shields.io/npm/v/beforeopen?logo=npm" alt="versión en npm"></a>
11
+ <img src="https://img.shields.io/badge/dependencias-0-brightgreen" alt="sin dependencias en ejecución">
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/licencia-MIT-blue" alt="licencia MIT"></a>
13
+ </p>
14
+
15
+ <p align="center"><a href="README.md">🌎 Read in English</a></p>
16
+
17
+ <h2>📸 Capturas del proyecto:</h2>
18
+
19
+ <p align="center"><img src="docs/demo.es.svg" alt="captura del proyecto" width="800"></p>
20
+
21
+ <h2>🧐 Características</h2>
22
+
23
+ Algunas de las mejores características del proyecto:
24
+
25
+ * Analiza carpetas, repositorios de GitHub y GitLab, y pull requests
26
+ * Sigue cada comando hasta los scripts que ejecuta
27
+ * Avisa en cada pull request con una GitHub Action
28
+ * Reglas en YAML que cualquiera puede ampliar
29
+ * Informes en español e inglés
30
+ * Sin telemetría, sin cuentas y sin scripts de instalación
31
+
32
+ <h2>🛠️ Pasos de instalación:</h2>
33
+
34
+ Necesitas [Node.js](https://nodejs.org) 20 o posterior, y git.
35
+
36
+ <p>1. Instala el comando</p>
37
+
38
+ ```sh
39
+ npm install -g beforeopen
40
+ ```
41
+
42
+ <p>2. Analiza un repositorio</p>
43
+
44
+ ```sh
45
+ beforeopen owner/repo
46
+ ```
47
+
48
+ O úsalo sin instalar nada. Ejecútalo desde fuera de la carpeta en la que no confías, porque `npx` lee los ajustes de la carpeta actual:
49
+
50
+ ```sh
51
+ npx beforeopen owner/repo
52
+ ```
53
+
54
+ <h2>🚀 Uso:</h2>
55
+
56
+ ```sh
57
+ beforeopen owner/repo # un repositorio de GitHub, sin clonarlo
58
+ beforeopen https://github.com/o/r/pull/12 # un pull request
59
+ beforeopen https://gitlab.com/grupo/repo # cualquier servidor git
60
+ beforeopen ~/Downloads/prueba-tecnica # una carpeta
61
+ beforeopen diff main rama # lo que agrega una rama
62
+ ```
63
+
64
+ Agrega `--all` para ver los hallazgos de gravedad baja, o `--json` para otras herramientas. El código de salida es 0 si no encontró nada grave, 1 si encontró algo y 2 si el análisis falló o quedó incompleto.
65
+
66
+ <h2>🤖 GitHub Action:</h2>
67
+
68
+ Informa solo de lo que un pull request agrega o cambia. No necesita token ni secretos.
69
+
70
+ ```yaml
71
+ # .github/workflows/beforeopen.yml
72
+ name: beforeopen
73
+ on: pull_request
74
+ permissions:
75
+ contents: read
76
+ jobs:
77
+ check:
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - uses: actions/checkout@v5
81
+ with:
82
+ fetch-depth: 2
83
+ persist-credentials: false
84
+ - uses: willor16/beforeopen@v0 # mejor: fija el hash completo de un commit
85
+ with:
86
+ lang: es
87
+ ```
88
+
89
+ Usa `pull_request`, nunca `pull_request_target`.
90
+
91
+ <h2>🔍 Qué revisa:</h2>
92
+
93
+ | Cuándo | Dónde |
94
+ | --- | --- |
95
+ | 📝 Al abrir en un editor | VS Code, JetBrains, Vim, Emacs, Zed, MSBuild |
96
+ | 🤖 Al abrir con un agente de IA | Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf, Kiro, Opencode, servidores MCP, instrucciones con texto oculto |
97
+ | 📁 Al entrar en la carpeta | direnv, mise, autoenv |
98
+ | 🌿 Al usar git | Hooks, `.git/config`, repositorios ocultos, submódulos, husky, lefthook, pre-commit |
99
+ | 📦 Al abrir en un contenedor | Comandos del contenedor de desarrollo y acceso a tu máquina |
100
+ | ⬇️ Al instalar | npm, pnpm, Yarn, Bun, node-gyp, pip, setup.py, Composer, CocoaPods |
101
+ | 🔨 Al compilar o probar | Cargo, Gradle, Maven, pytest, eventos de Visual Studio, configuración que es código |
102
+ | 🕵️ Al ejecutar el proyecto | Código oculto con espacios, caracteres invisibles o codificación, y nombres de archivo disfrazados |
103
+
104
+ <h2>🔒 Cómo se protege:</h2>
105
+
106
+ * Los archivos solo se leen. No se ejecuta, instala ni extrae nada
107
+ * Git nunca usa la configuración del repositorio analizado
108
+ * Un programa `git` plantado en la carpeta se ignora
109
+ * Los trucos con mayúsculas, enlaces, codificaciones y caracteres invisibles no esconden un archivo
110
+ * El informe no puede controlar tu terminal ni tu resumen de GitHub
111
+
112
+ <h2>⚠️ Límites:</h2>
113
+
114
+ * Nunca dice que un repositorio es seguro
115
+ * No analiza tus dependencias, archivos binarios ni código construido al ejecutarse
116
+ * Es fuerte con el código que se ejecuta solo y débil con el código malicioso dentro del programa
117
+ * De 17 ataques documentados no usados para hacer las reglas, muestra 6. De los 6 que se ejecutan solos, muestra 5
118
+ * En 39 repositorios populares no usados para ajustar las reglas, 1 tuvo un hallazgo alto, en un archivo legítimo
119
+
120
+ La medición completa, con su método y sus fallos, está en [docs/detection.md](docs/detection.md) (en inglés).
121
+
122
+ <h2>🍰 Cómo contribuir:</h2>
123
+
124
+ Se agradecen reglas nuevas, falsos positivos y formas de esconderse del analizador, en español o inglés. Mira [CONTRIBUTING.md](CONTRIBUTING.md) y [SECURITY.md](SECURITY.md).
125
+
126
+ <h2>💻 Hecho con</h2>
127
+
128
+ Tecnologías usadas en el proyecto:
129
+
130
+ * TypeScript
131
+ * Node.js
132
+ * Git
133
+ * GitHub Actions
134
+ * YAML
135
+
136
+ <h2>🛡️ Licencia:</h2>
137
+
138
+ Este proyecto usa la [licencia MIT](LICENSE). Incluye [código de terceros](THIRD-PARTY-NOTICES.md).
package/README.md CHANGED
@@ -1,3 +1,136 @@
1
- # Temporary Holding Version
1
+ <h1 align="center" id="title">BEFOREOPEN</h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center"><img src="https://socialify.git.ci/willor16/beforeopen/image?description=1&amp;descriptionEditable=See%20what%20a%20repository%20will%20run%20on%20your%20machine%20before%20you%20open%20it.&amp;font=Inter&amp;forks=1&amp;issues=1&amp;language=1&amp;name=1&amp;owner=1&amp;pattern=Circuit%20Board&amp;pulls=1&amp;stargazers=1&amp;theme=Dark" alt="project-image"></p>
4
+
5
+ <p id="description">Opening a folder can be enough to run someone else's code: editor tasks, AI agent hooks, MCP servers, install scripts or git hooks. BeforeOpen reads a repository without executing anything and shows what would run, when, and why it looks dangerous. It does not look for known malware: it maps what can be executed, so it does not depend on having seen an attack before.</p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/willor16/beforeopen"><img src="https://img.shields.io/badge/willor16%2Fbeforeopen-black?style=social&amp;logo=github" alt="repository"></a>
9
+ <a href="https://github.com/willor16/beforeopen/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/willor16/beforeopen/ci.yml?branch=main&amp;label=CI" alt="CI"></a>
10
+ <a href="https://www.npmjs.com/package/beforeopen"><img src="https://img.shields.io/npm/v/beforeopen?logo=npm" alt="npm version"></a>
11
+ <img src="https://img.shields.io/badge/runtime%20dependencies-0-brightgreen" alt="no runtime dependencies">
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
13
+ </p>
14
+
15
+ <p align="center"><a href="README.es.md">🌎 Leer en español</a></p>
16
+
17
+ <h2>📸 Project Screenshots:</h2>
18
+
19
+ <p align="center"><img src="docs/demo.svg" alt="project-screenshot" width="800"></p>
20
+
21
+ <h2>🧐 Features</h2>
22
+
23
+ Some of the project's best features:
24
+
25
+ * Scans folders, GitHub and GitLab repositories and pull requests
26
+ * Follows every command to the scripts it runs
27
+ * Warns in each pull request with a GitHub Action
28
+ * Rules in YAML that anyone can extend
29
+ * Reports in English and Spanish
30
+ * No telemetry, no account and no install scripts
31
+
32
+ <h2>🛠️ Installation Steps:</h2>
33
+
34
+ You need [Node.js](https://nodejs.org) 20 or later, and git.
35
+
36
+ <p>1. Install the command</p>
37
+
38
+ ```sh
39
+ npm install -g beforeopen
40
+ ```
41
+
42
+ <p>2. Scan a repository</p>
43
+
44
+ ```sh
45
+ beforeopen owner/repo
46
+ ```
47
+
48
+ Or use it without installing anything. Run it from outside the folder you do not trust, because `npx` reads the settings of the current folder:
49
+
50
+ ```sh
51
+ npx beforeopen owner/repo
52
+ ```
53
+
54
+ <h2>🚀 Usage:</h2>
55
+
56
+ ```sh
57
+ beforeopen owner/repo # a GitHub repository, without cloning it
58
+ beforeopen https://github.com/o/r/pull/12 # a pull request
59
+ beforeopen https://gitlab.com/group/repo # any git server
60
+ beforeopen ~/Downloads/take-home-test # a folder
61
+ beforeopen diff main feature # what a branch adds
62
+ ```
63
+
64
+ Add `--all` to see low severity findings, or `--json` for other tools. The exit code is 0 when nothing serious was found, 1 when something was, and 2 when the scan failed or was incomplete.
65
+
66
+ <h2>🤖 GitHub Action:</h2>
67
+
68
+ It reports only what a pull request adds or changes. It needs no token and no secrets.
69
+
70
+ ```yaml
71
+ # .github/workflows/beforeopen.yml
72
+ name: beforeopen
73
+ on: pull_request
74
+ permissions:
75
+ contents: read
76
+ jobs:
77
+ check:
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - uses: actions/checkout@v5
81
+ with:
82
+ fetch-depth: 2
83
+ persist-credentials: false
84
+ - uses: willor16/beforeopen@v0 # better: pin a full commit hash
85
+ ```
86
+
87
+ Use `pull_request`, never `pull_request_target`.
88
+
89
+ <h2>🔍 What it looks at:</h2>
90
+
91
+ | When | Where |
92
+ | --- | --- |
93
+ | 📝 Opening in an editor | VS Code, JetBrains, Vim, Emacs, Zed, MSBuild |
94
+ | 🤖 Opening with an AI agent | Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf, Kiro, Opencode, MCP servers, instructions with hidden text |
95
+ | 📁 Entering the folder | direnv, mise, autoenv |
96
+ | 🌿 Using git | Hooks, `.git/config`, hidden repositories, submodules, husky, lefthook, pre-commit |
97
+ | 📦 Opening in a container | Dev container commands and access to your machine |
98
+ | ⬇️ Installing | npm, pnpm, Yarn, Bun, node-gyp, pip, setup.py, Composer, CocoaPods |
99
+ | 🔨 Building or testing | Cargo, Gradle, Maven, pytest, Visual Studio events, configuration that is code |
100
+ | 🕵️ Running the project | Code hidden with spaces, invisible characters or encoding, and disguised file names |
101
+
102
+ <h2>🔒 How it stays safe:</h2>
103
+
104
+ * Files are only read. Nothing is executed, installed or checked out
105
+ * Git never uses the configuration of the repository being scanned
106
+ * A `git` program planted in the folder is ignored
107
+ * Tricks with case, links, encodings and invisible characters do not hide a file
108
+ * The report cannot control your terminal or your GitHub summary
109
+
110
+ <h2>⚠️ Limits:</h2>
111
+
112
+ * It never says that a repository is safe
113
+ * It does not analyse your dependencies, binary files or code built at run time
114
+ * It is strong with code that runs by itself and weak with malicious code inside the program
115
+ * Of 17 documented attacks not used to make the rules, it shows 6. Of the 6 that run by themselves, it shows 5
116
+ * On 39 popular repositories not used to adjust the rules, 1 had a high finding, in a legitimate file
117
+
118
+ The full measurement, with its method and its failures, is in [docs/detection.md](docs/detection.md).
119
+
120
+ <h2>🍰 Contribution Guidelines:</h2>
121
+
122
+ New rules, false positives and ways to hide from the scanner are welcome, in English or Spanish. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
123
+
124
+ <h2>💻 Built with</h2>
125
+
126
+ Technologies used in the project:
127
+
128
+ * TypeScript
129
+ * Node.js
130
+ * Git
131
+ * GitHub Actions
132
+ * YAML
133
+
134
+ <h2>🛡️ License:</h2>
135
+
136
+ This project is licensed under the [MIT License](LICENSE). It includes [third-party code](THIRD-PARTY-NOTICES.md).
@@ -0,0 +1,43 @@
1
+ # Third-party notices
2
+
3
+ The published files include code from these packages.
4
+
5
+ ## jsonc-parser 3.3.1
6
+
7
+ The MIT License (MIT)
8
+
9
+ Copyright (c) Microsoft
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ ## yaml 2.9.1
30
+
31
+ Copyright Eemeli Aro <eemeli@gmail.com>
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any purpose
34
+ with or without fee is hereby granted, provided that the above copyright notice
35
+ and this permission notice appear in all copies.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
39
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
41
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
42
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
43
+ THIS SOFTWARE.