t-bug-catcher 0.6.3__tar.gz → 0.6.5__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.
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/PKG-INFO +1 -2
- t_bug_catcher-0.6.3/t_bug_catcher.egg-info/requires.txt → t_bug_catcher-0.6.5/requirements.txt +1 -2
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/setup.cfg +1 -1
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/setup.py +1 -1
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/config.py +14 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/jira.py +1 -1
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/stack_saver.py +32 -20
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher.egg-info/PKG-INFO +1 -2
- t_bug_catcher-0.6.3/requirements.txt → t_bug_catcher-0.6.5/t_bug_catcher.egg-info/requires.txt +0 -1
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/MANIFEST.in +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/README.rst +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/pyproject.toml +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/bug_catcher.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/resources/whispers_config.yml +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/utils/common.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/utils/logger.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher/workitems.py +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.6.3 → t_bug_catcher-0.6.5}/tests/test_t_bug_catcher.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: t_bug_catcher
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Bug catcher
|
|
5
5
|
Home-page: https://www.thoughtful.ai/
|
|
6
6
|
Author: Thoughtful
|
|
@@ -14,7 +14,6 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Requires-Dist: requests<3.0.0,>=2.31.0
|
|
15
15
|
Requires-Dist: bugsnag>=4.6.1
|
|
16
16
|
Requires-Dist: retry~=0.9.2
|
|
17
|
-
Requires-Dist: whispers>=2.2.1
|
|
18
17
|
|
|
19
18
|
t-bug-catcher
|
|
20
19
|
==============
|
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
|
|
27
27
|
test_suite="tests",
|
|
28
28
|
url="https://www.thoughtful.ai/",
|
|
29
|
-
version="0.6.
|
|
29
|
+
version="0.6.5",
|
|
30
30
|
zip_safe=False,
|
|
31
31
|
install_requires=install_requirements,
|
|
32
32
|
include_package_data=True,
|
|
@@ -32,6 +32,20 @@ class Config:
|
|
|
32
32
|
BC_BOARD = "BC"
|
|
33
33
|
|
|
34
34
|
KEYS_TO_REMOVE = ["credential", "password"]
|
|
35
|
+
|
|
36
|
+
SENSITIVE_KEYS = [
|
|
37
|
+
r"user(?:name|_name)?",
|
|
38
|
+
r"id",
|
|
39
|
+
r"uid",
|
|
40
|
+
r"otp",
|
|
41
|
+
r"api(?:[_]?key|[_]?token)",
|
|
42
|
+
r"\w+api(?:[_]?key|[_]?token)",
|
|
43
|
+
r"key",
|
|
44
|
+
r"account",
|
|
45
|
+
r"client_(?:id|secret)",
|
|
46
|
+
]
|
|
47
|
+
PARTIAL_MATCH_KEYS = [r"login", r"password", r"token", r"secret"]
|
|
48
|
+
|
|
35
49
|
BUILD_INFO_FILE = "commit_info.json"
|
|
36
50
|
|
|
37
51
|
HOST = socket.gethostname() if os.name.lower() == "nt" else None
|
|
@@ -1155,7 +1155,7 @@ class Jira:
|
|
|
1155
1155
|
else []
|
|
1156
1156
|
)
|
|
1157
1157
|
|
|
1158
|
-
if len(issue.get("fields", {}).get("comment", [])) >= CONFIG.LIMITS.COMMENT_LIMIT:
|
|
1158
|
+
if len(issue.get("fields", {}).get("comment", {}).get("comments", [])) >= CONFIG.LIMITS.COMMENT_LIMIT:
|
|
1159
1159
|
logger.warning(
|
|
1160
1160
|
f"Comments for '{issue.get('key')}' were not posted due to exceeding JIRA comments limit "
|
|
1161
1161
|
f"({CONFIG.LIMITS.COMMENT_LIMIT})."
|
|
@@ -3,12 +3,9 @@ import linecache
|
|
|
3
3
|
import re
|
|
4
4
|
import sys
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from pathlib import Path
|
|
7
6
|
from types import FunctionType, ModuleType
|
|
8
7
|
from typing import Optional
|
|
9
8
|
|
|
10
|
-
import whispers
|
|
11
|
-
|
|
12
9
|
from .config import CONFIG
|
|
13
10
|
from .utils import logger
|
|
14
11
|
from .utils.common import Encoder, convert_keys_to_primitives, strip_path
|
|
@@ -74,31 +71,46 @@ class StackSaver:
|
|
|
74
71
|
Returns:
|
|
75
72
|
None
|
|
76
73
|
"""
|
|
74
|
+
partial_match_pattern = re.compile(
|
|
75
|
+
r"(['\"])([^'\"]*?(%s)[^'\"]*?)(['\"])\s*([:,])\s*(['\"])([^'\"]*)(['\"])"
|
|
76
|
+
% (r"|".join(CONFIG.PARTIAL_MATCH_KEYS)),
|
|
77
|
+
re.IGNORECASE,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
full_match_pattern = re.compile(
|
|
81
|
+
r"(['\"])(%s)(['\"])\s*([:,])\s*(['\"])([^'\"]*)(['\"])" % (r"|".join(CONFIG.SENSITIVE_KEYS)), re.IGNORECASE
|
|
82
|
+
)
|
|
83
|
+
|
|
77
84
|
with open(file_path, "r") as f:
|
|
78
|
-
filedata = f.
|
|
85
|
+
filedata = f.read()
|
|
79
86
|
|
|
80
|
-
|
|
87
|
+
partial_replace = self.mask_data((1, 2, 5))
|
|
88
|
+
full_replace = self.mask_data((1, 2, 4))
|
|
81
89
|
|
|
82
|
-
|
|
90
|
+
masked_data = partial_match_pattern.sub(partial_replace, filedata)
|
|
91
|
+
masked_data = full_match_pattern.sub(full_replace, masked_data)
|
|
83
92
|
|
|
84
|
-
|
|
93
|
+
with open(file_path, "w") as file:
|
|
94
|
+
file.write(masked_data)
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
break
|
|
96
|
+
def mask_data(self, indicates: tuple):
|
|
97
|
+
"""A method to mask the data.
|
|
89
98
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
filedata[index] = line.replace(secret.value, secret.value[:1] + "***")
|
|
93
|
-
secrets.pop(secrets.index(secret))
|
|
94
|
-
break
|
|
99
|
+
Args:
|
|
100
|
+
indicates (tuple): The indicates of the data to be masked.
|
|
95
101
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
Returns:
|
|
103
|
+
function: The function to mask the data.
|
|
104
|
+
"""
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
def mask_sensitive(match):
|
|
107
|
+
if match.group(2):
|
|
108
|
+
quote = match.group(indicates[0])
|
|
109
|
+
key_part = match.group(indicates[1])
|
|
110
|
+
delimiter = match.group(indicates[2])
|
|
111
|
+
return f"{quote}{key_part}{quote}{delimiter} {quote}***{quote}"
|
|
112
|
+
|
|
113
|
+
return mask_sensitive
|
|
102
114
|
|
|
103
115
|
def save_stack_trace(self, exception: Optional[Exception] = None):
|
|
104
116
|
"""A method to save the stack trace.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: t_bug_catcher
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Summary: Bug catcher
|
|
5
5
|
Home-page: https://www.thoughtful.ai/
|
|
6
6
|
Author: Thoughtful
|
|
@@ -14,7 +14,6 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Requires-Dist: requests<3.0.0,>=2.31.0
|
|
15
15
|
Requires-Dist: bugsnag>=4.6.1
|
|
16
16
|
Requires-Dist: retry~=0.9.2
|
|
17
|
-
Requires-Dist: whispers>=2.2.1
|
|
18
17
|
|
|
19
18
|
t-bug-catcher
|
|
20
19
|
==============
|
|
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
|