Skip to content

ROX-33000: Support for process details in detection node#19586

Draft
JoukoVirtanen wants to merge 4 commits intomasterfrom
jv-ROX-33000-support-for-process-details-in-detection-node
Draft

ROX-33000: Support for process details in detection node#19586
JoukoVirtanen wants to merge 4 commits intomasterfrom
jv-ROX-33000-support-for-process-details-in-detection-node

Conversation

@JoukoVirtanen
Copy link
Contributor

@JoukoVirtanen JoukoVirtanen commented Mar 24, 2026

Description

change me!

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

Manual testing.

The following script was used to test the changes here.

#!/usr/bin/env bash

set -euox pipefail

# Configuration
ROX_ENDPOINT=${ROX_ENDPOINT:-https://localhost:8000}

POLICY_FILE="$1"

# Check for required environment variable
if [ -z "${ROX_API_TOKEN:-}" ]; then
    echo "Error: ROX_API_TOKEN environment variable is not set"
    echo "Please set it with: export ROX_API_TOKEN=<your-token>"
    exit 1
fi

# Read policy from file
data=$(cat "$POLICY_FILE")

# Make the API call
response=$(curl --location --silent --request POST \
  "${ROX_ENDPOINT}/v1/policies" \
  -k \
  --header "Authorization: Bearer $ROX_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data "$data")

echo "$response" | jq

The following policy was used as an input. This is a valid node policy with Process and FileAccess fields. The policy is successfully created in this branch.

{
  "id": "",
  "name": "Node with process",
  "description": "",
  "severity": "LOW_SEVERITY",
  "disabled": false,
  "lifecycleStages": [
    "RUNTIME"
  ],
  "notifiers": [],
  "lastUpdated": null,
  "eventSource": "NODE_EVENT",
  "isDefault": false,
  "rationale": "",
  "remediation": "",
  "categories": [
    "Anomalous Activity"
  ],
  "exclusions": [],
  "scope": [],
  "enforcementActions": [],
  "SORTName": "",
  "SORTLifecycleStage": "",
  "SORTEnforcement": false,
  "policyVersion": "",
  "policySections": [
    {
      "sectionName": "Rule 1",
      "policyGroups": [
        {
          "fieldName": "Process Name",
          "booleanOperator": "OR",
          "values": [
            {
              "value": "bash"
            }
          ],
          "negate": false,
          "fieldKey": {
            "name": "Process Name",
            "shortName": "Process name",
            "longName": "Process name is",
            "negatedName": "Process name doesn’t match",
            "category": "Process activity",
            "type": "text",
            "placeholder": "apt-get",
            "canBooleanLogic": true,
            "lifecycleStages": [
              "RUNTIME"
            ]
          }
        },
        {
          "fieldName": "File Path",
          "booleanOperator": "OR",
          "values": [
            {
              "value": "/etc/sudoers"
            }
          ],
          "negate": false,
          "fieldKey": {
            "label": "File path",
            "name": "File Path",
            "shortName": "File path",
            "category": "File activity",
            "type": "text",
            "placeholder": "/home/**/.ssh/id_*",
            "helperText": "Enter an absolute file path. Supports glob patterns.",
            "canBooleanLogic": false,
            "lifecycleStages": [
              "RUNTIME"
            ]
          }
        }
      ]
    }
  ],
  "mitreAttackVectors": [],
  "criteriaLocked": false,
  "mitreVectorsLocked": false,
  "source": "IMPERATIVE"
}

In master it results in an error.

{
  "code": 3,
  "message": "policy invalid errors: [error validating lifecycle stage error: Node event policies must contain only node fields, Node event policies must contain only node fields]: invalid arguments",
  "details": [],
  "error": "policy invalid errors: [error validating lifecycle stage error: Node event policies must contain only node fields, Node event policies must contain only node fields]: invalid arguments"
}

An invalid policy with only a Process field was tested.

{
  "id": "",
  "name": "Node with process only",
  "description": "",
  "severity": "LOW_SEVERITY",
  "disabled": false,
  "lifecycleStages": [
    "RUNTIME"
  ],
  "notifiers": [],
  "lastUpdated": null,
  "eventSource": "NODE_EVENT",
  "isDefault": false,
  "rationale": "",
  "remediation": "",
  "categories": [
    "Anomalous Activity"
  ],
  "exclusions": [],
  "scope": [],
  "enforcementActions": [],
  "SORTName": "",
  "SORTLifecycleStage": "",
  "SORTEnforcement": false,
  "policyVersion": "",
  "policySections": [
    {
      "sectionName": "Rule 1",
      "policyGroups": [
        {
          "fieldName": "Process Name",
          "booleanOperator": "OR",
          "values": [
            {
              "value": "bash"
            }
          ],
          "negate": false,
          "fieldKey": {
            "name": "Process Name",
            "shortName": "Process name",
            "longName": "Process name is",
            "negatedName": "Process name doesn’t match",
            "category": "Process activity",
            "type": "text",
            "placeholder": "apt-get",
            "canBooleanLogic": true,
            "lifecycleStages": [
              "RUNTIME"
            ]
          }
        }
      ]
    }
  ],
  "mitreAttackVectors": [],
  "criteriaLocked": false,
  "mitreVectorsLocked": false,
  "source": "IMPERATIVE"
}

This resulted in the following error

{
  "code": 3,
  "message": "policy invalid errors: [error validating lifecycle stage error: Node event policies with process criteria must include file access criteria in the same section, Node event policies with process criteria must include file access criteria in the same section]: invalid arguments",
  "details": [],
  "error": "policy invalid errors: [error validating lifecycle stage error: Node event policies with process criteria must include file access criteria in the same section, Node event policies with process criteria must include file access criteria in the same section]: invalid arguments"
}

It failed in master with the following error:

{ 
  "code": 3,
  "message": "policy invalid errors: [error validating lifecycle stage error: Node event policies must contain only node fields, Node event policies must contain only node fields]: invalid arguments",
  "details": [],
  "error": "policy invalid errors: [error validating lifecycle stage error: Node event policies must contain only node fields, Node event policies must contain only node fields]: invalid arguments"
}

A policy with only a FileAccess field was tested and worked in this branch and in master.

{
  "id": "",
  "name": "Node with file access only",
  "description": "",
  "severity": "LOW_SEVERITY",
  "disabled": false,
  "lifecycleStages": [
    "RUNTIME"
  ],
  "notifiers": [],
  "lastUpdated": null,
  "eventSource": "NODE_EVENT",
  "isDefault": false,
  "rationale": "",
  "remediation": "",
  "categories": [
    "Anomalous Activity"
  ],
  "exclusions": [],
  "scope": [],
  "enforcementActions": [],
  "SORTName": "",
  "SORTLifecycleStage": "",
  "SORTEnforcement": false,
  "policyVersion": "",
  "policySections": [
    {
      "sectionName": "Rule 1",
      "policyGroups": [
        {
          "fieldName": "File Path",
          "booleanOperator": "OR",
          "values": [
            {
              "value": "/etc/sudoers"
            }
          ],
          "negate": false,
          "fieldKey": {
            "label": "File path",
            "name": "File Path",
            "shortName": "File path",
            "category": "File activity",
            "type": "text",
            "placeholder": "/home/**/.ssh/id_*",
            "helperText": "Enter an absolute file path. Supports glob patterns.",
            "canBooleanLogic": false,
            "lifecycleStages": [
              "RUNTIME"
            ]
          }
        }
      ]
    }
  ],
  "mitreAttackVectors": [],
  "criteriaLocked": false,
  "mitreVectorsLocked": false,
  "source": "IMPERATIVE"
}

@openshift-ci
Copy link

openshift-ci bot commented Mar 24, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rhacs-bot
Copy link
Contributor

rhacs-bot commented Mar 25, 2026

Images are ready for the commit at 9f121cd.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-436-g9f121cd1de.

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.28%. Comparing base (5d84b54) to head (9dfc9b8).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19586      +/-   ##
==========================================
+ Coverage   49.26%   49.28%   +0.02%     
==========================================
  Files        2735     2735              
  Lines      206138   206220      +82     
==========================================
+ Hits       101550   101645      +95     
+ Misses      97041    97036       -5     
+ Partials     7547     7539       -8     
Flag Coverage Δ
go-unit-tests 49.28% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@Stringy Stringy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor non-blocking comment but overall LGTM

return errors.New("Node event policies must contain only node fields")
}

if booleanpolicy.ContainsOneOf(policy, booleanpolicy.Process) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check is a little redundant - we can just go straight into the loop

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants