maisecrets 0.9.2__tar.gz → 0.9.3__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.
- {maisecrets-0.9.2 → maisecrets-0.9.3}/.claude-plugin/plugin.json +1 -1
- {maisecrets-0.9.2 → maisecrets-0.9.3}/PKG-INFO +1 -1
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/own_rules.py +5 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/personal.py +9 -1
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/leading_literals.json +7 -0
- maisecrets-0.9.3/maisecrets/detection/secret_table.py +83 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/.gitignore +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/LICENSE +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/NOTICE +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/docs/PYPI.md +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/__init__.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/__init__.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/__main__.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/card_shape.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/checksums.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/contract.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/core.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/deadline.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/detect-1.schema.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/encoded_mail.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/fields.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/keyword_tail.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/label_number.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/lazy_regex.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/leaves.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/normalise.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/phone_forms.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/prefilter.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/regions.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/registry.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/remote.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rule_filter.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/BETTERLEAKS_VERSION +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/DETECT_SECRETS_VERSION +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-betterleaks +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-bip39 +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-detect-secrets +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-gitleaks +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-presidio +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/LICENSE-scowl +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/PRESIDIO_VERSION +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/SCOWL_VERSION +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/betterleaks.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/betterleaks.toml +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/bip39_english.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/detect_secrets.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/cs.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/da.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/de.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/en.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/es.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/fi.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/fr.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/it.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/ja.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/ko.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/nb.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/nl.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/pl.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/pt.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/ru.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/sv.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/th.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/tr.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/labels/zh.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/own_secret_rules.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/patched_upstream.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/prefixes.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/presidio.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/public_test_values.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rules/words_en.txt +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/rulespec.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/text_index.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/types.json +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/value_checks.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/detection/vocabulary.py +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/maisecrets/py.typed +0 -0
- {maisecrets-0.9.2 → maisecrets-0.9.3}/pyproject.toml +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maisecrets",
|
|
3
3
|
"displayName": "maisecrets",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.3",
|
|
5
5
|
"description": "Intercepts detected secrets and PII before they reach the cloud model: deterministic detection, a local vault with TTL, placeholders resolved only where the real call happens. Free and open source, by mcpgate.de.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "mcpgate",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maisecrets
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: Find secrets and personal data in text: the detection core of the maisecrets plugin
|
|
5
5
|
Project-URL: Homepage, https://mcpgate.de/maisecrets/
|
|
6
6
|
Project-URL: Documentation, https://github.com/Mcpgate-de/maisecrets/blob/main/docs/DETECTION.md
|
|
@@ -99,6 +99,11 @@ OWN_RULES: list[dict] = [
|
|
|
99
99
|
# 8 x 6 digit run passes about once in 2.9 billion. ASCII digits only; a hyphen after it ends a sentence
|
|
100
100
|
{"id": "bitlocker-recovery-key", "type": "SECRET", "validator": "bitlocker_key",
|
|
101
101
|
"regex": r"(?<![0-9])(?<![0-9]-)[0-9]{6}(?:-[0-9]{6}){7}(?![0-9])(?!-[0-9])"},
|
|
102
|
+
# the passcode of a Microsoft Teams meeting in its join link: /meet/<meeting id>?p=<passcode>. The link alone lets
|
|
103
|
+
# anyone join; the meeting id is no secret (field case, 2026-11-08). Only on teams.microsoft.com/meet
|
|
104
|
+
{"id": "secret-teams-meeting-passcode", "type": "SECRET", "secret_group": 1,
|
|
105
|
+
"regex": r"(?<![\w.-])https?://(?i:teams\.microsoft\.com)/meet/\d{6,24}/?\?(?:[^\s#\"'<>&]{0,200}&){0,8}?"
|
|
106
|
+
r"p=([A-Za-z0-9_-]{6,64})(?![A-Za-z0-9_-])"},
|
|
102
107
|
# bare token prefixes newer than the vendored rulesets live in rules/prefixes.txt (see _load_prefixes)
|
|
103
108
|
{"id": "auth-scheme", "type": "SECRET", "secret_group": 3,
|
|
104
109
|
"regex": r"(?<![\w-])(Bearer|Basic)([ \t]+)([A-Za-z0-9._~+/=-]{16,})"},
|
|
@@ -107,6 +107,10 @@ _ID_RE = _LazyRx(r"(?i)(?<![a-z])(?:mrn|member[ -]?id|passport(?:[ _-]?(?:no|num
|
|
|
107
107
|
# a comma too: `your health plan beneficiary number, <id>, to medical professionals` (Nemotron-PII)
|
|
108
108
|
r"\s{0,3}[:=#,]?\s{0,3}[\"']?"
|
|
109
109
|
r"((?-i:[A-Z0-9](?:[A-Z0-9]|[ -](?=[A-Z0-9])){4,24}))(?![A-Za-z0-9])")
|
|
110
|
+
# a date or the date and hour of a timestamp is no id: `2026-11-08T21` of a CI log line after `sin`, `tax id`
|
|
111
|
+
_ID_DATE_RE = _LazyRx(r"\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])[T ](?:[01]\d|2[0-3])(?::[0-5]\d)?")
|
|
112
|
+
# only a timestamp with its hour: a plain date after an id label can be the id (a licence number written as a
|
|
113
|
+
# date, Nemotron; the 0.9.3 release gate)
|
|
110
114
|
|
|
111
115
|
# ------------------------------------------------------------------------------------- user in a URL or path --
|
|
112
116
|
_URL_USER_RE = _LazyRx(r"://([^:/?#\s@\[\]]{1,64}):[^@\s/]{1,128}@")
|
|
@@ -2662,7 +2666,8 @@ def hits(text: str, channel: str, regions: tuple, company: list | None = None) -
|
|
|
2662
2666
|
for m in _ID_RE.finditer(text):
|
|
2663
2667
|
v = m.group(1)
|
|
2664
2668
|
# 17 digits and more: a snowflake id of a chat platform or a database key, no document number
|
|
2665
|
-
if sum(c.isdigit() for c in v) >= 5 and not (v.isdigit() and len(v) >= 17) and not _placeholder_digits(v)
|
|
2669
|
+
if sum(c.isdigit() for c in v) >= 5 and not (v.isdigit() and len(v) >= 17) and not _placeholder_digits(v) \
|
|
2670
|
+
and not _ID_DATE_RE.fullmatch(v):
|
|
2666
2671
|
# MRN4829173: the label glued to the number is the id's own prefix, masked with it
|
|
2667
2672
|
start = m.start() if text[m.start():m.start(1)].isalpha() else m.start(1)
|
|
2668
2673
|
out.append((start, m.end(1), "id-number-after-label", ID_NUMBER))
|
|
@@ -2836,6 +2841,9 @@ def hits(text: str, channel: str, regions: tuple, company: list | None = None) -
|
|
|
2836
2841
|
out.append((m.start(1), m.end(1), "name-before-email", NAME))
|
|
2837
2842
|
if "csv-personal-column" in want and "\n" in text:
|
|
2838
2843
|
out += _csv_hits(text)
|
|
2844
|
+
if "secret-under-password-column" in want and "\n" in text and ("|" in text or "\t" in text):
|
|
2845
|
+
from .secret_table import secret_table_hits
|
|
2846
|
+
out += secret_table_hits(text)
|
|
2839
2847
|
if "address-street-postcode-city" in want and "," in text:
|
|
2840
2848
|
for m in _STREET_POSTCODE_CITY_RE.finditer(text):
|
|
2841
2849
|
if not _STREET_WORD_RE.search(m.group(1)):
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""The values under a secret column of a table whose cells a bar or a tab separates, for personal.py (moved here:
|
|
2
|
+
personal.py is at the size limit of the release tree)."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
from .lazy_regex import LazyRx as _LazyRx
|
|
8
|
+
|
|
9
|
+
# a header that names a secret besides a password (_password_column): a secret, a token, a passcode, a PIN. The
|
|
10
|
+
# columns of a table separated by bars or tabs, with or without the separator row of Markdown (field case, 2026-11-08:
|
|
11
|
+
# | Account | Passwort | with a password on each row; `Account | Password` and tab tables stayed in the clear)
|
|
12
|
+
_SECRET_COL_RE = _LazyRx(r"(?:(?!(?:hash|hashed|encrypted|enc|crypt|crypted|salted|salt|is|has)_)[a-z0-9]{1,16}_){0,2}"
|
|
13
|
+
r"(?:secret|token|passcode|kenncode|zugangscode)")
|
|
14
|
+
_PIN_COL_RE = _LazyRx(r"(?:[a-z0-9]{1,16}_)?pin(?:_?code|_?nummer|_?number)?")
|
|
15
|
+
_TABLE_HEAD_RE = _LazyRx(r"[^\W\d_][\w.-]{0,30}(?: [\w.-]{1,30}){0,3}")
|
|
16
|
+
_MD_SEP_LOOSE_RE = _LazyRx(r"[ \t]*\|?(?:[ \t]*:?-+:?[ \t]*\|)+(?:[ \t]*:?-+:?[ \t]*)?")
|
|
17
|
+
_IDENTIFIER_RE = _LazyRx(r"[A-Z][A-Z0-9_]*")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _secret_column(name: str) -> str:
|
|
21
|
+
""""password" for a column of passwords, secrets or tokens, "pin" for one of PINs, "" for any other."""
|
|
22
|
+
from .personal import _fold, _password_column
|
|
23
|
+
folded = _fold(re.sub(r"_{2,}", "_", name))
|
|
24
|
+
if _password_column(name) or _SECRET_COL_RE.fullmatch(folded):
|
|
25
|
+
return "password"
|
|
26
|
+
return "pin" if _PIN_COL_RE.fullmatch(folded) else ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _pin_cell(v: str) -> bool:
|
|
30
|
+
"""4 to 8 digits, no placeholder (0000, 1234) and no year."""
|
|
31
|
+
from .personal import _placeholder_digits
|
|
32
|
+
return v.isascii() and v.isdigit() and 4 <= len(v) <= 8 and not _placeholder_digits(v) \
|
|
33
|
+
and not (len(v) == 4 and v[:2] in ("19", "20"))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _row_cells(line: str, sep: str) -> list:
|
|
37
|
+
if sep == "|":
|
|
38
|
+
from .personal import _md_cells
|
|
39
|
+
return _md_cells(line)
|
|
40
|
+
out, a = [], 0
|
|
41
|
+
for part in line.split("\t"):
|
|
42
|
+
out.append((a, a + len(part)))
|
|
43
|
+
a += len(part) + 1
|
|
44
|
+
return out
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def secret_table_hits(text: str) -> list:
|
|
48
|
+
"""The values under a secret column of a table whose cells a bar or a tab separates. The header row is column names
|
|
49
|
+
only; each row has the header's number of cells, and an empty line or another shape ends the table."""
|
|
50
|
+
from .personal import _CSV_ROWS, _md_column, _password_cell
|
|
51
|
+
out = []
|
|
52
|
+
lines = text.split("\n")
|
|
53
|
+
pos = [0]
|
|
54
|
+
for ln in lines:
|
|
55
|
+
pos.append(pos[-1] + len(ln) + 1)
|
|
56
|
+
li = 0
|
|
57
|
+
while li < len(lines) - 1:
|
|
58
|
+
hdr = lines[li]
|
|
59
|
+
sep = "|" if "|" in hdr else "\t" if "\t" in hdr else ""
|
|
60
|
+
li += 1
|
|
61
|
+
if not sep or len(hdr) > 2000:
|
|
62
|
+
continue
|
|
63
|
+
head = [hdr[a:b].strip().strip("*`").strip() for a, b in _row_cells(hdr, sep)]
|
|
64
|
+
kinds = [_secret_column(_md_column(h)) for h in head]
|
|
65
|
+
if len(head) < 2 or not any(kinds) or not all(_TABLE_HEAD_RE.fullmatch(h) for h in head):
|
|
66
|
+
continue
|
|
67
|
+
if sep == "|" and _MD_SEP_LOOSE_RE.fullmatch(lines[li]):
|
|
68
|
+
li += 1
|
|
69
|
+
rows = 0
|
|
70
|
+
while li < len(lines) and rows < _CSV_ROWS:
|
|
71
|
+
line = lines[li]
|
|
72
|
+
cells = _row_cells(line, sep) if line.strip() and sep in line else []
|
|
73
|
+
if len(cells) != len(head):
|
|
74
|
+
break
|
|
75
|
+
for (a, b), kind in zip(cells, kinds):
|
|
76
|
+
v = line[a:b].strip().strip("*`")
|
|
77
|
+
if kind and v and (_pin_cell(v) if kind == "pin" else
|
|
78
|
+
_password_cell(v) and not _IDENTIFIER_RE.fullmatch(v)):
|
|
79
|
+
s0 = pos[li] + a + line[a:b].index(v)
|
|
80
|
+
out.append((s0, s0 + len(v), "secret-under-password-column", "SECRET"))
|
|
81
|
+
li += 1
|
|
82
|
+
rows += 1
|
|
83
|
+
return out
|
|
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
|
|
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
|
|
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
|
|
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
|