Skip to content

Commit

Permalink
[3.0.39] Fix: Hardening resolve script path
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricelambert committed Jun 28, 2024
1 parent 0488c71 commit 52f3dda
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion WebScripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
This tool runs CLI scripts and displays output in a Web Interface.
"""

__version__ = "3.0.38"
__version__ = "3.0.39"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand Down
2 changes: 1 addition & 1 deletion WebScripts/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
This tool runs CLI scripts and displays output in a Web Interface.
"""

__version__ = "3.0.38"
__version__ = "3.0.39"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand Down
20 changes: 15 additions & 5 deletions WebScripts/harden.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
This file hardens the WebScripts installation and configuration.
"""

__version__ = "0.0.9"
__version__ = "0.0.10"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand Down Expand Up @@ -323,26 +323,36 @@ def harden_script(self, section: dict, filename: str) -> None:
"""

logger_info("Hardens script " + repr(filename))
logger_debug("Add the launcher")
logger_debug(f"Add launcher {executable!r} for {filename!r}")
section["launcher"] = executable
specific_config_file = section.get("configuration_file")

if specific_config_file:
specific_config_file = basename(specific_config_file)

script_name, _ = splitext(basename(filename))
logger_info(f"Configure script named: {script_name}")
logger_info("Configure script named: " + repr(script_name))
for config_file in self.json_config_files:
if config_file.endswith(specific_config_file):
section["configuration_file"] = config_file
self.get_configurations(config_file, filename)
break
else:
logger_error(
"Configuration file not found for " + repr(filename)
)

for py_filename in self.py_scripts_files:
if py_filename.endswith(filename):
logger_debug("Add the script absolute path.")
py_basename = basename(py_filename)
if py_basename == filename:
logger_debug(
"Add the script absolute path"
f" {py_filename!r} for {filename!r}."
)
section["path"] = py_filename
break
else:
logger_error("Script file not found for " + repr(filename))

def linux_hardening_file_permissions(self) -> None:
"""
Expand Down

0 comments on commit 52f3dda

Please sign in to comment.