pushward 0.2.6__py3-none-any.whl
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.
- pushward/__init__.py +3 -0
- pushward/__main__.py +6 -0
- pushward/checks/__init__.py +0 -0
- pushward/checks/dni_pattern.py +82 -0
- pushward/checks/private_ips.py +52 -0
- pushward/checks/secrets.py +114 -0
- pushward/checks/sensitive_filenames.py +45 -0
- pushward/checks/watchlist.py +65 -0
- pushward/cli.py +174 -0
- pushward/hook.py +33 -0
- pushward/ignorefile.py +27 -0
- pushward/plugin.py +34 -0
- pushward/report.py +63 -0
- pushward/runner.py +47 -0
- pushward/scanner.py +143 -0
- pushward/watchlist_store.py +83 -0
- pushward-0.2.6.dist-info/METADATA +161 -0
- pushward-0.2.6.dist-info/RECORD +22 -0
- pushward-0.2.6.dist-info/WHEEL +5 -0
- pushward-0.2.6.dist-info/entry_points.txt +9 -0
- pushward-0.2.6.dist-info/licenses/LICENSE +21 -0
- pushward-0.2.6.dist-info/top_level.txt +1 -0
pushward/__init__.py
ADDED
pushward/__main__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pushward.plugin import CheckResult, Finding
|
|
7
|
+
from pushward.scanner import read_text
|
|
8
|
+
|
|
9
|
+
_LETTERS = "TRWAGMYFPDXBNJZSQVHLCKE"
|
|
10
|
+
_NIE_PREFIX = {"X": "0", "Y": "1", "Z": "2"}
|
|
11
|
+
|
|
12
|
+
# El lookbehind negativo excluye timestamps ISO8601 con fracción de segundo
|
|
13
|
+
# (p.ej. "...45.73846735Z"): la "Z" de UTC hace que el número parezca DNI
|
|
14
|
+
# ("8 dígitos + letra"), y con miles de líneas de log da la casualidad de que
|
|
15
|
+
# algunos hasta pasan la validación del dígito de control por puro azar.
|
|
16
|
+
# Los bordes no usan \b: el «_» cuenta como letra para \b y «nomina_12345678A.pdf» no casaba.
|
|
17
|
+
# Se admite también el formato con puntos de miles («12.345.678-A»).
|
|
18
|
+
_DNI_RE = re.compile(
|
|
19
|
+
r"(?<![\d.A-Za-z])(\d{8}|\d{1,2}\.\d{3}\.\d{3})[-\s]?([A-Za-z])(?![A-Za-z\d])"
|
|
20
|
+
)
|
|
21
|
+
_NIE_RE = re.compile(r"(?<![\d.A-Za-z])([XYZxyz])(\d{7})[-\s]?([A-Za-z])(?![A-Za-z\d])")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _expected_letter(number: str) -> str:
|
|
25
|
+
return _LETTERS[int(number) % 23]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DniPatternCheck:
|
|
29
|
+
"""Heurística de DNI/NIE español.
|
|
30
|
+
|
|
31
|
+
No basta con casar el patrón "8 dígitos + letra": ese formato aparece
|
|
32
|
+
todo el tiempo en placeholders/ejemplos inventados (p.ej. "12345678A",
|
|
33
|
+
que ni siquiera es un DNI válido -- su letra de control real es "Z").
|
|
34
|
+
Por eso se valida el dígito de control (módulo 23) antes de reportar
|
|
35
|
+
nada: reduce drásticamente los falsos positivos y solo marca strings
|
|
36
|
+
que son, con alta probabilidad, un DNI/NIE real.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
name = "dni_pattern"
|
|
40
|
+
|
|
41
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult:
|
|
42
|
+
findings: list[Finding] = []
|
|
43
|
+
scanned = 0
|
|
44
|
+
for path in files:
|
|
45
|
+
text = read_text(path)
|
|
46
|
+
if text is None:
|
|
47
|
+
continue
|
|
48
|
+
scanned += 1
|
|
49
|
+
rel = str(path.relative_to(repo_path))
|
|
50
|
+
|
|
51
|
+
for line_no, line in enumerate(text.splitlines(), start=1):
|
|
52
|
+
for m in _DNI_RE.finditer(line):
|
|
53
|
+
number, letter = m.group(1).replace(".", "").zfill(8), m.group(2).upper()
|
|
54
|
+
if letter == _expected_letter(number):
|
|
55
|
+
findings.append(
|
|
56
|
+
Finding(
|
|
57
|
+
severity="high",
|
|
58
|
+
title="Posible DNI real",
|
|
59
|
+
detail="Dígito de control válido -- no parece un valor de ejemplo.",
|
|
60
|
+
path=rel,
|
|
61
|
+
line=line_no,
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
for m in _NIE_RE.finditer(line):
|
|
65
|
+
prefix, number, letter = m.group(1).upper(), m.group(2), m.group(3).upper()
|
|
66
|
+
full_number = _NIE_PREFIX[prefix] + number
|
|
67
|
+
if letter == _expected_letter(full_number):
|
|
68
|
+
findings.append(
|
|
69
|
+
Finding(
|
|
70
|
+
severity="high",
|
|
71
|
+
title="Posible NIE real",
|
|
72
|
+
detail="Dígito de control válido -- no parece un valor de ejemplo.",
|
|
73
|
+
path=rel,
|
|
74
|
+
line=line_no,
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return CheckResult(
|
|
79
|
+
check_name=self.name,
|
|
80
|
+
summary=f"{scanned} fichero(s) analizados, {len(findings)} hallazgo(s).",
|
|
81
|
+
findings=findings,
|
|
82
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pushward.plugin import CheckResult, Finding
|
|
7
|
+
from pushward.scanner import read_text
|
|
8
|
+
|
|
9
|
+
_IP_RE = re.compile(
|
|
10
|
+
r"\b(10\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
|
11
|
+
r"|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}"
|
|
12
|
+
r"|192\.168\.\d{1,3}\.\d{1,3})\b"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PrivateIpsCheck:
|
|
17
|
+
"""IPs de rangos privados (RFC1918): 10.x, 172.16-31.x, 192.168.x."""
|
|
18
|
+
|
|
19
|
+
name = "private_ips"
|
|
20
|
+
|
|
21
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult:
|
|
22
|
+
findings: list[Finding] = []
|
|
23
|
+
scanned = 0
|
|
24
|
+
for path in files:
|
|
25
|
+
text = read_text(path)
|
|
26
|
+
if text is None:
|
|
27
|
+
continue
|
|
28
|
+
scanned += 1
|
|
29
|
+
rel = str(path.relative_to(repo_path))
|
|
30
|
+
seen_on_file: set[str] = set()
|
|
31
|
+
for line_no, line in enumerate(text.splitlines(), start=1):
|
|
32
|
+
for m in _IP_RE.finditer(line):
|
|
33
|
+
ip = m.group(0)
|
|
34
|
+
key = f"{ip}:{line_no}"
|
|
35
|
+
if key in seen_on_file:
|
|
36
|
+
continue
|
|
37
|
+
seen_on_file.add(key)
|
|
38
|
+
findings.append(
|
|
39
|
+
Finding(
|
|
40
|
+
severity="info",
|
|
41
|
+
title=f"IP privada: {ip}",
|
|
42
|
+
detail="Puede ser un ejemplo genérico o una IP real de infraestructura -- revisar.",
|
|
43
|
+
path=rel,
|
|
44
|
+
line=line_no,
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
return CheckResult(
|
|
49
|
+
check_name=self.name,
|
|
50
|
+
summary=f"{scanned} fichero(s) analizados, {len(findings)} hallazgo(s).",
|
|
51
|
+
findings=findings,
|
|
52
|
+
)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pushward.plugin import CheckResult, Finding
|
|
7
|
+
from pushward.scanner import read_text
|
|
8
|
+
|
|
9
|
+
_PATTERNS: list[tuple[str, re.Pattern[str], str]] = [
|
|
10
|
+
("Clave privada (PEM)",
|
|
11
|
+
re.compile(r"-----BEGIN (?:(?:RSA|EC|OPENSSH|DSA|ENCRYPTED|PGP) )?PRIVATE KEY(?: BLOCK)?-----"), "high"),
|
|
12
|
+
("AWS Access Key ID", re.compile(r"\b(?:AKIA|ASIA)[0-9A-Z]{16}\b"), "high"),
|
|
13
|
+
("Token de GitHub", re.compile(r"\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{60,})\b"), "high"),
|
|
14
|
+
("Token de Slack", re.compile(r"\bxox[baprse]-[A-Za-z0-9-]{10,}\b"), "high"),
|
|
15
|
+
# Las claves actuales llevan prefijo con guiones (sk-proj-…, sk-ant-api03-…): el patrón antiguo
|
|
16
|
+
# solo veía las sk-<alfanumérico> de antes.
|
|
17
|
+
("Clave de API de OpenAI/Anthropic",
|
|
18
|
+
re.compile(r"\bsk-(?:(?:proj|svcacct|admin|ant-api\d+|ant-admin\d+)-)?[A-Za-z0-9_-]{20,}"), "high"),
|
|
19
|
+
("JWT", re.compile(r"\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b"), "medium"),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
_ASSIGNMENT = re.compile(
|
|
23
|
+
r"""(?imx)
|
|
24
|
+
^\s*[{\[,]?\s*
|
|
25
|
+
# export X=… (shell), const/let/var (JS), $x = … (PowerShell/PHP/Perl), "x": … (JSON)
|
|
26
|
+
(?:(?:export|const|let|var|readonly|declare|local|my)\s+)?
|
|
27
|
+
[$@]?["']?
|
|
28
|
+
(?:
|
|
29
|
+
[\w.]*(?P<keyword>password|passwd|secret|api_key|apikey|token)["']?
|
|
30
|
+
|
|
|
31
|
+
# dict["password"] = ..., os.environ['API_TOKEN'] = ... -- la clave va
|
|
32
|
+
# entre corchetes y comillas, no como identificador suelto.
|
|
33
|
+
[\w.]*\[\s*['"]\w*(?P<keyword_bracket>password|passwd|secret|api_key|apikey|token)\w*['"]\s*\]
|
|
34
|
+
)
|
|
35
|
+
\s*
|
|
36
|
+
(?:
|
|
37
|
+
# anotación de tipo de Python ("nombre: Tipo = valor") -- sin esto, el
|
|
38
|
+
# separador esperado justo después de la palabra clave sería "str", no
|
|
39
|
+
# "=", y la asignación entera pasaba desapercibida.
|
|
40
|
+
:\s*[A-Za-z_][\w\[\], .]*\s*=
|
|
41
|
+
|
|
|
42
|
+
[:=] # asignación normal (YAML "clave: valor" / Python "clave = valor")
|
|
43
|
+
)
|
|
44
|
+
\s*
|
|
45
|
+
(?:
|
|
46
|
+
['"](?P<quoted>[^'"]{6,})['"] # valor entre comillas: literal, se acepta tal cual
|
|
47
|
+
|
|
|
48
|
+
(?P<unquoted>[^\s'"]{6,}) # sin comillas: se filtra abajo si tiene pinta de código
|
|
49
|
+
)
|
|
50
|
+
"""
|
|
51
|
+
)
|
|
52
|
+
# Un valor sin comillas que contenga estos caracteres es casi siempre una
|
|
53
|
+
# referencia a otra variable/atributo o una llamada a función
|
|
54
|
+
# (`cfg.smtp_password`, `getpass.getpass(...)`), no un secreto literal.
|
|
55
|
+
_CODE_LIKE = re.compile(r"[.()\[\]{},;]")
|
|
56
|
+
_PLACEHOLDER_VALUES = {
|
|
57
|
+
"changeme", "change_me", "your_password", "your-password", "xxxxx",
|
|
58
|
+
"placeholder", "example", "todo", "fixme", "<password>", "<secret>",
|
|
59
|
+
"your_token_here", "insert_here",
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class SecretsCheck:
|
|
64
|
+
"""Claves privadas, tokens de alta confianza (AWS/GitHub/Slack/OpenAI/JWT) y asignaciones de credenciales en claro."""
|
|
65
|
+
|
|
66
|
+
name = "secrets"
|
|
67
|
+
|
|
68
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult:
|
|
69
|
+
findings: list[Finding] = []
|
|
70
|
+
scanned = 0
|
|
71
|
+
for path in files:
|
|
72
|
+
text = read_text(path)
|
|
73
|
+
if text is None:
|
|
74
|
+
continue
|
|
75
|
+
scanned += 1
|
|
76
|
+
rel = str(path.relative_to(repo_path))
|
|
77
|
+
|
|
78
|
+
for line_no, line in enumerate(text.splitlines(), start=1):
|
|
79
|
+
for title, pattern, severity in _PATTERNS:
|
|
80
|
+
if pattern.search(line):
|
|
81
|
+
findings.append(
|
|
82
|
+
Finding(
|
|
83
|
+
severity=severity,
|
|
84
|
+
title=f"Posible secreto: {title}",
|
|
85
|
+
detail="Revisar y revocar si es real antes de publicar.",
|
|
86
|
+
path=rel,
|
|
87
|
+
line=line_no,
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
m = _ASSIGNMENT.search(line)
|
|
92
|
+
if m:
|
|
93
|
+
keyword = m.group("keyword") or m.group("keyword_bracket")
|
|
94
|
+
quoted, unquoted = m.group("quoted"), m.group("unquoted")
|
|
95
|
+
if quoted is None and _CODE_LIKE.search(unquoted):
|
|
96
|
+
value = None
|
|
97
|
+
else:
|
|
98
|
+
value = quoted if quoted is not None else unquoted
|
|
99
|
+
if value and value.lower() not in _PLACEHOLDER_VALUES and not value.startswith("{{"):
|
|
100
|
+
findings.append(
|
|
101
|
+
Finding(
|
|
102
|
+
severity="medium",
|
|
103
|
+
title=f"Asignación de credencial en claro ({keyword})",
|
|
104
|
+
detail="Heurística -- puede ser un valor de ejemplo/placeholder real.",
|
|
105
|
+
path=rel,
|
|
106
|
+
line=line_no,
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return CheckResult(
|
|
111
|
+
check_name=self.name,
|
|
112
|
+
summary=f"{scanned} fichero(s) analizados, {len(findings)} hallazgo(s).",
|
|
113
|
+
findings=findings,
|
|
114
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pushward.plugin import CheckResult, Finding
|
|
7
|
+
|
|
8
|
+
_SENSITIVE_EXTENSIONS = {".pdf", ".docx", ".doc", ".xlsx", ".xls", ".pptx", ".odt"}
|
|
9
|
+
_SENSITIVE_WORDS = re.compile(
|
|
10
|
+
r"(nomina|payroll|dni|nie|passport|pasaporte|contrato|contract"
|
|
11
|
+
r"|confidencial|confidential|salario|salary|factura|invoice"
|
|
12
|
+
r"|curriculum|cv[-_.]|expediente|historial[-_.]medico)",
|
|
13
|
+
re.IGNORECASE,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SensitiveFilenamesCheck:
|
|
18
|
+
"""Solo mira nombres de fichero, nunca abre su contenido (PDF/DOCX/etc.
|
|
19
|
+
pueden ser grandes o tener formatos binarios complejos de parsear con
|
|
20
|
+
seguridad -- el nombre ya es una señal suficientemente buena y barata).
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
name = "sensitive_filenames"
|
|
24
|
+
|
|
25
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult:
|
|
26
|
+
findings: list[Finding] = []
|
|
27
|
+
for path in files:
|
|
28
|
+
if path.suffix.lower() not in _SENSITIVE_EXTENSIONS:
|
|
29
|
+
continue
|
|
30
|
+
if _SENSITIVE_WORDS.search(path.name):
|
|
31
|
+
rel = str(path.relative_to(repo_path))
|
|
32
|
+
findings.append(
|
|
33
|
+
Finding(
|
|
34
|
+
severity="medium",
|
|
35
|
+
title="Nombre de fichero sensible",
|
|
36
|
+
detail="El nombre sugiere contenido personal/confidencial -- revisar antes de publicar.",
|
|
37
|
+
path=rel,
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return CheckResult(
|
|
42
|
+
check_name=self.name,
|
|
43
|
+
summary=f"{len(files)} fichero(s) revisados, {len(findings)} hallazgo(s).",
|
|
44
|
+
findings=findings,
|
|
45
|
+
)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from pushward import watchlist_store
|
|
6
|
+
from pushward.plugin import CheckResult, Finding
|
|
7
|
+
from pushward.scanner import read_text
|
|
8
|
+
from pushward.watchlist_store import build_pattern
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class WatchlistCheck:
|
|
12
|
+
"""El diferenciador real frente a un escáner de secretos normal: una
|
|
13
|
+
lista global (fuera del repo, en ~/.config/pushward/watchlist.txt) de
|
|
14
|
+
nombres/empresas/dominios reales que no deben aparecer en NINGÚN repo.
|
|
15
|
+
Los escáneres por regex no distinguen una IP/nombre real de un ejemplo
|
|
16
|
+
inventado -- esto sí, porque el usuario ya le dijo qué es real.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
name = "watchlist"
|
|
20
|
+
|
|
21
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult:
|
|
22
|
+
entries = watchlist_store.load_entries(watchlist_store.WATCHLIST_PATH)
|
|
23
|
+
if not entries:
|
|
24
|
+
return CheckResult(
|
|
25
|
+
check_name=self.name,
|
|
26
|
+
summary="No aplica: la watchlist está vacía (pushward watchlist add <valor>).",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
patterns = [(entry, build_pattern(entry)) for entry in entries]
|
|
30
|
+
findings: list[Finding] = []
|
|
31
|
+
scanned = 0
|
|
32
|
+
|
|
33
|
+
for path in files:
|
|
34
|
+
rel = str(path.relative_to(repo_path))
|
|
35
|
+
for entry, pattern in patterns:
|
|
36
|
+
if pattern.search(rel):
|
|
37
|
+
findings.append(
|
|
38
|
+
Finding(
|
|
39
|
+
severity="high",
|
|
40
|
+
title=f"Entrada de watchlist en la ruta (fichero o carpeta): {entry!r}",
|
|
41
|
+
path=rel,
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
text = read_text(path)
|
|
46
|
+
if text is None:
|
|
47
|
+
continue
|
|
48
|
+
scanned += 1
|
|
49
|
+
for line_no, line in enumerate(text.splitlines(), start=1):
|
|
50
|
+
for entry, pattern in patterns:
|
|
51
|
+
if pattern.search(line):
|
|
52
|
+
findings.append(
|
|
53
|
+
Finding(
|
|
54
|
+
severity="high",
|
|
55
|
+
title=f"Entrada de watchlist encontrada: {entry!r}",
|
|
56
|
+
path=rel,
|
|
57
|
+
line=line_no,
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return CheckResult(
|
|
62
|
+
check_name=self.name,
|
|
63
|
+
summary=f"{len(entries)} entrada(s) en la watchlist, {scanned} fichero(s) analizados, {len(findings)} hallazgo(s).",
|
|
64
|
+
findings=findings,
|
|
65
|
+
)
|
pushward/cli.py
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from pushward import __version__, hook, watchlist_store
|
|
9
|
+
from pushward.plugin import SEVERITIES
|
|
10
|
+
from pushward.report import build_report, write_json
|
|
11
|
+
from pushward.runner import discover_checks, run_checks
|
|
12
|
+
from pushward.scanner import ZERO_OID, ScanError, commits_to_push, materialize_commits
|
|
13
|
+
|
|
14
|
+
_SEVERITY_ORDER = {sev: idx for idx, sev in enumerate(SEVERITIES)}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _cmd_scan(args: argparse.Namespace) -> int:
|
|
18
|
+
repo_path = Path(args.path).resolve()
|
|
19
|
+
only = set(args.only) if args.only else None
|
|
20
|
+
skip = set(args.skip) if args.skip else None
|
|
21
|
+
|
|
22
|
+
results = run_checks(repo_path, staged=args.staged, only=only, skip=skip)
|
|
23
|
+
report = build_report(repo_path, results)
|
|
24
|
+
|
|
25
|
+
if args.json:
|
|
26
|
+
print(write_json(report))
|
|
27
|
+
else:
|
|
28
|
+
print(report.to_console())
|
|
29
|
+
|
|
30
|
+
# Un check que revienta deja el análisis incompleto: antes solo se avisaba y salía 0 (o 1 según
|
|
31
|
+
# --fail-on), y en un CI pasaba por verde sin haber mirado lo que ese check mira.
|
|
32
|
+
failed = [r.check_name for r in results if r.error]
|
|
33
|
+
if failed:
|
|
34
|
+
print(f"error: no se pudieron ejecutar: {', '.join(failed)} (análisis incompleto)", file=sys.stderr)
|
|
35
|
+
return 2
|
|
36
|
+
|
|
37
|
+
if args.fail_on:
|
|
38
|
+
worst = report.worst_severity()
|
|
39
|
+
if worst is not None and _SEVERITY_ORDER[worst] >= _SEVERITY_ORDER[args.fail_on]:
|
|
40
|
+
return 1
|
|
41
|
+
return 0
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _cmd_pre_push_hook(args: argparse.Namespace) -> int:
|
|
45
|
+
"""Invocado por el hook instalado. Git pasa por stdin una línea por ref
|
|
46
|
+
que se va a empujar: "<local ref> <local oid> <remote ref> <remote oid>".
|
|
47
|
+
Se escanea el contenido de cada commit que se sube, no el árbol de trabajo.
|
|
48
|
+
"""
|
|
49
|
+
repo_path = Path.cwd()
|
|
50
|
+
with tempfile.TemporaryDirectory(prefix="pushward-") as tmp:
|
|
51
|
+
root = Path(tmp)
|
|
52
|
+
files: list[Path] = []
|
|
53
|
+
for line in sys.stdin:
|
|
54
|
+
parts = line.split()
|
|
55
|
+
if len(parts) != 4:
|
|
56
|
+
continue
|
|
57
|
+
_local_ref, local_oid, _remote_ref, remote_oid = parts
|
|
58
|
+
if local_oid == ZERO_OID:
|
|
59
|
+
continue # se está borrando una rama, nada que subir
|
|
60
|
+
try:
|
|
61
|
+
commits = commits_to_push(repo_path, local_oid, remote_oid)
|
|
62
|
+
files.extend(materialize_commits(repo_path, commits, root))
|
|
63
|
+
except ScanError as exc:
|
|
64
|
+
print(f"pushward: no se pudo revisar el push, se bloquea: {exc}", file=sys.stderr)
|
|
65
|
+
return 1
|
|
66
|
+
|
|
67
|
+
if not files:
|
|
68
|
+
return 0
|
|
69
|
+
|
|
70
|
+
results = run_checks(root, files=files)
|
|
71
|
+
report = build_report(repo_path, results)
|
|
72
|
+
print(report.to_console())
|
|
73
|
+
|
|
74
|
+
if any(r.error for r in results):
|
|
75
|
+
print("pushward: algún check falló al ejecutarse; se bloquea el push.", file=sys.stderr)
|
|
76
|
+
return 1
|
|
77
|
+
worst = report.worst_severity()
|
|
78
|
+
if worst is not None and _SEVERITY_ORDER[worst] >= _SEVERITY_ORDER["high"]:
|
|
79
|
+
return 1
|
|
80
|
+
return 0
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _cmd_list_checks(args: argparse.Namespace) -> int:
|
|
84
|
+
for name, cls in sorted(discover_checks().items()):
|
|
85
|
+
doc = (cls.__doc__ or "").strip().splitlines()[0] if cls.__doc__ else ""
|
|
86
|
+
print(f"{name}: {doc}")
|
|
87
|
+
return 0
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _cmd_install_hook(args: argparse.Namespace) -> int:
|
|
91
|
+
repo_path = Path(args.path).resolve()
|
|
92
|
+
try:
|
|
93
|
+
target = hook.install(repo_path)
|
|
94
|
+
except FileExistsError as exc:
|
|
95
|
+
print(str(exc), file=sys.stderr)
|
|
96
|
+
return 1
|
|
97
|
+
print(f"Hook instalado: {target}")
|
|
98
|
+
return 0
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _cmd_uninstall_hook(args: argparse.Namespace) -> int:
|
|
102
|
+
repo_path = Path(args.path).resolve()
|
|
103
|
+
if hook.uninstall(repo_path):
|
|
104
|
+
print("Hook desinstalado.")
|
|
105
|
+
return 0
|
|
106
|
+
print("No había ningún hook de pushward instalado.")
|
|
107
|
+
return 0
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _cmd_watchlist(args: argparse.Namespace) -> int:
|
|
111
|
+
path = watchlist_store.WATCHLIST_PATH
|
|
112
|
+
if args.watchlist_action == "add":
|
|
113
|
+
watchlist_store.add_entry(args.value, path=path)
|
|
114
|
+
print(f"Añadido a la watchlist: {args.value!r}")
|
|
115
|
+
elif args.watchlist_action == "remove":
|
|
116
|
+
removed = watchlist_store.remove_entry(args.value, path=path)
|
|
117
|
+
print("Eliminado." if removed else "No estaba en la watchlist.")
|
|
118
|
+
elif args.watchlist_action == "list":
|
|
119
|
+
entries = watchlist_store.load_entries(path)
|
|
120
|
+
if not entries:
|
|
121
|
+
print("La watchlist está vacía.")
|
|
122
|
+
for entry in entries:
|
|
123
|
+
print(entry)
|
|
124
|
+
return 0
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
128
|
+
parser = argparse.ArgumentParser(prog="pushward")
|
|
129
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
130
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
131
|
+
|
|
132
|
+
p_scan = sub.add_parser("scan", help="Analiza un repo en busca de secretos/datos reales")
|
|
133
|
+
p_scan.add_argument("path", nargs="?", default=".")
|
|
134
|
+
p_scan.add_argument("--staged", action="store_true", help="Solo ficheros en stage (para el hook)")
|
|
135
|
+
p_scan.add_argument("--only", action="append", help="Ejecutar solo este check (repetible)")
|
|
136
|
+
p_scan.add_argument("--skip", action="append", help="Saltar este check (repetible)")
|
|
137
|
+
p_scan.add_argument("--json", action="store_true")
|
|
138
|
+
p_scan.add_argument("--fail-on", choices=SEVERITIES, default=None)
|
|
139
|
+
p_scan.set_defaults(func=_cmd_scan)
|
|
140
|
+
|
|
141
|
+
p_hook = sub.add_parser("pre-push-hook", help="Invocado por el hook instalado (lee refs de stdin)")
|
|
142
|
+
p_hook.set_defaults(func=_cmd_pre_push_hook)
|
|
143
|
+
|
|
144
|
+
p_list = sub.add_parser("list-checks", help="Lista los checks instalados")
|
|
145
|
+
p_list.set_defaults(func=_cmd_list_checks)
|
|
146
|
+
|
|
147
|
+
p_install = sub.add_parser("install-hook", help="Instala el hook pre-push")
|
|
148
|
+
p_install.add_argument("path", nargs="?", default=".")
|
|
149
|
+
p_install.set_defaults(func=_cmd_install_hook)
|
|
150
|
+
|
|
151
|
+
p_uninstall = sub.add_parser("uninstall-hook", help="Quita el hook pre-push")
|
|
152
|
+
p_uninstall.add_argument("path", nargs="?", default=".")
|
|
153
|
+
p_uninstall.set_defaults(func=_cmd_uninstall_hook)
|
|
154
|
+
|
|
155
|
+
p_watchlist = sub.add_parser("watchlist", help="Gestiona la watchlist global")
|
|
156
|
+
wl_sub = p_watchlist.add_subparsers(dest="watchlist_action", required=True)
|
|
157
|
+
wl_add = wl_sub.add_parser("add")
|
|
158
|
+
wl_add.add_argument("value")
|
|
159
|
+
wl_remove = wl_sub.add_parser("remove")
|
|
160
|
+
wl_remove.add_argument("value")
|
|
161
|
+
wl_sub.add_parser("list")
|
|
162
|
+
p_watchlist.set_defaults(func=_cmd_watchlist)
|
|
163
|
+
|
|
164
|
+
return parser
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def main(argv: list[str] | None = None) -> int:
|
|
168
|
+
parser = build_parser()
|
|
169
|
+
args = parser.parse_args(argv)
|
|
170
|
+
return args.func(args)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
if __name__ == "__main__":
|
|
174
|
+
sys.exit(main())
|
pushward/hook.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
_HOOK_MARKER = "# installed-by: pushward"
|
|
6
|
+
_HOOK_TEMPLATE = f"""#!/bin/sh
|
|
7
|
+
{_HOOK_MARKER}
|
|
8
|
+
pushward pre-push-hook
|
|
9
|
+
exit $?
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def hooks_dir(repo_path: Path) -> Path:
|
|
14
|
+
return repo_path / ".git" / "hooks"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def install(repo_path: Path) -> Path:
|
|
18
|
+
target = hooks_dir(repo_path) / "pre-push"
|
|
19
|
+
if target.exists() and _HOOK_MARKER not in target.read_text(encoding="utf-8"):
|
|
20
|
+
raise FileExistsError(
|
|
21
|
+
f"{target} ya existe y no fue instalado por pushward -- no lo voy a sobreescribir."
|
|
22
|
+
)
|
|
23
|
+
target.write_text(_HOOK_TEMPLATE, encoding="utf-8")
|
|
24
|
+
target.chmod(0o755)
|
|
25
|
+
return target
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def uninstall(repo_path: Path) -> bool:
|
|
29
|
+
target = hooks_dir(repo_path) / "pre-push"
|
|
30
|
+
if not target.exists() or _HOOK_MARKER not in target.read_text(encoding="utf-8"):
|
|
31
|
+
return False
|
|
32
|
+
target.unlink()
|
|
33
|
+
return True
|
pushward/ignorefile.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import fnmatch
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
IGNORE_FILENAME = ".pushwardignore"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def load_patterns(repo_path: Path) -> list[str]:
|
|
10
|
+
"""Patrones estilo .gitignore para excluir del escaneo por completo --
|
|
11
|
+
pensado para los propios fixtures de test de una herramienta de seguridad,
|
|
12
|
+
que a propósito parecen secretos/DNI reales para poder probar los checks.
|
|
13
|
+
"""
|
|
14
|
+
ignore_file = repo_path / IGNORE_FILENAME
|
|
15
|
+
if not ignore_file.exists():
|
|
16
|
+
return []
|
|
17
|
+
patterns = []
|
|
18
|
+
for line in ignore_file.read_text(encoding="utf-8").splitlines():
|
|
19
|
+
line = line.strip()
|
|
20
|
+
if not line or line.startswith("#"):
|
|
21
|
+
continue
|
|
22
|
+
patterns.append(line)
|
|
23
|
+
return patterns
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def is_ignored(relpath: str, patterns: list[str]) -> bool:
|
|
27
|
+
return any(fnmatch.fnmatch(relpath, pattern) for pattern in patterns)
|
pushward/plugin.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Protocol
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
Severity = str
|
|
9
|
+
SEVERITIES: tuple[Severity, ...] = ("info", "low", "medium", "high")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Finding(BaseModel):
|
|
13
|
+
severity: Severity
|
|
14
|
+
title: str
|
|
15
|
+
detail: str = ""
|
|
16
|
+
path: str | None = None
|
|
17
|
+
line: int | None = None
|
|
18
|
+
|
|
19
|
+
def model_post_init(self, context: object, /) -> None:
|
|
20
|
+
if self.severity not in SEVERITIES:
|
|
21
|
+
raise ValueError(f"severity {self.severity!r} no es una de {SEVERITIES}")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CheckResult(BaseModel):
|
|
25
|
+
check_name: str
|
|
26
|
+
summary: str
|
|
27
|
+
findings: list[Finding] = Field(default_factory=list)
|
|
28
|
+
error: str | None = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Check(Protocol):
|
|
32
|
+
name: str
|
|
33
|
+
|
|
34
|
+
def run(self, files: list[Path], repo_path: Path) -> CheckResult: ...
|
pushward/report.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
|
|
8
|
+
from pushward.plugin import SEVERITIES, CheckResult, Finding
|
|
9
|
+
|
|
10
|
+
_SEVERITY_ORDER = {sev: idx for idx, sev in enumerate(SEVERITIES)}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Report(BaseModel):
|
|
14
|
+
repo_path: str
|
|
15
|
+
results: list[CheckResult]
|
|
16
|
+
|
|
17
|
+
def all_findings(self) -> list[tuple[str, Finding]]:
|
|
18
|
+
return [(r.check_name, f) for r in self.results for f in r.findings]
|
|
19
|
+
|
|
20
|
+
def worst_severity(self) -> str | None:
|
|
21
|
+
sevs = [f.severity for _, f in self.all_findings()]
|
|
22
|
+
if not sevs:
|
|
23
|
+
return None
|
|
24
|
+
return max(sevs, key=lambda s: _SEVERITY_ORDER[s])
|
|
25
|
+
|
|
26
|
+
def to_json(self) -> str:
|
|
27
|
+
return self.model_dump_json(indent=2)
|
|
28
|
+
|
|
29
|
+
def to_console(self) -> str:
|
|
30
|
+
lines = [f"pushward — {self.repo_path}", ""]
|
|
31
|
+
for result in self.results:
|
|
32
|
+
lines.append(f"── {result.check_name} " + "─" * max(0, 40 - len(result.check_name)))
|
|
33
|
+
if result.error:
|
|
34
|
+
lines.append(f" ERROR: {result.summary}")
|
|
35
|
+
lines.append("")
|
|
36
|
+
continue
|
|
37
|
+
lines.append(f" {result.summary}")
|
|
38
|
+
for f in result.findings:
|
|
39
|
+
loc = f" ({f.path}" + (f":{f.line}" if f.line else "") + ")" if f.path else ""
|
|
40
|
+
label = f"[{f.severity.upper():<6}]"
|
|
41
|
+
lines.append(f" {label} {f.title}{loc}")
|
|
42
|
+
if f.detail:
|
|
43
|
+
lines.append(f" {f.detail}")
|
|
44
|
+
lines.append("")
|
|
45
|
+
|
|
46
|
+
total = len(self.all_findings())
|
|
47
|
+
by_sev: dict[str, int] = {}
|
|
48
|
+
for _, f in self.all_findings():
|
|
49
|
+
by_sev[f.severity] = by_sev.get(f.severity, 0) + 1
|
|
50
|
+
parts = [f"{by_sev[s]} {s}" for s in reversed(SEVERITIES) if s in by_sev]
|
|
51
|
+
summary = f"Total: {total} hallazgo(s)"
|
|
52
|
+
if parts:
|
|
53
|
+
summary += " — " + ", ".join(parts)
|
|
54
|
+
lines.append(summary)
|
|
55
|
+
return "\n".join(lines)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def build_report(repo_path: Path, results: list[CheckResult]) -> Report:
|
|
59
|
+
return Report(repo_path=str(repo_path), results=results)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def write_json(report: Report) -> str:
|
|
63
|
+
return json.dumps(json.loads(report.to_json()), ensure_ascii=False, indent=2)
|
pushward/runner.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import traceback
|
|
4
|
+
from importlib.metadata import entry_points
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from pushward.plugin import Check, CheckResult
|
|
8
|
+
from pushward.scanner import list_files
|
|
9
|
+
|
|
10
|
+
ENTRY_POINT_GROUP = "pushward.checks"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def discover_checks() -> dict[str, type[Check]]:
|
|
14
|
+
found: dict[str, type[Check]] = {}
|
|
15
|
+
for ep in entry_points(group=ENTRY_POINT_GROUP):
|
|
16
|
+
found[ep.name] = ep.load()
|
|
17
|
+
return found
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def run_checks(
|
|
21
|
+
repo_path: Path,
|
|
22
|
+
*,
|
|
23
|
+
staged: bool = False,
|
|
24
|
+
files: list[Path] | None = None,
|
|
25
|
+
only: set[str] | None = None,
|
|
26
|
+
skip: set[str] | None = None,
|
|
27
|
+
) -> list[CheckResult]:
|
|
28
|
+
checks = discover_checks()
|
|
29
|
+
names = set(checks) if only is None else (set(checks) & only)
|
|
30
|
+
if skip:
|
|
31
|
+
names -= skip
|
|
32
|
+
|
|
33
|
+
if files is None:
|
|
34
|
+
files = list_files(repo_path, staged=staged)
|
|
35
|
+
|
|
36
|
+
results = []
|
|
37
|
+
for name in sorted(names):
|
|
38
|
+
try:
|
|
39
|
+
result = checks[name]().run(files, repo_path)
|
|
40
|
+
except Exception as exc: # noqa: BLE001 -- aislar un check roto del resto de la ejecución
|
|
41
|
+
result = CheckResult(
|
|
42
|
+
check_name=name,
|
|
43
|
+
summary=f"El check falló al ejecutarse: {exc}",
|
|
44
|
+
error=traceback.format_exc(),
|
|
45
|
+
)
|
|
46
|
+
results.append(result)
|
|
47
|
+
return results
|
pushward/scanner.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pushward.ignorefile import is_ignored, load_patterns
|
|
7
|
+
|
|
8
|
+
# Árbol vacío de git -- objeto especial ya presente en cualquier repo, útil
|
|
9
|
+
# para diffear "todo lo que hay en <commit>" cuando no existe un punto de
|
|
10
|
+
# partida real (primer push de una rama nueva).
|
|
11
|
+
EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
12
|
+
ZERO_OID = "0" * 40
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _git_name_only(repo_path: Path, cmd: list[str]) -> list[Path]:
|
|
16
|
+
result = subprocess.run(cmd, cwd=repo_path, capture_output=True, text=True, check=False)
|
|
17
|
+
if result.returncode != 0:
|
|
18
|
+
return []
|
|
19
|
+
patterns = load_patterns(repo_path)
|
|
20
|
+
return [
|
|
21
|
+
repo_path / line
|
|
22
|
+
for line in result.stdout.splitlines()
|
|
23
|
+
if line and not is_ignored(line, patterns)
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def list_files(repo_path: Path, *, staged: bool = False) -> list[Path]:
|
|
28
|
+
"""Ficheros a escanear: `git ls-files` (todo el árbol) o el diff en stage."""
|
|
29
|
+
if staged:
|
|
30
|
+
cmd = ["git", "-c", "core.quotePath=false", "diff", "--cached", "--name-only", "--diff-filter=ACM"]
|
|
31
|
+
else:
|
|
32
|
+
cmd = ["git", "-c", "core.quotePath=false", "ls-files"]
|
|
33
|
+
return _git_name_only(repo_path, cmd)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def diff_files(repo_path: Path, range_arg: str) -> list[Path]:
|
|
37
|
+
"""Ficheros tocados en un rango de commits, p.ej. "<remote_oid>..<local_oid>"
|
|
38
|
+
-- lo que de verdad se necesita en un hook pre-push, donde el stage ya
|
|
39
|
+
está vacío (el commit ya se hizo) y `list_files(staged=True)` no vería nada.
|
|
40
|
+
"""
|
|
41
|
+
cmd = ["git", "-c", "core.quotePath=false", "diff", "--name-only", "--diff-filter=ACM", range_arg]
|
|
42
|
+
return _git_name_only(repo_path, cmd)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ScanError(RuntimeError):
|
|
46
|
+
"""No se pudo saber qué se va a subir: el hook no debe dejar pasar el push a ciegas."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _git(repo_path: Path, *args: str) -> subprocess.CompletedProcess[str]:
|
|
50
|
+
return subprocess.run(["git", *args], cwd=repo_path, capture_output=True, text=True, check=False)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _object_exists(repo_path: Path, oid: str) -> bool:
|
|
54
|
+
return _git(repo_path, "cat-file", "-e", f"{oid}^{{commit}}").returncode == 0
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def commits_to_push(repo_path: Path, local_oid: str, remote_oid: str) -> list[str]:
|
|
58
|
+
"""Commits que el push va a subir.
|
|
59
|
+
|
|
60
|
+
Con el remoto conocido, `remote..local`. En una rama nueva, o si el remoto tiene un commit que
|
|
61
|
+
aquí no está (otro empujó y ahora se hace `push --force`), los que no están ya en ningún remoto
|
|
62
|
+
conocido. Antes, en este último caso, `git diff` fallaba, se tomaba como «nada que revisar» y el
|
|
63
|
+
push pasaba sin escanear.
|
|
64
|
+
"""
|
|
65
|
+
if remote_oid != ZERO_OID and _object_exists(repo_path, remote_oid):
|
|
66
|
+
args = ["rev-list", f"{remote_oid}..{local_oid}"]
|
|
67
|
+
else:
|
|
68
|
+
args = ["rev-list", local_oid, "--not", "--remotes"]
|
|
69
|
+
result = _git(repo_path, *args)
|
|
70
|
+
if result.returncode != 0:
|
|
71
|
+
raise ScanError(f"git {' '.join(args)} falló: {result.stderr.strip()}")
|
|
72
|
+
return result.stdout.split()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _cat_blobs(repo_path: Path, oids: list[str]) -> dict[str, bytes]:
|
|
76
|
+
if not oids:
|
|
77
|
+
return {}
|
|
78
|
+
proc = subprocess.run(
|
|
79
|
+
["git", "cat-file", "--batch"], cwd=repo_path, input="\n".join(oids).encode() + b"\n",
|
|
80
|
+
capture_output=True, check=False,
|
|
81
|
+
)
|
|
82
|
+
if proc.returncode != 0:
|
|
83
|
+
raise ScanError(f"git cat-file falló: {proc.stderr.decode(errors='replace').strip()}")
|
|
84
|
+
out, pos, blobs = proc.stdout, 0, {}
|
|
85
|
+
for oid in oids:
|
|
86
|
+
nl = out.index(b"\n", pos)
|
|
87
|
+
header = out[pos:nl].split()
|
|
88
|
+
if len(header) != 3:
|
|
89
|
+
raise ScanError(f"Objeto {oid} ilegible: {out[pos:nl].decode(errors='replace')}")
|
|
90
|
+
size = int(header[2])
|
|
91
|
+
blobs[oid] = out[nl + 1:nl + 1 + size]
|
|
92
|
+
pos = nl + 1 + size + 1
|
|
93
|
+
return blobs
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def materialize_commits(repo_path: Path, commits: list[str], dest: Path) -> list[Path]:
|
|
97
|
+
"""Copia en `dest/<commit>/<ruta>` cada versión de fichero añadida o modificada en `commits`.
|
|
98
|
+
|
|
99
|
+
El hook leía los ficheros del árbol de trabajo: un secreto subido en un commit y borrado en el
|
|
100
|
+
siguiente, o ya quitado del árbol sin commitear, pasaba sin verse aunque sí viajaba en el push.
|
|
101
|
+
"""
|
|
102
|
+
patterns = load_patterns(repo_path)
|
|
103
|
+
wanted: list[tuple[str, str, str]] = []
|
|
104
|
+
seen: set[str] = set()
|
|
105
|
+
for commit in commits:
|
|
106
|
+
result = _git(repo_path, "diff-tree", "-r", "-m", "--root", "--no-commit-id",
|
|
107
|
+
"--diff-filter=AM", "-z", commit)
|
|
108
|
+
if result.returncode != 0:
|
|
109
|
+
raise ScanError(f"git diff-tree {commit} falló: {result.stderr.strip()}")
|
|
110
|
+
parts = result.stdout.split("\0")
|
|
111
|
+
for meta, path in zip(parts[0::2], parts[1::2], strict=False):
|
|
112
|
+
fields = meta.split()
|
|
113
|
+
if len(fields) < 5 or fields[1].startswith("160000"): # submódulo: no es un fichero
|
|
114
|
+
continue
|
|
115
|
+
oid = fields[3]
|
|
116
|
+
if oid in seen or is_ignored(path, patterns):
|
|
117
|
+
continue
|
|
118
|
+
seen.add(oid)
|
|
119
|
+
wanted.append((commit, path, oid))
|
|
120
|
+
|
|
121
|
+
blobs = _cat_blobs(repo_path, [oid for _, _, oid in wanted])
|
|
122
|
+
files = []
|
|
123
|
+
for commit, path, oid in wanted:
|
|
124
|
+
target = dest / commit[:12] / path
|
|
125
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
126
|
+
target.write_bytes(blobs[oid])
|
|
127
|
+
files.append(target)
|
|
128
|
+
return files
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def read_text(path: Path) -> str | None:
|
|
132
|
+
"""Lee un fichero como texto; None si no existe o es binario.
|
|
133
|
+
|
|
134
|
+
Un fichero que no es UTF-8 (un .env guardado en Latin-1) se leía como binario y se saltaba
|
|
135
|
+
entero; ahora solo se descartan los que tienen bytes nulos.
|
|
136
|
+
"""
|
|
137
|
+
try:
|
|
138
|
+
raw = path.read_bytes()
|
|
139
|
+
except OSError:
|
|
140
|
+
return None
|
|
141
|
+
if b"\0" in raw[:8192]:
|
|
142
|
+
return None
|
|
143
|
+
return raw.decode("utf-8", errors="replace")
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
import unicodedata
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
WATCHLIST_PATH = Path.home() / ".config" / "pushward" / "watchlist.txt"
|
|
9
|
+
|
|
10
|
+
_SEPARATOR_RE = re.compile(r"[\s._-]+")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def load_entries(path: Path = WATCHLIST_PATH) -> list[str]:
|
|
14
|
+
if not path.exists():
|
|
15
|
+
return []
|
|
16
|
+
entries = []
|
|
17
|
+
for line in path.read_text(encoding="utf-8").splitlines():
|
|
18
|
+
line = line.strip()
|
|
19
|
+
if not line or line.startswith("#"):
|
|
20
|
+
continue
|
|
21
|
+
entries.append(line)
|
|
22
|
+
return entries
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _write(path: Path, text: str) -> None:
|
|
26
|
+
# La watchlist guarda justo lo que no debe salir a ningún sitio (nombres, DNI, teléfonos):
|
|
27
|
+
# solo legible por su dueño, aunque la umask del sistema sea 022.
|
|
28
|
+
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
29
|
+
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
|
|
30
|
+
with os.fdopen(fd, "w", encoding="utf-8") as f:
|
|
31
|
+
f.write(text)
|
|
32
|
+
os.chmod(path, 0o600)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def add_entry(value: str, path: Path = WATCHLIST_PATH) -> None:
|
|
36
|
+
value = value.strip()
|
|
37
|
+
if not value or value in load_entries(path):
|
|
38
|
+
return
|
|
39
|
+
current = path.read_text(encoding="utf-8") if path.exists() else ""
|
|
40
|
+
if current and not current.endswith("\n"):
|
|
41
|
+
current += "\n" # sin esto la entrada nueva se pegaba a la última línea
|
|
42
|
+
_write(path, current + value + "\n")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def remove_entry(value: str, path: Path = WATCHLIST_PATH) -> bool:
|
|
46
|
+
value = value.strip()
|
|
47
|
+
if value not in load_entries(path):
|
|
48
|
+
return False
|
|
49
|
+
# Se quitan solo las líneas de esa entrada: los comentarios y el resto se conservan.
|
|
50
|
+
lines = path.read_text(encoding="utf-8").splitlines()
|
|
51
|
+
remaining = [line for line in lines if line.strip() != value]
|
|
52
|
+
_write(path, "\n".join(remaining) + ("\n" if remaining else ""))
|
|
53
|
+
return True
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def fold(text: str) -> str:
|
|
57
|
+
"""Sin tildes ni diacríticos: «Gómez» y «gomez», «Muñoz» y «munoz» son lo mismo."""
|
|
58
|
+
return "".join(c for c in unicodedata.normalize("NFKD", text) if not unicodedata.combining(c))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class WatchPattern:
|
|
62
|
+
"""Patrón que compara sin tildes: un nombre se escribe a menudo sin ellas (correos, usuarios,
|
|
63
|
+
nombres de fichero) y «Laura Gómez» no casaba con «laura.gomez»."""
|
|
64
|
+
|
|
65
|
+
def __init__(self, regex: re.Pattern[str]) -> None:
|
|
66
|
+
self._regex = regex
|
|
67
|
+
|
|
68
|
+
def search(self, text: str) -> re.Match[str] | None:
|
|
69
|
+
return self._regex.search(fold(text))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def build_pattern(entry: str) -> WatchPattern:
|
|
73
|
+
"""Casa variantes de separador (punto/guion/guion_bajo/espacio/sin separador),
|
|
74
|
+
insensible a mayúsculas -- la misma clase de miss que dejó pasar
|
|
75
|
+
"Ruben.Blanco" en una primera pasada case-sensitive de sustitución real.
|
|
76
|
+
"""
|
|
77
|
+
tokens = [t for t in _SEPARATOR_RE.split(fold(entry).strip()) if t]
|
|
78
|
+
if not tokens:
|
|
79
|
+
return WatchPattern(re.compile(r"(?!x)x")) # nunca casa
|
|
80
|
+
inner = r"[\s._-]*".join(re.escape(t) for t in tokens)
|
|
81
|
+
# \b solo funciona junto a una letra o un dígito: una entrada que empieza por «+» (un
|
|
82
|
+
# teléfono) o acaba en «,» no casaba nunca. Se exige que no haya letra ni dígito al lado.
|
|
83
|
+
return WatchPattern(re.compile(rf"(?<![^\W_]){inner}(?![^\W_])", re.IGNORECASE))
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pushward
|
|
3
|
+
Version: 0.2.6
|
|
4
|
+
Summary: Escáner pre-commit/pre-push de secretos y datos reales (IPs, nombres, entidades) antes de que lleguen a un repo — arquitectura de plugins.
|
|
5
|
+
Author: José Luis Segura Yuste
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jl-segurayuste/pushward
|
|
8
|
+
Project-URL: Source, https://github.com/jl-segurayuste/pushward
|
|
9
|
+
Project-URL: Issues, https://github.com/jl-segurayuste/pushward/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/jl-segurayuste/pushward/releases
|
|
11
|
+
Keywords: git-hooks,security
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Natural Language :: Spanish
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Topic :: Security
|
|
24
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pydantic>=2.6
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff==0.17.6; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# pushward
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/pushward/)
|
|
38
|
+
[](https://github.com/jl-segurayuste/pushward/actions/workflows/ci.yml)
|
|
39
|
+
[](https://github.com/jl-segurayuste/pushward/blob/main/pyproject.toml)
|
|
40
|
+
[](https://github.com/jl-segurayuste/pushward/blob/main/LICENSE)
|
|
41
|
+
|
|
42
|
+
Escáner de secretos y datos reales antes de que lleguen a un repositorio —
|
|
43
|
+
pensado para engancharse como hook `pre-push`, no solo como auditoría puntual.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
$ pushward scan .
|
|
47
|
+
|
|
48
|
+
pushward — /ruta/al/repo
|
|
49
|
+
|
|
50
|
+
── secrets ──────────────────────────────
|
|
51
|
+
40 fichero(s) analizados, 1 hallazgo(s).
|
|
52
|
+
[HIGH ] Posible secreto: Clave privada (PEM) (deploy/id_rsa:1)
|
|
53
|
+
Revisar y revocar si es real antes de publicar.
|
|
54
|
+
|
|
55
|
+
── watchlist ────────────────────────────
|
|
56
|
+
3 entrada(s) en la watchlist, 40 fichero(s) analizados, 1 hallazgo(s).
|
|
57
|
+
[HIGH ] Entrada de watchlist encontrada: 'AcmeCorp' (docs/notas.md:12)
|
|
58
|
+
|
|
59
|
+
Total: 2 hallazgo(s) — 2 high
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Así se ve
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
<sub>Ejecución real sobre un repo de ejemplo con un DNI, una clave de AWS, una IP interna, un nombre de la watchlist y un PDF de nóminas (todos los datos son ficticios).</sub>
|
|
67
|
+
|
|
68
|
+
## Por qué existe
|
|
69
|
+
|
|
70
|
+
Los escáneres de secretos habituales (git-secrets, gitleaks...) casan patrones:
|
|
71
|
+
claves con forma de clave, tokens con forma de token. Pero la fuga más
|
|
72
|
+
frecuente en la práctica no tiene "forma" reconocible por regex — es una IP
|
|
73
|
+
interna real, el nombre de un cliente, el de un empleado, o un DNI de verdad
|
|
74
|
+
colado como "ejemplo". Ningún escáner por patrones puede distinguir eso de un
|
|
75
|
+
valor inventado, porque no sabe qué es real. `pushward` sí puede, porque tú se
|
|
76
|
+
lo dices una vez (la `watchlist`) y lo comprueba en todos tus repos, para
|
|
77
|
+
siempre.
|
|
78
|
+
|
|
79
|
+
## Instalación
|
|
80
|
+
|
|
81
|
+
Todavía no está en PyPI:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pipx install pushward # recomendado para herramientas de línea de comandos
|
|
85
|
+
# o bien
|
|
86
|
+
pip install pushward
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Uso
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pushward scan . # informe en consola
|
|
93
|
+
pushward scan . --staged # solo lo que hay en stage (usado por el hook)
|
|
94
|
+
pushward scan . --json
|
|
95
|
+
pushward scan . --fail-on high # código de salida 1 si hay algo "high"
|
|
96
|
+
# código 2 si algún check no se pudo ejecutar (análisis incompleto)
|
|
97
|
+
pushward list-checks
|
|
98
|
+
|
|
99
|
+
pushward install-hook . # instala un hook pre-push en este repo
|
|
100
|
+
pushward uninstall-hook .
|
|
101
|
+
|
|
102
|
+
pushward watchlist add "Nombre Real" # nunca se commitea: vive en ~/.config/pushward/
|
|
103
|
+
pushward watchlist list
|
|
104
|
+
pushward watchlist remove "Nombre Real"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
El hook `pre-push` revisa **el contenido de cada commit que se sube**, no el árbol de trabajo:
|
|
108
|
+
un secreto añadido en un commit y quitado en el siguiente también se ve (viaja en el historial).
|
|
109
|
+
Bloquea el push si hay algo `high`, si un check falla al ejecutarse o si no puede saber qué se va
|
|
110
|
+
a subir (por ejemplo, un `push --force` sobre un remoto con commits que no tienes: entonces revisa
|
|
111
|
+
todo lo que no esté ya en ningún remoto conocido).
|
|
112
|
+
|
|
113
|
+
## Checks incluidos
|
|
114
|
+
|
|
115
|
+
| Check | Qué detecta |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `secrets` | Claves privadas (también cifradas y PGP), tokens AWS/GitHub/Slack/OpenAI/Anthropic, JWT, asignaciones de credenciales en claro (Python, YAML, `.env`, `export`, JS, PowerShell, JSON) |
|
|
118
|
+
| `private_ips` | IPs de rangos privados (10.x, 172.16-31.x, 192.168.x) |
|
|
119
|
+
| `watchlist` | Nombres/empresas/dominios reales que tú has marcado como "nunca en un repo" |
|
|
120
|
+
| `dni_pattern` | DNI/NIE español con dígito de control válido (no marca placeholders tipo `12345678A`) |
|
|
121
|
+
| `sensitive_filenames` | Nombres de fichero (PDF/DOCX/XLSX) que sugieren contenido personal, sin abrir el contenido |
|
|
122
|
+
|
|
123
|
+
Ninguno ejecuta el código del repo analizado. Cada check es un plugin
|
|
124
|
+
independiente (`importlib.metadata.entry_points`, grupo `pushward.checks`) —
|
|
125
|
+
añadir uno nuevo no toca el núcleo.
|
|
126
|
+
|
|
127
|
+
## La watchlist
|
|
128
|
+
|
|
129
|
+
Vive fuera de cualquier repo, en `~/.config/pushward/watchlist.txt` —
|
|
130
|
+
justo porque el propio fichero contendría los nombres que quieres proteger,
|
|
131
|
+
así que no tiene sentido que viva dentro de un repo que podrías publicar.
|
|
132
|
+
Casa variantes de mayúsculas y separador (`Ruben.Blanco` == `ruben_blanco` ==
|
|
133
|
+
`RubenBlanco`) y sin tener en cuenta las tildes (`Laura Gómez` == `laura.gomez`),
|
|
134
|
+
con límites de palabra para no marcar falsos positivos como "AcmeCorp" dentro
|
|
135
|
+
de "consumo".
|
|
136
|
+
|
|
137
|
+
## Excluir ficheros del escaneo (.pushwardignore)
|
|
138
|
+
|
|
139
|
+
Una herramienta de seguridad necesariamente tiene, en sus propios tests,
|
|
140
|
+
fixtures que *parecen* secretos/DNI reales a propósito (para poder probar
|
|
141
|
+
que los detecta). Un `.pushwardignore` en la raíz del repo (una ruta o
|
|
142
|
+
patrón por línea, comentarios con `#`) excluye esos ficheros del escaneo
|
|
143
|
+
por completo:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
tests/test_secrets.py
|
|
147
|
+
tests/test_dni_pattern.py
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Úsalo para excepciones concretas y documentadas, no como atajo para ignorar
|
|
151
|
+
avisos reales.
|
|
152
|
+
|
|
153
|
+
## Desarrollo
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pip install -e ".[dev]"
|
|
157
|
+
ruff check .
|
|
158
|
+
pytest
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Ver [CONTRIBUTING.md](CONTRIBUTING.md) para añadir un check nuevo.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pushward/__init__.py,sha256=mCxUU9ZOmOV78Vbpa_5cK5I51PUUQs5jBCBJ1IFVFXc,97
|
|
2
|
+
pushward/__main__.py,sha256=vA2XdNRT_NnwaUusb5scF2qaGJq0b9Vo6nwCCWmBftQ,91
|
|
3
|
+
pushward/cli.py,sha256=BZlOJhiky4GOfb9_GV5os748mYZzjbA0kBFq5KW9Emo,6612
|
|
4
|
+
pushward/hook.py,sha256=B_pG2CtQFcJiFqUGaOMFbCa6Kw6gGySLn0k1Xi9jwjU,904
|
|
5
|
+
pushward/ignorefile.py,sha256=glYt5oaXaeGMD7hO4fNJebJPCDnzfbJ8FyVvS_wGaAo,869
|
|
6
|
+
pushward/plugin.py,sha256=WtBxuJ9Fa6dmFCvPmYjXMU47K1t4L3xv_Xc7P6vt4B4,816
|
|
7
|
+
pushward/report.py,sha256=VYYTaH8RBL4L2UyRXCBRyaxj1piA7yB9sNqsYAZCVac,2217
|
|
8
|
+
pushward/runner.py,sha256=3rCGgDNXvR_5XQ0twmQ2y6aHjNGUMMuHqRMzNAxzgNA,1315
|
|
9
|
+
pushward/scanner.py,sha256=uy3iZGhE7PnlKF3RJQ0FcTldgGdWiAdlcBxXZX82Ba0,5769
|
|
10
|
+
pushward/watchlist_store.py,sha256=A-QvvjCJ6Ldmkc2REcmDr5_k9Tsgl2svTbKr2VJ2YWc,3236
|
|
11
|
+
pushward/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
pushward/checks/dni_pattern.py,sha256=bnw6tzZRUiNrqfEgJeQxNiYULUi5PBx4dtdRVy0dy6Q,3448
|
|
13
|
+
pushward/checks/private_ips.py,sha256=y1UGERJH7paFXjZdfqd4GSNzNhrSB8lCg4QB-ONhuE0,1723
|
|
14
|
+
pushward/checks/secrets.py,sha256=4oNkYjbwuGAUH9P0C3BDc0rmAlwRNNddSX0jk9aFxz0,5001
|
|
15
|
+
pushward/checks/sensitive_filenames.py,sha256=LTTxgOSPwlpHSwczy74YQX7Z3yW6GXXFBlsTNP8PY9s,1630
|
|
16
|
+
pushward/checks/watchlist.py,sha256=4ipAk6S-EcGrGg4LfWzrBgOva4KSULYbb_vlGCMcziE,2484
|
|
17
|
+
pushward-0.2.6.dist-info/licenses/LICENSE,sha256=70acRqGbi12E-RBHctB4yHLzZOoCFayZUXlhAUvwaAM,1080
|
|
18
|
+
pushward-0.2.6.dist-info/METADATA,sha256=OurDcNp_PItvDBJ89d89Np7AO_P1-sSKmfHtosQ9dmY,6974
|
|
19
|
+
pushward-0.2.6.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
20
|
+
pushward-0.2.6.dist-info/entry_points.txt,sha256=Q7GxYYt2GkNyeWWj_9_kThP89Gtqcv6bEeR3EyXCWK8,364
|
|
21
|
+
pushward-0.2.6.dist-info/top_level.txt,sha256=0jIhxTaOTyaOEE5r6aieEwBqQ-njmSeOwa__h1YQOHY,9
|
|
22
|
+
pushward-0.2.6.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
pushward = pushward.cli:main
|
|
3
|
+
|
|
4
|
+
[pushward.checks]
|
|
5
|
+
dni_pattern = pushward.checks.dni_pattern:DniPatternCheck
|
|
6
|
+
private_ips = pushward.checks.private_ips:PrivateIpsCheck
|
|
7
|
+
secrets = pushward.checks.secrets:SecretsCheck
|
|
8
|
+
sensitive_filenames = pushward.checks.sensitive_filenames:SensitiveFilenamesCheck
|
|
9
|
+
watchlist = pushward.checks.watchlist:WatchlistCheck
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 José Luis Segura Yuste
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pushward
|