Skip to content

Commit

Permalink
CA-358870: Fix 1: filter_xapi_clusterd_db: remove token from the report
Browse files Browse the repository at this point in the history
The 'token' is an API token that is used to authenticate all API
requests to the xapi-clusterd daemon.

- Apply the fix originally developed and tested by Edwin.
- Update the tests:

  - Ensure that the fix works and keeps working across future changes.

Co-authored-by: Bernhard Kaindl <[email protected]>
Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok and bernhardkaindl committed Feb 8, 2024
1 parent 8fe49eb commit bad4e07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions tests/unit/test_filter_xapi_clusterd_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
# Same as original, but with passwords and private data replaced by: "REMOVED"
# BUG: "secret-token" has to be replaced by "REMOVED"
EXPECTED = r"""{
"token": "secret-token",
"token": "REMOVED",
"cluster_config": {
"pems": {
"blobs": "REMOVED"
Expand Down Expand Up @@ -197,7 +197,6 @@ def test_pems_blobs(bugtool):


# CA-358870: filter_xapi_clusterd_db: remove token from the report
@pytest.mark.xfail(reason="bugtool currently fails to remove the token")
@pytest.mark.usefixtures("tmpdir")
def test_remove_token(bugtool):
"""CA-358870: Assert that filter_xapi_clusterd_db() removes the token"""
Expand Down
2 changes: 2 additions & 0 deletions xen-bugtool
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,8 @@ def filter_xapi_clusterd_db(cap):
clusterd_data[config_key]['pems']['blobs'] = "REMOVED"
clusterd_data[config_key]['authkey'] = "REMOVED"

if "token" in clusterd_data:
clusterd_data["token"] = "REMOVED"
output_str = json.dumps(clusterd_data)
except Exception:
output_str = ''
Expand Down

0 comments on commit bad4e07

Please sign in to comment.