logguard-cli 0.1.0__tar.gz → 0.3.0__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.
- {logguard_cli-0.1.0/logguard_cli.egg-info → logguard_cli-0.3.0}/PKG-INFO +49 -25
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/README.md +43 -20
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/log_guard.py +774 -551
- {logguard_cli-0.1.0 → logguard_cli-0.3.0/logguard_cli.egg-info}/PKG-INFO +49 -25
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/logguard_cli.egg-info/SOURCES.txt +1 -0
- logguard_cli-0.3.0/logguard_cli.egg-info/requires.txt +2 -0
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/pyproject.toml +58 -53
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/LICENSE +0 -0
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/logguard_cli.egg-info/dependency_links.txt +0 -0
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/logguard_cli.egg-info/entry_points.txt +0 -0
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/logguard_cli.egg-info/top_level.txt +0 -0
- {logguard_cli-0.1.0 → logguard_cli-0.3.0}/setup.cfg +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logguard-cli
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A 100% local, offline CLI tool that scans log files and masks sensitive data (emails, phone numbers, API keys, IPs, credit cards) before you share them.
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A 100% local, offline CLI tool that scans log files and Excel (.xlsx) spreadsheets and masks sensitive data (emails, phone numbers, API keys, IPs, credit cards) before you share them.
|
|
5
5
|
Author: Apurva Raj
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/apurvaraj9/log-guard
|
|
8
8
|
Project-URL: Repository, https://github.com/apurvaraj9/log-guard
|
|
9
9
|
Project-URL: Issues, https://github.com/apurvaraj9/log-guard/issues
|
|
10
|
-
Keywords: logs,logging,masking,redaction,privacy,security,pii,sensitive-data,cli,pre-commit
|
|
10
|
+
Keywords: logs,logging,masking,redaction,privacy,security,pii,sensitive-data,cli,pre-commit,excel,xlsx
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
@@ -15,48 +15,50 @@ Classifier: Intended Audience :: System Administrators
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Topic :: Security
|
|
23
22
|
Classifier: Topic :: System :: Logging
|
|
24
23
|
Classifier: Topic :: Utilities
|
|
25
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
26
25
|
Description-Content-Type: text/markdown
|
|
27
26
|
License-File: LICENSE
|
|
27
|
+
Requires-Dist: openpyxl>=3.1
|
|
28
|
+
Requires-Dist: defusedxml>=0.7
|
|
28
29
|
Dynamic: license-file
|
|
29
30
|
|
|
30
31
|
# 🛡️ Log Guard
|
|
31
32
|
|
|
32
|
-
[](https://github.com/apurvaraj9/log-guard/actions/workflows/tests.yml)
|
|
33
|
+
[](https://github.com/apurvaraj9/log-guard/actions/workflows/tests.yml) [](https://pypi.org/project/logguard-cli/)
|
|
33
34
|
|
|
34
|
-
**A local, offline tool that scans server log files and masks sensitive data before you share them for debugging.**
|
|
35
|
+
**A local, offline tool that scans server log files — and Excel spreadsheets — and masks sensitive data before you share them for debugging.**
|
|
35
36
|
|
|
36
|
-
No uploads. No third-party servers. No enterprise pricing. Your
|
|
37
|
+
No uploads. No third-party servers. No enterprise pricing. Your data never leaves your machine.
|
|
37
38
|
|
|
38
39
|
---
|
|
39
40
|
|
|
40
41
|
## Why Log Guard?
|
|
41
42
|
|
|
42
|
-
When you're debugging with a teammate, posting to a forum, or filing a support ticket, you often need to share a log file — but real
|
|
43
|
+
When you're debugging with a teammate, posting to a forum, or filing a support ticket, you often need to share a log file or a spreadsheet export — but real data is full of things you *shouldn't* share: customer emails, phone numbers, API keys, IP addresses, credit card numbers.
|
|
43
44
|
|
|
44
|
-
- **Online masking tools** require uploading your private
|
|
45
|
+
- **Online masking tools** require uploading your private data to a third-party server — a privacy risk in itself.
|
|
45
46
|
- **Enterprise security tools** solve this, but are expensive, complex, and overkill for an individual developer or small team.
|
|
46
47
|
|
|
47
48
|
**Log Guard** runs 100% locally, does one job well, and stays simple.
|
|
48
49
|
|
|
49
50
|
## Features
|
|
50
51
|
|
|
51
|
-
- 🔍 **Detects and masks:** emails, phone numbers, API keys (Stripe/AWS/GitHub formats + a generic long-token fallback), IP addresses, and credit card numbers (Visa/Mastercard/Amex/Discover)
|
|
52
|
-
-
|
|
53
|
-
-
|
|
52
|
+
- 🔍 **Detects and masks:** emails, phone numbers (US-style and Indian mobile numbers), API keys (Stripe/AWS/GitHub formats + a generic long-token fallback), IP addresses, and credit card numbers (Visa/Mastercard/Amex/Discover)
|
|
53
|
+
- 📗 **Excel spreadsheet support** — scans every cell of every sheet in `.xlsx` files (hidden sheets included) and writes a masked copy you can open in Excel
|
|
54
|
+
- 📁 **Scans whole directories**, recursively by default — point it at a `logs/` folder and it finds everything inside, spreadsheets included
|
|
55
|
+
- 🧩 **Custom patterns** via a simple JSON file — add your own detection rules with no code changes (they apply to spreadsheets too)
|
|
54
56
|
- ⚙️ **Config file support** (`.log-guard.json`) — set project-level defaults for extensions, recursion, custom patterns, and quiet mode; CLI flags always override it
|
|
55
57
|
- 🚦 **CI / pre-commit mode** (`--check`) — scans without writing files and exits with status code `1` if secrets are found, so it can block a commit or fail a build. Ships with a ready-to-use `.pre-commit-hooks.yaml`
|
|
56
|
-
- 📄 **Non-destructive** — writes a new `*.masked.log` file (or a path you choose with `-o`); your original is never touched, and a clean file with nothing to mask doesn't get a redundant copy
|
|
58
|
+
- 📄 **Non-destructive** — writes a new `*.masked.log` / `*.masked.xlsx` file (or a path you choose with `-o`); your original is never touched, and a clean file with nothing to mask doesn't get a redundant copy
|
|
57
59
|
- 📊 **Summary report** — see exactly how many of each type were found
|
|
58
|
-
- 🧪 **Fully tested** —
|
|
59
|
-
- 💻 **Handles edge cases** — empty files, huge files (streamed line-by-line), unusual encodings, mixed line endings, and directories with zero matching files
|
|
60
|
+
- 🧪 **Fully tested** — 80+ automated tests covering detection, masking, spreadsheets, directory scanning, config parsing, and a wide range of edge cases, run automatically on every push via GitHub Actions across Python 3.10–3.12
|
|
61
|
+
- 💻 **Handles edge cases** — empty files, huge log files (streamed line-by-line), unusual encodings, mixed line endings, corrupt or password-protected spreadsheets, and directories with zero matching files
|
|
60
62
|
- 🚫 **Smart defaults for directories** — automatically skips `.git`, `node_modules`, `venv`, `.venv`, and `__pycache__` while recursing (use `--ext all` to scan every file if you really want to)
|
|
61
63
|
- ⚡ **Zero network calls, ever**
|
|
62
64
|
|
|
@@ -68,7 +70,9 @@ pip install logguard-cli
|
|
|
68
70
|
|
|
69
71
|
That's it — this installs the `log-guard` command. (The package is named `logguard-cli` on PyPI because the name `log-guard` was already taken, but the command you run is still `log-guard`.)
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
It also automatically installs two small libraries used for `.xlsx` support: `openpyxl` (reads and writes spreadsheets) and `defusedxml` (protects against maliciously crafted files). Both work fully offline.
|
|
74
|
+
|
|
75
|
+
Requires Python 3.10 or newer. (If you are still on Python 3.9, pip will install version 0.2.0, which still supports it.)
|
|
72
76
|
|
|
73
77
|
> **Note:** if `log-guard` isn't recognized as a command right after installing, your Python Scripts folder probably isn't on your system PATH. Either add it to PATH, or run the tool with `python -m log_guard` instead — both work identically.
|
|
74
78
|
|
|
@@ -92,13 +96,28 @@ log-guard your.log
|
|
|
92
96
|
|
|
93
97
|
Creates `your.masked.log` alongside the original (unless nothing was found — then no output file is created, to avoid clutter).
|
|
94
98
|
|
|
99
|
+
**Scan an Excel spreadsheet (`.xlsx`):**
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
log-guard data.xlsx
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Scanned 29 cells across 4 sheet(s) in data.xlsx
|
|
107
|
+
Masked spreadsheet written to data.masked.xlsx
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Creates `data.masked.xlsx` — a real spreadsheet you can open in Excel. Every cell on every sheet is checked, including hidden sheets. Text cells and whole numbers (like a phone number typed as `5551234567`) are scanned; formulas, dates, and decimals are left untouched. `--check`, `--quiet`, `-o`, custom patterns, and the config file all work exactly as they do for text files.
|
|
111
|
+
|
|
112
|
+
Old `.xls` files (Excel 97–2003) aren't supported — open them in Excel and use **File > Save As** to save them as `.xlsx` first.
|
|
113
|
+
|
|
95
114
|
**Scan an entire directory (recursive by default):**
|
|
96
115
|
|
|
97
116
|
```bash
|
|
98
117
|
log-guard logs/
|
|
99
118
|
```
|
|
100
119
|
|
|
101
|
-
By default this scans `.log`, `.txt`, `.csv`, `.json`, `.out`, and `.
|
|
120
|
+
By default this scans `.log`, `.txt`, `.csv`, `.json`, `.out`, `.err`, and `.xlsx` files, skipping `.git`/`node_modules`/`venv`/`__pycache__` automatically.
|
|
102
121
|
|
|
103
122
|
```bash
|
|
104
123
|
log-guard logs/ --ext log,txt --no-recursive # only .log/.txt, top level only
|
|
@@ -119,12 +138,12 @@ log-guard your.log -o cleaned.log
|
|
|
119
138
|
log-guard logs/*.log --check
|
|
120
139
|
```
|
|
121
140
|
|
|
122
|
-
Add `--quiet` for a condensed summary suited to CI logs. To use Log Guard as an actual [pre-commit](https://pre-commit.com) hook in any repo:
|
|
141
|
+
Add `--quiet` for a condensed summary suited to CI logs. To use Log Guard as an actual [pre-commit](https://pre-commit.com) hook in any repo (it checks staged `.log` and `.xlsx` files):
|
|
123
142
|
|
|
124
143
|
```yaml
|
|
125
144
|
repos:
|
|
126
145
|
- repo: https://github.com/apurvaraj9/log-guard
|
|
127
|
-
rev: v0.
|
|
146
|
+
rev: v0.3.0
|
|
128
147
|
hooks:
|
|
129
148
|
- id: log-guard
|
|
130
149
|
```
|
|
@@ -183,27 +202,32 @@ pytest
|
|
|
183
202
|
```
|
|
184
203
|
log-guard/
|
|
185
204
|
├── .github/workflows/tests.yml # GitHub Actions: runs the test suite on every push
|
|
186
|
-
├── log_guard.py # Core tool: detection, masking, CLI, config, directory scanning
|
|
205
|
+
├── log_guard.py # Core tool: detection, masking, spreadsheets, CLI, config, directory scanning
|
|
187
206
|
├── test_log_guard.py # Automated test suite (pytest)
|
|
188
|
-
├── pyproject.toml # Packaging config (PyPI metadata + the `log-guard` command)
|
|
207
|
+
├── pyproject.toml # Packaging config (PyPI metadata, dependencies + the `log-guard` command)
|
|
189
208
|
├── .pre-commit-hooks.yaml # Lets others use Log Guard as a pre-commit hook
|
|
190
209
|
├── .log-guard.json.example # Example project config file
|
|
191
210
|
├── sample.log # Example log file for testing
|
|
192
211
|
├── generate_samples.py # Generates edge-case sample files for manual testing
|
|
193
212
|
├── generate_test_logs_dir.py # Generates a sample directory tree for directory-scanning tests
|
|
213
|
+
├── generate_xlsx_sample.py # Generates a sample .xlsx workbook (and can print any .xlsx file's contents)
|
|
214
|
+
├── RELEASING.md # Step-by-step checklist for publishing a new version
|
|
194
215
|
└── README.md
|
|
195
216
|
```
|
|
196
217
|
|
|
197
218
|
## Limitations
|
|
198
219
|
|
|
199
220
|
- Detection is regex-based, so like any pattern-matching approach it can occasionally miss unusual formats (false negatives) or flag something that isn't actually sensitive (false positives) — especially the generic long-token API key fallback, which can flag any long run of random-looking characters.
|
|
200
|
-
-
|
|
201
|
-
- **
|
|
221
|
+
- Phone detection covers US-style numbers and Indian mobile numbers (with or without `+91`, `91` or `0`, e.g. `+91 98765 43210`). Landline numbers and other countries' formats aren't detected yet.
|
|
222
|
+
- **Supported file types:** plain-text files and `.xlsx` spreadsheets. Old `.xls` files are not supported (re-save them as `.xlsx`), and other binary formats such as PDF or Word documents are not read.
|
|
223
|
+
- **Spreadsheet scanning covers cell values only.** Formulas are deliberately left untouched (masking text inside a formula could break it), and cell comments, headers/footers, sheet names, and text inside charts or images are not scanned.
|
|
224
|
+
- **Masked spreadsheets may lose some extras.** The masked copy keeps every sheet, all cell values, and basic formatting, but charts, images, and some advanced Excel features may not survive — a limitation of the `openpyxl` library used to read and write them. Your original file is never changed.
|
|
225
|
+
- **Spreadsheets are loaded into memory in full**, so very large workbooks need correspondingly more RAM. (Text logs are streamed line by line and don't have this limit.)
|
|
202
226
|
- This tool reduces the risk of accidentally sharing sensitive data, but it isn't a substitute for careful review of anything genuinely high-stakes before sharing.
|
|
203
227
|
|
|
204
228
|
## Roadmap
|
|
205
229
|
|
|
206
|
-
- [
|
|
230
|
+
- [x] `.xlsx` spreadsheet support (via `openpyxl`)
|
|
207
231
|
- [x] PyPI packaging (`pip install logguard-cli`)
|
|
208
232
|
|
|
209
233
|
## License
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
# 🛡️ Log Guard
|
|
2
2
|
|
|
3
|
-
[](https://github.com/apurvaraj9/log-guard/actions/workflows/tests.yml)
|
|
3
|
+
[](https://github.com/apurvaraj9/log-guard/actions/workflows/tests.yml) [](https://pypi.org/project/logguard-cli/)
|
|
4
4
|
|
|
5
|
-
**A local, offline tool that scans server log files and masks sensitive data before you share them for debugging.**
|
|
5
|
+
**A local, offline tool that scans server log files — and Excel spreadsheets — and masks sensitive data before you share them for debugging.**
|
|
6
6
|
|
|
7
|
-
No uploads. No third-party servers. No enterprise pricing. Your
|
|
7
|
+
No uploads. No third-party servers. No enterprise pricing. Your data never leaves your machine.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
## Why Log Guard?
|
|
12
12
|
|
|
13
|
-
When you're debugging with a teammate, posting to a forum, or filing a support ticket, you often need to share a log file — but real
|
|
13
|
+
When you're debugging with a teammate, posting to a forum, or filing a support ticket, you often need to share a log file or a spreadsheet export — but real data is full of things you *shouldn't* share: customer emails, phone numbers, API keys, IP addresses, credit card numbers.
|
|
14
14
|
|
|
15
|
-
- **Online masking tools** require uploading your private
|
|
15
|
+
- **Online masking tools** require uploading your private data to a third-party server — a privacy risk in itself.
|
|
16
16
|
- **Enterprise security tools** solve this, but are expensive, complex, and overkill for an individual developer or small team.
|
|
17
17
|
|
|
18
18
|
**Log Guard** runs 100% locally, does one job well, and stays simple.
|
|
19
19
|
|
|
20
20
|
## Features
|
|
21
21
|
|
|
22
|
-
- 🔍 **Detects and masks:** emails, phone numbers, API keys (Stripe/AWS/GitHub formats + a generic long-token fallback), IP addresses, and credit card numbers (Visa/Mastercard/Amex/Discover)
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- 🔍 **Detects and masks:** emails, phone numbers (US-style and Indian mobile numbers), API keys (Stripe/AWS/GitHub formats + a generic long-token fallback), IP addresses, and credit card numbers (Visa/Mastercard/Amex/Discover)
|
|
23
|
+
- 📗 **Excel spreadsheet support** — scans every cell of every sheet in `.xlsx` files (hidden sheets included) and writes a masked copy you can open in Excel
|
|
24
|
+
- 📁 **Scans whole directories**, recursively by default — point it at a `logs/` folder and it finds everything inside, spreadsheets included
|
|
25
|
+
- 🧩 **Custom patterns** via a simple JSON file — add your own detection rules with no code changes (they apply to spreadsheets too)
|
|
25
26
|
- ⚙️ **Config file support** (`.log-guard.json`) — set project-level defaults for extensions, recursion, custom patterns, and quiet mode; CLI flags always override it
|
|
26
27
|
- 🚦 **CI / pre-commit mode** (`--check`) — scans without writing files and exits with status code `1` if secrets are found, so it can block a commit or fail a build. Ships with a ready-to-use `.pre-commit-hooks.yaml`
|
|
27
|
-
- 📄 **Non-destructive** — writes a new `*.masked.log` file (or a path you choose with `-o`); your original is never touched, and a clean file with nothing to mask doesn't get a redundant copy
|
|
28
|
+
- 📄 **Non-destructive** — writes a new `*.masked.log` / `*.masked.xlsx` file (or a path you choose with `-o`); your original is never touched, and a clean file with nothing to mask doesn't get a redundant copy
|
|
28
29
|
- 📊 **Summary report** — see exactly how many of each type were found
|
|
29
|
-
- 🧪 **Fully tested** —
|
|
30
|
-
- 💻 **Handles edge cases** — empty files, huge files (streamed line-by-line), unusual encodings, mixed line endings, and directories with zero matching files
|
|
30
|
+
- 🧪 **Fully tested** — 80+ automated tests covering detection, masking, spreadsheets, directory scanning, config parsing, and a wide range of edge cases, run automatically on every push via GitHub Actions across Python 3.10–3.12
|
|
31
|
+
- 💻 **Handles edge cases** — empty files, huge log files (streamed line-by-line), unusual encodings, mixed line endings, corrupt or password-protected spreadsheets, and directories with zero matching files
|
|
31
32
|
- 🚫 **Smart defaults for directories** — automatically skips `.git`, `node_modules`, `venv`, `.venv`, and `__pycache__` while recursing (use `--ext all` to scan every file if you really want to)
|
|
32
33
|
- ⚡ **Zero network calls, ever**
|
|
33
34
|
|
|
@@ -39,7 +40,9 @@ pip install logguard-cli
|
|
|
39
40
|
|
|
40
41
|
That's it — this installs the `log-guard` command. (The package is named `logguard-cli` on PyPI because the name `log-guard` was already taken, but the command you run is still `log-guard`.)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
It also automatically installs two small libraries used for `.xlsx` support: `openpyxl` (reads and writes spreadsheets) and `defusedxml` (protects against maliciously crafted files). Both work fully offline.
|
|
44
|
+
|
|
45
|
+
Requires Python 3.10 or newer. (If you are still on Python 3.9, pip will install version 0.2.0, which still supports it.)
|
|
43
46
|
|
|
44
47
|
> **Note:** if `log-guard` isn't recognized as a command right after installing, your Python Scripts folder probably isn't on your system PATH. Either add it to PATH, or run the tool with `python -m log_guard` instead — both work identically.
|
|
45
48
|
|
|
@@ -63,13 +66,28 @@ log-guard your.log
|
|
|
63
66
|
|
|
64
67
|
Creates `your.masked.log` alongside the original (unless nothing was found — then no output file is created, to avoid clutter).
|
|
65
68
|
|
|
69
|
+
**Scan an Excel spreadsheet (`.xlsx`):**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
log-guard data.xlsx
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Scanned 29 cells across 4 sheet(s) in data.xlsx
|
|
77
|
+
Masked spreadsheet written to data.masked.xlsx
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Creates `data.masked.xlsx` — a real spreadsheet you can open in Excel. Every cell on every sheet is checked, including hidden sheets. Text cells and whole numbers (like a phone number typed as `5551234567`) are scanned; formulas, dates, and decimals are left untouched. `--check`, `--quiet`, `-o`, custom patterns, and the config file all work exactly as they do for text files.
|
|
81
|
+
|
|
82
|
+
Old `.xls` files (Excel 97–2003) aren't supported — open them in Excel and use **File > Save As** to save them as `.xlsx` first.
|
|
83
|
+
|
|
66
84
|
**Scan an entire directory (recursive by default):**
|
|
67
85
|
|
|
68
86
|
```bash
|
|
69
87
|
log-guard logs/
|
|
70
88
|
```
|
|
71
89
|
|
|
72
|
-
By default this scans `.log`, `.txt`, `.csv`, `.json`, `.out`, and `.
|
|
90
|
+
By default this scans `.log`, `.txt`, `.csv`, `.json`, `.out`, `.err`, and `.xlsx` files, skipping `.git`/`node_modules`/`venv`/`__pycache__` automatically.
|
|
73
91
|
|
|
74
92
|
```bash
|
|
75
93
|
log-guard logs/ --ext log,txt --no-recursive # only .log/.txt, top level only
|
|
@@ -90,12 +108,12 @@ log-guard your.log -o cleaned.log
|
|
|
90
108
|
log-guard logs/*.log --check
|
|
91
109
|
```
|
|
92
110
|
|
|
93
|
-
Add `--quiet` for a condensed summary suited to CI logs. To use Log Guard as an actual [pre-commit](https://pre-commit.com) hook in any repo:
|
|
111
|
+
Add `--quiet` for a condensed summary suited to CI logs. To use Log Guard as an actual [pre-commit](https://pre-commit.com) hook in any repo (it checks staged `.log` and `.xlsx` files):
|
|
94
112
|
|
|
95
113
|
```yaml
|
|
96
114
|
repos:
|
|
97
115
|
- repo: https://github.com/apurvaraj9/log-guard
|
|
98
|
-
rev: v0.
|
|
116
|
+
rev: v0.3.0
|
|
99
117
|
hooks:
|
|
100
118
|
- id: log-guard
|
|
101
119
|
```
|
|
@@ -154,27 +172,32 @@ pytest
|
|
|
154
172
|
```
|
|
155
173
|
log-guard/
|
|
156
174
|
├── .github/workflows/tests.yml # GitHub Actions: runs the test suite on every push
|
|
157
|
-
├── log_guard.py # Core tool: detection, masking, CLI, config, directory scanning
|
|
175
|
+
├── log_guard.py # Core tool: detection, masking, spreadsheets, CLI, config, directory scanning
|
|
158
176
|
├── test_log_guard.py # Automated test suite (pytest)
|
|
159
|
-
├── pyproject.toml # Packaging config (PyPI metadata + the `log-guard` command)
|
|
177
|
+
├── pyproject.toml # Packaging config (PyPI metadata, dependencies + the `log-guard` command)
|
|
160
178
|
├── .pre-commit-hooks.yaml # Lets others use Log Guard as a pre-commit hook
|
|
161
179
|
├── .log-guard.json.example # Example project config file
|
|
162
180
|
├── sample.log # Example log file for testing
|
|
163
181
|
├── generate_samples.py # Generates edge-case sample files for manual testing
|
|
164
182
|
├── generate_test_logs_dir.py # Generates a sample directory tree for directory-scanning tests
|
|
183
|
+
├── generate_xlsx_sample.py # Generates a sample .xlsx workbook (and can print any .xlsx file's contents)
|
|
184
|
+
├── RELEASING.md # Step-by-step checklist for publishing a new version
|
|
165
185
|
└── README.md
|
|
166
186
|
```
|
|
167
187
|
|
|
168
188
|
## Limitations
|
|
169
189
|
|
|
170
190
|
- Detection is regex-based, so like any pattern-matching approach it can occasionally miss unusual formats (false negatives) or flag something that isn't actually sensitive (false positives) — especially the generic long-token API key fallback, which can flag any long run of random-looking characters.
|
|
171
|
-
-
|
|
172
|
-
- **
|
|
191
|
+
- Phone detection covers US-style numbers and Indian mobile numbers (with or without `+91`, `91` or `0`, e.g. `+91 98765 43210`). Landline numbers and other countries' formats aren't detected yet.
|
|
192
|
+
- **Supported file types:** plain-text files and `.xlsx` spreadsheets. Old `.xls` files are not supported (re-save them as `.xlsx`), and other binary formats such as PDF or Word documents are not read.
|
|
193
|
+
- **Spreadsheet scanning covers cell values only.** Formulas are deliberately left untouched (masking text inside a formula could break it), and cell comments, headers/footers, sheet names, and text inside charts or images are not scanned.
|
|
194
|
+
- **Masked spreadsheets may lose some extras.** The masked copy keeps every sheet, all cell values, and basic formatting, but charts, images, and some advanced Excel features may not survive — a limitation of the `openpyxl` library used to read and write them. Your original file is never changed.
|
|
195
|
+
- **Spreadsheets are loaded into memory in full**, so very large workbooks need correspondingly more RAM. (Text logs are streamed line by line and don't have this limit.)
|
|
173
196
|
- This tool reduces the risk of accidentally sharing sensitive data, but it isn't a substitute for careful review of anything genuinely high-stakes before sharing.
|
|
174
197
|
|
|
175
198
|
## Roadmap
|
|
176
199
|
|
|
177
|
-
- [
|
|
200
|
+
- [x] `.xlsx` spreadsheet support (via `openpyxl`)
|
|
178
201
|
- [x] PyPI packaging (`pip install logguard-cli`)
|
|
179
202
|
|
|
180
203
|
## License
|