codebread 1.0.1__tar.gz → 1.0.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.
- {codebread-1.0.1 → codebread-1.0.2}/PKG-INFO +2 -2
- {codebread-1.0.1 → codebread-1.0.2}/README.md +1 -1
- {codebread-1.0.1 → codebread-1.0.2}/codebread/__init__.py +1 -1
- {codebread-1.0.1 → codebread-1.0.2}/codebread/analyzer.py +5 -1
- {codebread-1.0.1 → codebread-1.0.2}/codebread/parsers/generic_parser.py +14 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/server.py +12 -3
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/PKG-INFO +2 -2
- {codebread-1.0.1 → codebread-1.0.2}/pyproject.toml +1 -1
- {codebread-1.0.1 → codebread-1.0.2}/LICENSE +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/classifier.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/cli.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/connections.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/diff.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/export.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/languages.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/models.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/parsers/__init__.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/parsers/javascript_parser.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/parsers/python_parser.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/scanner.py +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/web/app.js +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/web/index.html +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread/web/style.css +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/SOURCES.txt +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/dependency_links.txt +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/entry_points.txt +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/requires.txt +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/codebread.egg-info/top_level.txt +0 -0
- {codebread-1.0.1 → codebread-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebread
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together.
|
|
5
5
|
Author: Danial Irsyad
|
|
6
6
|
License: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
|
-
<img alt="version" src="https://img.shields.io/badge/version-1.0.
|
|
25
|
+
<img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
|
|
26
26
|
<img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
|
|
27
27
|
<img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
|
|
28
28
|
<img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
<p align="center">
|
|
11
|
-
<img alt="version" src="https://img.shields.io/badge/version-1.0.
|
|
11
|
+
<img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
|
|
12
12
|
<img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
|
|
13
13
|
<img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
|
|
14
14
|
<img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
|
|
@@ -34,8 +34,12 @@ def analyze(root: str,
|
|
|
34
34
|
info.warnings.append(err)
|
|
35
35
|
info.layer = classify(info, text)
|
|
36
36
|
if info.parsed or info.language in ("html", "css"):
|
|
37
|
-
|
|
37
|
+
src = text if len(text) <= 300_000 else \
|
|
38
38
|
text[:300_000] + "\n… (truncated)"
|
|
39
|
+
if info.language == "config":
|
|
40
|
+
from .parsers.generic_parser import redact_secrets
|
|
41
|
+
src = redact_secrets(src)
|
|
42
|
+
info.source = src
|
|
39
43
|
parsed.append(info)
|
|
40
44
|
for w in info.warnings:
|
|
41
45
|
if w.startswith("Unsupported:"):
|
|
@@ -286,3 +286,17 @@ def parse_config(info: FileInfo, text: str) -> None:
|
|
|
286
286
|
value = value[:57] + "..."
|
|
287
287
|
info.db_config.append(f"{key} = {value}")
|
|
288
288
|
info.db_config = info.db_config[:20]
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def redact_secrets(text: str) -> str:
|
|
292
|
+
"""Mask secret-looking values line by line. Used on config-file source
|
|
293
|
+
before it's stored/exported, so the raw "IDE view" / JSON export can't
|
|
294
|
+
leak what the DB-config summary already redacts."""
|
|
295
|
+
out = []
|
|
296
|
+
for line in text.splitlines():
|
|
297
|
+
m = re.match(r"^(\s*[\"']?[\w.\-]+[\"']?\s*[:=]\s*)(.+)$", line)
|
|
298
|
+
if m and SECRET_KEY_RE.search(m.group(1)):
|
|
299
|
+
out.append(m.group(1) + "•••masked•••")
|
|
300
|
+
else:
|
|
301
|
+
out.append(URL_CREDS_RE.sub("://***:***@", line))
|
|
302
|
+
return "\n".join(out)
|
|
@@ -10,6 +10,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
|
10
10
|
from typing import Dict
|
|
11
11
|
|
|
12
12
|
WEB_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web")
|
|
13
|
+
WEB_ROOT = os.path.realpath(WEB_DIR)
|
|
13
14
|
|
|
14
15
|
MIME = {".html": "text/html; charset=utf-8",
|
|
15
16
|
".js": "application/javascript; charset=utf-8",
|
|
@@ -45,11 +46,19 @@ def serve(graph: Dict, port: int = 8137, open_browser: bool = True) -> None:
|
|
|
45
46
|
self._file(path.lstrip("/"))
|
|
46
47
|
|
|
47
48
|
def _file(self, rel: str):
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
# Resolve against WEB_DIR and verify the *result* is still inside
|
|
50
|
+
# it. String-prefix checks on `rel` alone aren't enough: on
|
|
51
|
+
# Windows, os.path.join(WEB_DIR, "C:/some/file") silently
|
|
52
|
+
# discards WEB_DIR because the second argument is drive-absolute,
|
|
53
|
+
# which would otherwise let a request read any file on disk.
|
|
54
|
+
full = os.path.realpath(os.path.join(WEB_DIR, rel))
|
|
55
|
+
try:
|
|
56
|
+
inside = os.path.commonpath([full, WEB_ROOT]) == WEB_ROOT
|
|
57
|
+
except ValueError:
|
|
58
|
+
inside = False # e.g. different drives on Windows
|
|
59
|
+
if not inside:
|
|
50
60
|
self.send_error(403)
|
|
51
61
|
return
|
|
52
|
-
full = os.path.join(WEB_DIR, rel)
|
|
53
62
|
if not os.path.isfile(full):
|
|
54
63
|
self.send_error(404)
|
|
55
64
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebread
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together.
|
|
5
5
|
Author: Danial Irsyad
|
|
6
6
|
License: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: license-file
|
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
|
-
<img alt="version" src="https://img.shields.io/badge/version-1.0.
|
|
25
|
+
<img alt="version" src="https://img.shields.io/badge/version-1.0.2-2dd4bf">
|
|
26
26
|
<img alt="python" src="https://img.shields.io/badge/python-3.9%2B-0284c7">
|
|
27
27
|
<img alt="deps" src="https://img.shields.io/badge/required%20dependencies-none-2dd4bf">
|
|
28
28
|
<img alt="license" src="https://img.shields.io/badge/license-MIT-8b5cf6">
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codebread"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
description = "Interactive codebase analyzer & visualizer — slice open a project and see how it's wired together."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|