Skip to content

Conversation

@iamkaroko
Copy link
Collaborator

No description provided.

unique_values = person_rows[col].unique()
if len(unique_values) > 1:
inconsistent_count += 1
logger.warning(f"Person {person_id}: {col} has inconsistent values {list(unique_values)}")

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

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

Copilot Autofix

AI about 2 months ago

The best way to fix the problem is to avoid logging cleartext sensitive data—specifically, do not log the actual field values (unique_values) and potentially avoid logging the column name in detail. Instead, log only that inconsistency was detected for a given person and column in a generic way. Optionally, you may log the column header (if that is not sensitive in context), but never the actual data. Alternatively, log only the count and perhaps person_id (if not sensitive), or consider hashing the data if necessary for debugging. To implement this:

  • Edit the log message on line 530.
  • Instead of logging the full value list for the inconsistent field, just report the occurrence discretely without exposing value contents.
  • No extra imports are needed.
Suggested changeset 1
script/answer_export/export_answers_to_csv.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/script/answer_export/export_answers_to_csv.py b/script/answer_export/export_answers_to_csv.py
--- a/script/answer_export/export_answers_to_csv.py
+++ b/script/answer_export/export_answers_to_csv.py
@@ -527,7 +527,7 @@
                 unique_values = person_rows[col].unique()
                 if len(unique_values) > 1:
                     inconsistent_count += 1
-                    logger.warning(f"Person {person_id}: {col} has inconsistent values {list(unique_values)}")
+                    logger.warning(f"Person {person_id}: {col} has inconsistent values (suppressed for privacy)")
         
         if inconsistent_count > 0:
             logger.error(f"Validation failed: {inconsistent_count} inconsistent fields found")
EOF
@@ -527,7 +527,7 @@
unique_values = person_rows[col].unique()
if len(unique_values) > 1:
inconsistent_count += 1
logger.warning(f"Person {person_id}: {col} has inconsistent values {list(unique_values)}")
logger.warning(f"Person {person_id}: {col} has inconsistent values (suppressed for privacy)")

if inconsistent_count > 0:
logger.error(f"Validation failed: {inconsistent_count} inconsistent fields found")
Copilot is powered by AI and may make mistakes. Always verify output.
@iamkaroko iamkaroko merged commit 89721e9 into main Nov 19, 2025
3 of 5 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.

2 participants