gitlab-watcher 1.0.0__tar.gz → 1.0.1__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.
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/PKG-INFO +1 -1
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/pyproject.toml +1 -1
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/logging_utils.py +24 -1
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/processor.py +6 -5
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/watcher.py +4 -3
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/PKG-INFO +1 -1
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_processor.py +4 -1
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/README.md +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/setup.cfg +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/__init__.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/__main__.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/cache.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/cli.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/config.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/discord.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/exceptions.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/git_ops.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/gitlab_client.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/protocols.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher/state.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/SOURCES.txt +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/dependency_links.txt +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/entry_points.txt +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/requires.txt +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/top_level.txt +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_cache.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_config.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_config_extra.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_discord.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_git_ops.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_gitlab_client.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_logging_utils.py +0 -0
- {gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/tests/test_watcher.py +0 -0
|
@@ -53,4 +53,27 @@ class SensitiveDataFilter(logging.Filter):
|
|
|
53
53
|
return text
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
def sanitize_for_log(text: str) -> str:
|
|
57
|
+
"""Sanitize string for logging to prevent log injection.
|
|
58
|
+
|
|
59
|
+
Removes newlines and non-printable characters.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
text: The string to sanitize
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
The sanitized string
|
|
66
|
+
"""
|
|
67
|
+
if not text:
|
|
68
|
+
return ""
|
|
69
|
+
|
|
70
|
+
# Replace newlines and tabs with spaces
|
|
71
|
+
text = text.replace("\r", " ").replace("\n", " ").replace("\t", " ")
|
|
72
|
+
|
|
73
|
+
# Remove non-printable characters
|
|
74
|
+
text = "".join(c for c in text if c.isprintable())
|
|
75
|
+
|
|
76
|
+
return text.strip()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
__all__ = ["SensitiveDataFilter", "sanitize_for_log"]
|
|
@@ -11,6 +11,7 @@ from .config import ProjectConfig
|
|
|
11
11
|
from .discord import DiscordWebhook
|
|
12
12
|
from .git_ops import GitOps
|
|
13
13
|
from .gitlab_client import GitLabClient, Issue, MergeRequest, Note
|
|
14
|
+
from .logging_utils import SensitiveDataFilter, sanitize_for_log
|
|
14
15
|
from .protocols import GitOperations
|
|
15
16
|
from .state import StateManager
|
|
16
17
|
|
|
@@ -178,9 +179,9 @@ class Processor:
|
|
|
178
179
|
safe_prompt,
|
|
179
180
|
]
|
|
180
181
|
elif self.ai_tool_mode == "direct":
|
|
181
|
-
cmd = ["claude", "-p", "--permission-mode", "acceptEdits", safe_prompt]
|
|
182
|
+
cmd = ["claude", "-p", "--permission-mode", "acceptEdits", "--", safe_prompt]
|
|
182
183
|
elif self.ai_tool_mode == "opencode":
|
|
183
|
-
cmd = ["opencode", safe_prompt]
|
|
184
|
+
cmd = ["opencode", "--", safe_prompt]
|
|
184
185
|
elif self.ai_tool_mode == "custom":
|
|
185
186
|
if not self.ai_tool_custom_command:
|
|
186
187
|
return False, "AI_TOOL_CUSTOM_COMMAND not set for custom mode"
|
|
@@ -242,7 +243,7 @@ class Processor:
|
|
|
242
243
|
branch = self._validate_branch_name(f"{issue.iid}-{slug}")
|
|
243
244
|
|
|
244
245
|
self.logger.info(
|
|
245
|
-
f"[{project.name}] Processing issue #{issue.iid}: {validated_title}"
|
|
246
|
+
f"[{project.name}] Processing issue #{issue.iid}: {sanitize_for_log(validated_title)}"
|
|
246
247
|
)
|
|
247
248
|
self.logger.debug(f"[{project.name}] Creating branch: {branch}")
|
|
248
249
|
|
|
@@ -326,7 +327,7 @@ Do not add Co-Authored-By signature to commits."""
|
|
|
326
327
|
self.discord.notify_error(
|
|
327
328
|
project.name,
|
|
328
329
|
f"Processing failed for issue #{issue.iid}",
|
|
329
|
-
output,
|
|
330
|
+
sanitize_for_log(output),
|
|
330
331
|
)
|
|
331
332
|
|
|
332
333
|
self.state.set_processing(project.project_id, False)
|
|
@@ -395,7 +396,7 @@ Do not add Co-Authored-By signature to commits."""
|
|
|
395
396
|
self.discord.notify_error(
|
|
396
397
|
project.name,
|
|
397
398
|
f"Processing failed for MR !{mr.iid}",
|
|
398
|
-
output,
|
|
399
|
+
sanitize_for_log(output),
|
|
399
400
|
)
|
|
400
401
|
|
|
401
402
|
self.state.set_processing(project.project_id, False)
|
|
@@ -11,7 +11,7 @@ from .discord import DiscordWebhook
|
|
|
11
11
|
from .exceptions import GitLabError
|
|
12
12
|
from .git_ops import GitOps
|
|
13
13
|
from .gitlab_client import GitLabClient
|
|
14
|
-
from .logging_utils import SensitiveDataFilter
|
|
14
|
+
from .logging_utils import SensitiveDataFilter, sanitize_for_log
|
|
15
15
|
from .processor import Processor
|
|
16
16
|
from .state import StateManager
|
|
17
17
|
|
|
@@ -159,7 +159,7 @@ class Watcher:
|
|
|
159
159
|
if not has_in_progress and not has_review:
|
|
160
160
|
self._log(
|
|
161
161
|
project.project_id,
|
|
162
|
-
f"Found backlog issue #{issue.iid}: {issue.title}",
|
|
162
|
+
f"Found backlog issue #{issue.iid}: {sanitize_for_log(issue.title)}",
|
|
163
163
|
)
|
|
164
164
|
self.state.set_processing(project.project_id, True)
|
|
165
165
|
self.processor.process_issue(project, issue)
|
|
@@ -222,7 +222,8 @@ class Watcher:
|
|
|
222
222
|
and latest_note.author_username != self.config.gitlab_username
|
|
223
223
|
):
|
|
224
224
|
self._log(
|
|
225
|
-
project.project_id,
|
|
225
|
+
project.project_id,
|
|
226
|
+
f"New comment on MR !{mr.iid}: {sanitize_for_log(latest_note.body)}",
|
|
226
227
|
)
|
|
227
228
|
self.state.set_processing(project.project_id, True)
|
|
228
229
|
self.processor.process_comment(project, mr, latest_note.body)
|
|
@@ -215,6 +215,8 @@ class TestProcessorAIToolModes:
|
|
|
215
215
|
args = mock_run.call_args[0][0]
|
|
216
216
|
assert args[0] == "claude"
|
|
217
217
|
assert args[1] == "-p"
|
|
218
|
+
assert args[4] == "--"
|
|
219
|
+
assert args[5] == "Fix the bug"
|
|
218
220
|
assert "ollama" not in args
|
|
219
221
|
|
|
220
222
|
@patch("subprocess.run")
|
|
@@ -301,7 +303,8 @@ class TestProcessorAIToolModes:
|
|
|
301
303
|
assert success is True
|
|
302
304
|
args = mock_run.call_args[0][0]
|
|
303
305
|
assert args[0] == "opencode"
|
|
304
|
-
assert args[1] == "
|
|
306
|
+
assert args[1] == "--"
|
|
307
|
+
assert args[2] == "Fix the bug"
|
|
305
308
|
|
|
306
309
|
def test_run_claude_invalid_mode(
|
|
307
310
|
self,
|
|
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
|
{gitlab_watcher-1.0.0 → gitlab_watcher-1.0.1}/src/gitlab_watcher.egg-info/dependency_links.txt
RENAMED
|
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
|