The proposed fix no longer allows the reported security issue, but can we block it at the API level too?
If the neutron API does not allow multi-line string in the API level, we can block it for further API operations.
Note that we need to consider such extra_dhcp_options is already injected, so the proposed fix is required and it looks good.
Perhaps blocking it at the API level is optional so it can be done as a follow-up after the proposed fix is applied.
What in my mind is to implement a validator like below in the API level.
def _validate_oneline_string(data, max_len=None):
msg = validators.validate_string(data, max_len)
if msg:
return msg
lines = data.splitlines()
if lines and lines[0] != data:
msg = _("Multi-line string is not allowed: '%s'") % data LOG.debug(msg)
return msg
The proposed fix no longer allows the reported security issue, but can we block it at the API level too?
If the neutron API does not allow multi-line string in the API level, we can block it for further API operations.
Note that we need to consider such extra_dhcp_options is already injected, so the proposed fix is required and it looks good.
Perhaps blocking it at the API level is optional so it can be done as a follow-up after the proposed fix is applied.
What in my mind is to implement a validator like below in the API level.
def _validate_ oneline_ string( data, max_len=None): validate_ string( data, max_len)
LOG.debug( msg)
msg = validators.
if msg:
return msg
lines = data.splitlines()
if lines and lines[0] != data:
msg = _("Multi-line string is not allowed: '%s'") % data
return msg