Skip to content

Security: Sensitive Token Data Exposure in Migration Logging#2177

Open
tomaioo wants to merge 1 commit into
aboutcode-org:mainfrom
tomaioo:fix/security/sensitive-token-data-exposure-in-migrati
Open

Security: Sensitive Token Data Exposure in Migration Logging#2177
tomaioo wants to merge 1 commit into
aboutcode-org:mainfrom
tomaioo:fix/security/sensitive-token-data-exposure-in-migrati

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Security: Sensitive Token Data Exposure in Migration Logging

Problem

Severity: Low | File: scanpipe/migrations/0079_apitoken_data.py:L35

Migration 0079_apitoken_data.py prints the count of migrated tokens with print(f" -> {len(migrated_tokens)} tokens migrated."). While this only logs the count, the migration handles sensitive API token data. More importantly, the migration reads plaintext tokens from the authtoken_token table and hashes them with make_password(key). The use of print() in migrations can leak information to logs, and the migration's handling of plaintext tokens should ensure no token values are ever logged.

Solution

Remove the print statement or replace it with proper logging at an appropriate level. Ensure that no token values, prefixes, or hashes are ever logged. Consider using Django's migration logging framework instead of print().

Changes

  • scanpipe/migrations/0079_apitoken_data.py (modified)

Migration 0079_apitoken_data.py prints the count of migrated tokens with `print(f" -> {len(migrated_tokens)} tokens migrated.")`. While this only logs the count, the migration handles sensitive API token data. More importantly, the migration reads plaintext tokens from the `authtoken_token` table and hashes them with `make_password(key)`. The use of `print()` in migrations can leak information to logs, and the migration's handling of plaintext tokens should ensure no token values are ever logged.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
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