Skip to content

Postgres tests and fixes#2

Merged
vinaysingh8866 merged 9 commits intomainfrom
postgres-tests-and-fixes
Oct 23, 2025
Merged

Postgres tests and fixes#2
vinaysingh8866 merged 9 commits intomainfrom
postgres-tests-and-fixes

Conversation

@vinaysingh8866
Copy link

No description provided.

Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
redacted_uri = base_uri + f"{account}:***@{config_url}/{db_name}"
if params:
redacted_uri += "?" + urllib.parse.urlencode(params)
LOGGER.debug("Generated PostgreSQL URI: %s", redacted_uri)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

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

Copilot Autofix

AI 4 months ago

To fix the problem, further redact the URI in log output so that any possibly sensitive credential information (including both the password and the account/username) is removed or obscured. Replace account with a general placeholder (such as ***) or exclude it from the logged URI altogether. Only non-sensitive fields should be emitted to logs. Specifically, in the _build_postgres_dbstore_uri method, change how redacted_uri is constructed so that it replaces account with *** (or another placeholder). Update the log statement (line 260) accordingly. No functional change to the returned (actual) URI construction is needed—only the logged version should be changed. No additional imports or dependencies are needed.


Suggested changeset 1
acapy_agent/kanon/store_kanon.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/acapy_agent/kanon/store_kanon.py b/acapy_agent/kanon/store_kanon.py
--- a/acapy_agent/kanon/store_kanon.py
+++ b/acapy_agent/kanon/store_kanon.py
@@ -254,7 +254,8 @@
             uri += "?" + urllib.parse.urlencode(params)
 
         # Log redacted version for security
-        redacted_uri = base_uri + f"{account}:***@{config_url}/{db_name}"
+        # Redact both account and password
+        redacted_uri = base_uri + f"***:***@{config_url}/{db_name}"
         if params:
             redacted_uri += "?" + urllib.parse.urlencode(params)
         LOGGER.debug("Generated PostgreSQL URI: %s", redacted_uri)
EOF
@@ -254,7 +254,8 @@
uri += "?" + urllib.parse.urlencode(params)

# Log redacted version for security
redacted_uri = base_uri + f"{account}:***@{config_url}/{db_name}"
# Redact both account and password
redacted_uri = base_uri + f"***:***@{config_url}/{db_name}"
if params:
redacted_uri += "?" + urllib.parse.urlencode(params)
LOGGER.debug("Generated PostgreSQL URI: %s", redacted_uri)
Copilot is powered by AI and may make mistakes. Always verify output.
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
Signed-off-by: Vinay Singh <vinay@verid.id>
@vinaysingh8866 vinaysingh8866 merged commit c21c82f into main Oct 23, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments