Phase 0 cleanup: quieter terminal output, PDF encoding fix, and dead-code removal#117
Merged
Conversation
…code removal ## Summary Housekeeping pass that reduces terminal noise, fixes a latent PDF crash, and removes dead code, with no change to scanning behavior or report contents. ## Changes ### Cleaner terminal output - Internal logs now write to `stderr` (keeping `stdout` clean) and stay quiet in CLI mode, so raw location-tagged lines like `WARNING - docksec.docker_scanner - Line 451: ...` no longer interleave with the tool's own `[INFO]/[WARNING]` messages. - Added `DOCKSEC_LOG_LEVEL` (e.g. `DOCKSEC_LOG_LEVEL=DEBUG`) to restore verbose logging for troubleshooting. - Suppressed the noisy `PyFPDF & fpdf2` import warning that printed on every run. ### Fixed - PDF generation no longer fails on non-latin-1 characters (bullets, smart quotes, em dashes, emoji) in vulnerability titles, scanner output, or AI findings. All PDF text is now sanitized consistently through the core-font-safe encoder. ### Removed - The unused `-o/--output` CLI flag (declared but never wired up). - Duplicate, dead report-writer methods on `DockerSecurityScanner`; `ReportGenerator` is now the single source for JSON/CSV/PDF/HTML output. - The leftover `compose_scanner_cli.py` placeholder module. ## Testing - `pytest`: 85 passed (5 new tests covering logger behavior, PDF Unicode safety, and rejection of the removed flag). - Manual end-to-end `--scan-only` run confirmed: no leaked log lines, no fpdf warning, all four reports generated, exit code 0. ## Notes - No user-facing behavior or report format changed; this is cleanup only. - Remaining output-polish items (progress-bar ordering, `=== banners ===`, format selection, `--fail-on`) are intentionally deferred to the Phase 1 output overhaul.
| import logging | ||
| from docksec.utils import get_custom_logger | ||
|
|
||
| logger = get_custom_logger('TestLoggerHandlers') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Housekeeping pass that reduces terminal noise, fixes a latent PDF crash, and removes
dead code, with no change to scanning behavior or report contents.
Changes
Cleaner terminal output
stderr(keepingstdoutclean) and stay quiet in CLImode, so raw location-tagged lines like
WARNING - docksec.docker_scanner - Line 451: ...no longer interleave with thetool's own
[INFO]/[WARNING]messages.DOCKSEC_LOG_LEVEL(e.g.DOCKSEC_LOG_LEVEL=DEBUG) to restore verbose loggingfor troubleshooting.
PyFPDF & fpdf2import warning that printed on every run.Fixed
dashes, emoji) in vulnerability titles, scanner output, or AI findings. All PDF text
is now sanitized consistently through the core-font-safe encoder.
Removed
-o/--outputCLI flag (declared but never wired up).DockerSecurityScanner;ReportGeneratoris now the single source for JSON/CSV/PDF/HTML output.
compose_scanner_cli.pyplaceholder module.Testing
pytest: 85 passed (5 new tests covering logger behavior, PDF Unicode safety, andrejection of the removed flag).
--scan-onlyrun confirmed: no leaked log lines, no fpdf warning,all four reports generated, exit code 0.
Notes
=== banners ===, formatselection,
--fail-on) are intentionally deferred to the Phase 1 output overhaul.