Describe the bug
Secrets redaction logic causes result XML to be truncated. This bug affects pyRACF version 1.0a2.
[pyRACF:Debug]
Result XML
UserAdmin.set_password()
<?xml version="1.0" encoding="IBM-1047"?>
<securityresult xmlns="http://www.ibm.com/systems/zos/saf/IRRSMO00Result1">
<user name="SQUIDWRD" operation="set" requestid="UserRequest">
<info>Definition exists. Add command skipped due to precheck option</info>
<command>
<safreturncode>0</safreturncode>
<returncode>0</returncode>
<reasoncode>0</reasoncode>
<image>
Traceback (most recent call last):
File "/usr/lpp/IBM/cyp/v3r11/pyz/lib/python3.11/xml/etree/ElementTree.py", line 1716, in close
self.parser.Parse(b"", True) # end of data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xml.parsers.expat.ExpatError: no element found: line 1, column 394
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/u/<userid>/.local/lib/python3.11/site-packages/pyracf/user/user_admin.py", line 288, in set_password
result = self.alter(userid, traits={"base:password": password})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/<userid>/.local/lib/python3.11/site-packages/pyracf/user/user_admin.py", line 410, in alter
return self._make_request(user_request, irrsmo00_precheck=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/<userid>/.local/lib/python3.11/site-packages/pyracf/common/security_admin.py", line 174, in _make_request
results = SecurityResult(result_xml)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/<userid>/.local/lib/python3.11/site-packages/pyracf/common/security_result.py", line 12, in __init__
self.__result = XMLParser.fromstring(result_xml)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/<userid>/.local/lib/python3.11/site-packages/defusedxml/common.py", line 127, in fromstring
return parser.close()
^^^^^^^^^^^^^^
File "/usr/lpp/IBM/cyp/v3r11/pyz/lib/python3.11/xml/etree/ElementTree.py", line 1718, in close
self._raiseerror(v)
File "/usr/lpp/IBM/cyp/v3r11/pyz/lib/python3.11/xml/etree/ElementTree.py", line 1618, in _raiseerror
raise err
To Reproduce
Steps to reproduce the behavior:
from pyracf import UserAdmin
user_admin = UserAdmin()
user_admin.set_password("userid", "password")
Expected behavior
A description of what you expected to happen.
Result XML should not be truncated when secrets are redacted. Secrets redaction should complete successfully with no issues.
Describe the bug Secrets redaction logic causes result XML to be truncated. This bug affects pyRACF version 1.0a2.
To Reproduce Steps to reproduce the behavior:
Expected behavior A description of what you expected to happen.
Result XML should not be truncated when secrets are redacted. Secrets redaction should complete successfully with no issues.
Console Output
Environment Information:
Additional context
This bug can be fixed by changing the following line in the
redact_result_xml
function incommon/logger.py
as follows.Code that is causing bug:
Fixed code (remove the space from the last argument):