Skip to content

Commit

Permalink
Merge pull request #1099 from rajithkrishnegowda/fix-coverity-file-fix
Browse files Browse the repository at this point in the history
Fix path manipulation coverity vulnerability issue
  • Loading branch information
rahulga1 authored Oct 25, 2024
2 parents ccca88e + 6c9c002 commit bdc6d15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openfl/interface/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""CLI module."""
import logging
import os
import re
import sys
import time
import warnings
Expand Down Expand Up @@ -181,6 +182,9 @@ def cli(context, log_level, no_warnings):
# This will be overridden later with user selected debugging level
disable_warnings()
log_file = os.getenv("LOG_FILE")
# Validate log_file using allow list approach
if log_file and not re.match(r"^[\w\-.]+$", log_file):
raise ValueError("Invalid log file path")
setup_logging(log_level, log_file)
sys.stdout.reconfigure(encoding="utf-8")

Expand Down

0 comments on commit bdc6d15

Please sign in to comment.