Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ def pack_repo():
if state.verbose:
repopack_cmd.append("--verbose")

# Print the full command being executed
print(f"Executing command: {' '.join(repopack_cmd)}", file=sys.stderr)
# Print the sanitized command being executed
sanitized_cmd = hide_credentials(' '.join(repopack_cmd))
print(f"Executing command: {sanitized_cmd}", file=sys.stderr)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (password)](1) as clear text.

Copilot Autofix

AI over 1 year ago

To fix the problem, we need to ensure that sensitive information such as passwords is never logged, even if the sanitization function fails. One way to achieve this is to avoid logging the command entirely or to log only non-sensitive parts of the command. We can modify the code to log a generic message indicating that a command is being executed without including the actual command details.

Suggested changeset 1
app.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -66,5 +66,4 @@
 
-    # Print the sanitized command being executed
-    sanitized_cmd = hide_credentials(' '.join(repopack_cmd))
-    print(f"Executing command: {sanitized_cmd}", file=sys.stderr)
+    # Log a generic message indicating that a command is being executed
+    print("Executing repopack command", file=sys.stderr)
 
EOF
@@ -66,5 +66,4 @@

# Print the sanitized command being executed
sanitized_cmd = hide_credentials(' '.join(repopack_cmd))
print(f"Executing command: {sanitized_cmd}", file=sys.stderr)
# Log a generic message indicating that a command is being executed
print("Executing repopack command", file=sys.stderr)

Copilot is powered by AI and may make mistakes. Always verify output.

try:
process = subprocess.Popen(repopack_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
Expand Down