Skip to content

BUG: --status filter ignored in iriusrisk countermeasure list #10

Description

@adenosine-phosphatase

Version: 0.6.3
Filter flag is silently ignored, returning unfiltered results

Description
The [--status] option on "iriusrisk countermeasure list" ] is accepted without error but has no effect.

All countermeasures are returned regardless of the value passed. The same issue affects --risk-level.

Root cause:
countermeasure_client.py line 37-56

The get_countermeasures() method accepts filter_expression as a parameter and logs it, but never uses it to populate the POST request body. The filter_body is hardcoded with empty arrays:

def get_countermeasures(self, project_id, page=0, size=20,
                        filter_expression=None):       # ← received
    if filter_expression:
        self.logger.debug(f"Using filter expression: {filter_expression}")  # ← logged

    params = {'page': page, 'size': size}

    filter_body = {
        "filters": {
            "all": {
                "states": [],       # ← BUG: always empty
                "priorities": [],   # ← BUG: always empty
                ...
            }
        }
    }
    # filter_expression is never parsed or applied to filter_body
    result = self._make_request('POST', ..., json=filter_body)

The upstream layer ([countermeasure_repository.py line 318-348 correctly builds a string expression like 'state'='implemented' from the --status CLI flag, but the API client discards it.

The V2 API endpoint POST /projects/{id}/countermeasures/query expects filters as structured arrays in the JSON body ("states": ["implemented"]), not as a query string expression. The filter_expression string was never translated into that structure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions