Skip to content

Bug: CWE-798 - Compliant code example seems a bit outdated and throws an error on Python3.13.2 #1000

@BartKaras1128

Description

@BartKaras1128

CWE-798 should be revisited before release.

compliant01.py throws a Permission denied error due to The config.ini file has read-only permissions, hence we can never delete it... and the tearDown function throws an error.

Also, we should remove exist_ok=True from the Path() call as that seems to be deprecated since Python3.12 and getting removed in Python 3.14

c:\Users\ebakrra\OneDrive - Ericsson\Desktop\test.py:45: DeprecationWarning: support for supplying keyword arguments to pathlib.PurePath is deprecated and scheduled for removal in Python 3.14
  self.config_file_path = Path("config.ini", exist_ok=True)
E
======================================================================
ERROR: test_front_end (__main__.TestSimulateDeployingFrontEnd.test_front_end)
Verify front_end implementation
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\Users\ebakrra\OneDrive - Ericsson\Desktop\test.py", line 46, in setUp
    with open(self.config_file_path, "w", encoding="utf-8") as config_file:
         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'config.ini'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions