leakkill 0.4.1__tar.gz → 0.4.2__tar.gz
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.
- {leakkill-0.4.1/src/leakkill.egg-info → leakkill-0.4.2}/PKG-INFO +1 -1
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/__init__.py +1 -1
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/guard.py +2 -2
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/scanner.py +3 -2
- {leakkill-0.4.1 → leakkill-0.4.2/src/leakkill.egg-info}/PKG-INFO +1 -1
- {leakkill-0.4.1 → leakkill-0.4.2}/tests/test_scanner.py +9 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/LICENSE +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/README.md +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/pyproject.toml +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/setup.cfg +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/__main__.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/aws.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/cli.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/providers.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill/report.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill.egg-info/SOURCES.txt +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill.egg-info/dependency_links.txt +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill.egg-info/entry_points.txt +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/src/leakkill.egg-info/top_level.txt +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/tests/test_cli.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/tests/test_guard.py +0 -0
- {leakkill-0.4.1 → leakkill-0.4.2}/tests/test_providers.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""leakkill: find leaked secrets, check if they're live, revoke them, and guard AI coding agents."""
|
|
2
|
-
__version__ = "0.4.
|
|
2
|
+
__version__ = "0.4.2"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Claude Code hook: keep secrets out of AI coding agents (prompts, file reads, shell reads, generated code)."""
|
|
2
|
-
import json, os, re, sys
|
|
2
|
+
import json, os, re, stat, sys
|
|
3
3
|
|
|
4
4
|
from .scanner import scan_text
|
|
5
5
|
|
|
@@ -92,6 +92,6 @@ def install_git_hook():
|
|
|
92
92
|
cmd = _self_cmd("scan --staged").replace("\\", "/")
|
|
93
93
|
with open(hook, "w", newline="\n") as f:
|
|
94
94
|
f.write(f'#!/bin/sh\n{cmd} || {{ echo "Commit blocked by leakkill."; exit 1; }}\n')
|
|
95
|
-
os.chmod(hook,
|
|
95
|
+
os.chmod(hook, os.stat(hook).st_mode | stat.S_IXUSR) # git only needs the owner to be able to run it
|
|
96
96
|
print("Installed", hook)
|
|
97
97
|
return 0
|
|
@@ -35,9 +35,10 @@ RULES = {
|
|
|
35
35
|
"JWT": re.compile(r"\b(eyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,})"),
|
|
36
36
|
"Credentials in URL": re.compile(r"\b([a-z][a-z0-9+]*://[^\s:/@]+:[^\s:/@]{3,}@[^\s/\"']+)"),
|
|
37
37
|
}
|
|
38
|
-
# key = "value" where the key name looks sensitive and the value looks random
|
|
38
|
+
# key = "value" where the key name looks sensitive and the value looks random.
|
|
39
|
+
# Name parts are length-bounded so matching stays linear on huge (e.g. minified) lines.
|
|
39
40
|
ASSIGN = re.compile(
|
|
40
|
-
r"""(?i)\
|
|
41
|
+
r"""(?i)(?<![\w.-])[\w.-]{0,40}?(?:secret|token|passwd|password|api[_-]?key|private[_-]?key|auth)[\w.-]{0,40}
|
|
41
42
|
\s*[:=]\s*["']([^"'\s]{12,})["']""", re.X)
|
|
42
43
|
PLACEHOLDER = re.compile(r"(?i)example|placeholder|changeme|your[_-]|xxx|<.*>|\$\{|\{\{|dummy|sample|test")
|
|
43
44
|
SKIP_DIRS = {".git", "node_modules", "venv", ".venv", "__pycache__", "dist", "build", ".idea", ".tox", ".mypy_cache"}
|
|
@@ -79,3 +79,12 @@ def test_new_providers_detected_exactly():
|
|
|
79
79
|
assert kinds(f'x = "{token}"') == [kind], (kind, kinds(f'x = "{token}"'))
|
|
80
80
|
def test_openrouter_not_reported_as_openai():
|
|
81
81
|
assert "OpenAI API key" not in kinds(NEW["OpenRouter key"])
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_huge_lines_scan_in_linear_time():
|
|
85
|
+
"""Minified bundles can have megabyte-long lines; a backtracking regex must not stall the scan."""
|
|
86
|
+
import time
|
|
87
|
+
for line in ("secret" * 100_000, 'api_key="' * 60_000, "awssecret" * 60_000):
|
|
88
|
+
t = time.perf_counter()
|
|
89
|
+
scan_line(line)
|
|
90
|
+
assert time.perf_counter() - t < 3, line[:20]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|