Debian: Bootstrap fails to complete due to invalid chars validation

Bug #1954940 reported by Rafael Lucas Camargos
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
High
Rafael Lucas Camargos

Bug Description

Brief Description
-----------------
This issue is reported by Dan Voiculeasa during Debian testing

Investigation: capabilities is a dict.

controller-0:~$ cat re_.py
import re
import jsonpatch

ALLOWED_CHARS = r"^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};:\'\"|,.<>\/? ]*$"

patch = [{'op': 'replace', 'path': '/system_mode', 'value': 'simplex'}, {'op': 'replace', 'path': '/capabilities', 'value': {'region_config': False, 'vswitch_type': 'none', 'shared_services': '[]', 'sdn_enabled': False, 'https_enabled': False}}, {'op': 'replace', 'path': '/timezone', 'value': 'UTC'}, {'op': 'replace', 'path': '/region_name', 'value': 'RegionOne'}, {'op': 'replace', 'path': '/service_project_name', 'value': 'services'}, {'op': 'replace', 'path': '/distributed_cloud_role', 'value': None}, {'op': 'replace', 'path': '/system_type', 'value': 'All-in-one'}]

#patch = [{u'path': u'/system_mode', u'value': u'simplex', u'op': u'replace'}, {u'path': u'/region_name', u'value': u'RegionOne', u'op': u'replace'}, {u'path': u'/service_project_name', u'value': u'services', u'op': u'replace'}, {u'path': u'/distributed_cloud_role', u'value': None, u'op': u'replace'}, {u'path': u'/capabilities', u'value': {u'https_enabled': False, u'vswitch_type': u'none', u'region_config': False, u'sdn_enabled': False, u'shared_services': u'[]'}, u'op': u'replace'}, {u'path': u'/system_type', u'value': u'All-in-one', u'op': u'replace'}, {u'path': u'/timezone', u'value': u'UTC', u'op': u'replace'}]

for p in jsonpatch.JsonPatch(patch):

    print(p['value'])
    if p['value'] is not None:
        re.match(ALLOWED_CHARS, p['value'])
controller-0:~$ python2 re_.py
simplex
{'https_enabled': False, 'vswitch_type': 'none', 'region_config': False, 'sdn_enabled': False, 'shared_services': '[]'}
Traceback (most recent call last):

  File "re_.py", line 13, in <module>
    re.match(ALLOWED_CHARS, p['value'])
  File "/usr/lib64/python2.7/re.py", line 137, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or buffer

The following commit is suspect: https://review.opendev.org/c/starlingx/config/+/819038

Severity
--------
N/A

Steps to Reproduce
------------------
N/A

Expected Behavior
------------------
Boostrap should complete

Actual Behavior
----------------
N/A

Reproducibility
---------------
N/A

System Configuration
--------------------
N/A

Branch/Pull Time/Commit
-----------------------
N/A

Last Pass
---------
N/A

Timestamp/Logs
--------------

sysinv 2021-12-15 13:59:36.237 64179 ERROR wsme.api [-] Server-side error: "expected string or bytes-like object". Detail:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/wsmeext/pecan.py", line 84, in callfunction
result = f(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/sysinv/api/controllers/v1/system.py", line 415, in patch
if p['value'] is not None and not re.match(ALLOWED_CHARS, p['value']):
File "/usr/lib/python3.9/re.py", line 191, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

Test Activity
-------------
Feature Testing

Workaround
----------
N/A

Changed in starlingx:
status: New → In Progress
Revision history for this message
Al Bailey (albailey1974) wrote :

The original submission merged in Novemember.
The fix for this bug likely needs to be picked to stx/6

Revision history for this message
Al Bailey (albailey1974) wrote :

Note: we would only need to port to stx 6 if we think the underlying problem will be somethign a user will encounter.
The severity, steps to reproduce, etc.. do not indicate how likely or severe or recoverable this issue is.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/821769
Committed: https://opendev.org/starlingx/config/commit/bf8be875e7883000d2b87dad00161a6a3369f8ef
Submitter: "Zuul (22348)"
Branch: master

commit bf8be875e7883000d2b87dad00161a6a3369f8ef
Author: Rafael Camargos <email address hidden>
Date: Wed Dec 15 17:15:34 2021 +0000

    Revert "Add validation of special chars on system values"

    This reverts commit f096dcf15903a3b962182f5b85d173a0b1523dd2.

    Reason for revert: Issues were found in bootstrap phase.

    Closes-Bug: 1954940
    Change-Id: I2fb58880a847d89338e4483d6abb4c65e9f3a3a3

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → High
assignee: nobody → Rafael Lucas Camargos (rcamargo)
tags: added: stx.6.0 stx.config
Revision history for this message
Ghada Khalil (gkhalil) wrote :

Given this issue is seen with Debian bootstrap only, the original commit does not need to be reverted from the r/stx.6.0 release branch

description: updated
tags: added: stx.7.0
removed: stx.6.0
summary: - Bootstrap fails to complete due to invalid chars validation
+ Debian: Bootstrap fails to complete due to invalid chars validation
Ghada Khalil (gkhalil)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.