Skip to content

[BUG]: Removed Duplicate function#924

Open
direkkakkar319-ops wants to merge 1 commit into
repository-service-tuf:mainfrom
direkkakkar319-ops:duplicatefunction-DirekKakkar
Open

[BUG]: Removed Duplicate function#924
direkkakkar319-ops wants to merge 1 commit into
repository-service-tuf:mainfrom
direkkakkar319-ops:duplicatefunction-DirekKakkar

Conversation

@direkkakkar319-ops

Copy link
Copy Markdown

Signed-off-by:direkkakkar319-ops millioniar1717@gmail.com

Description

logging.basicConfig() is called twice with different levels (DEBUG then INFO). In CPython, basicConfig() is a no-op after the first call because it checks if len(root.handlers) == 0. The second call is silently ignored, so the intended INFO level is never applied — DEBUG wins, leaking verbose internals to production logs.

logging.basicConfig(level=logging.DEBUG, ...)  # wins
logging.basicConfig(level=logging.INFO, ...)   # silently ignored

impact

All production deployments run at DEBUG verbosity, potentially leaking sensitive signing data, task IDs, and Redis connection info into log sinks

Solution

import os
log_level = getattr(logging, os.getenv("RSTUF_LOG_LEVEL", "INFO").upper(), logging.INFO)
logging.basicConfig(
    level=log_level,
    format="%(asctime)s %(levelname)s %(message)s",
    datefmt="%H:%M:%S",
)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Code of Conduct

  • I agree to follow this project's Code of Conduct

py-tests are passing
commands

(venv) direk@dkakkar:/mnt/f/repository-service-tuf-api$ export RSTUF_BOOTSTRAP_NODE=true
export RSTUF_BROKER_SERVER=fakeserver
export RSTUF_REDIS_SERVER=redis://fakeredis
pytest
Image

pre-commits are passing
commands

(venv) direk@dkakkar:/mnt/f/repository-service-tuf-api$ make precommit 
Image

Signed-off-by:direkkakkar319-ops <millioniar1717@gmail.com>
Signed-off-by: Direk Kakkar <millioniar1717@gmail.com>
@direkkakkar319-ops direkkakkar319-ops force-pushed the duplicatefunction-DirekKakkar branch from a3b8fca to 16583f8 Compare April 9, 2026 05:56
@direkkakkar319-ops

Copy link
Copy Markdown
Author

HI, @kairoaraujo this pr is ready for review . Happy to make any changes if requiured

@direkkakkar319-ops direkkakkar319-ops marked this pull request as ready for review April 9, 2026 06:00
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