Skip to content

Commit 52f3dda

Browse files
[3.0.39] Fix: Hardening resolve script path
1 parent 0488c71 commit 52f3dda

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

WebScripts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This tool runs CLI scripts and displays output in a Web Interface.
2424
"""
2525

26-
__version__ = "3.0.38"
26+
__version__ = "3.0.39"
2727
__author__ = "Maurice Lambert"
2828
__author_email__ = "[email protected]"
2929
__maintainer__ = "Maurice Lambert"

WebScripts/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
This tool runs CLI scripts and displays output in a Web Interface.
2424
"""
2525

26-
__version__ = "3.0.38"
26+
__version__ = "3.0.39"
2727
__author__ = "Maurice Lambert"
2828
__author_email__ = "[email protected]"
2929
__maintainer__ = "Maurice Lambert"

WebScripts/harden.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
This file hardens the WebScripts installation and configuration.
2626
"""
2727

28-
__version__ = "0.0.9"
28+
__version__ = "0.0.10"
2929
__author__ = "Maurice Lambert"
3030
__author_email__ = "[email protected]"
3131
__maintainer__ = "Maurice Lambert"
@@ -323,26 +323,36 @@ def harden_script(self, section: dict, filename: str) -> None:
323323
"""
324324

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

330330
if specific_config_file:
331331
specific_config_file = basename(specific_config_file)
332332

333333
script_name, _ = splitext(basename(filename))
334-
logger_info(f"Configure script named: {script_name}")
334+
logger_info("Configure script named: " + repr(script_name))
335335
for config_file in self.json_config_files:
336336
if config_file.endswith(specific_config_file):
337337
section["configuration_file"] = config_file
338338
self.get_configurations(config_file, filename)
339339
break
340+
else:
341+
logger_error(
342+
"Configuration file not found for " + repr(filename)
343+
)
340344

341345
for py_filename in self.py_scripts_files:
342-
if py_filename.endswith(filename):
343-
logger_debug("Add the script absolute path.")
346+
py_basename = basename(py_filename)
347+
if py_basename == filename:
348+
logger_debug(
349+
"Add the script absolute path"
350+
f" {py_filename!r} for {filename!r}."
351+
)
344352
section["path"] = py_filename
345353
break
354+
else:
355+
logger_error("Script file not found for " + repr(filename))
346356

347357
def linux_hardening_file_permissions(self) -> None:
348358
"""

0 commit comments

Comments
 (0)