diff --git a/.apigentools-info b/.apigentools-info index 894d5ce13e..2727f1c430 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-17 18:21:59.760405", - "spec_repo_commit": "b1a1c000" + "regenerated": "2025-06-18 09:42:24.575961", + "spec_repo_commit": "b6151f30" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-17 18:21:59.775701", - "spec_repo_commit": "b1a1c000" + "regenerated": "2025-06-18 09:42:24.630790", + "spec_repo_commit": "b6151f30" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d45c5dd964..1d57e83d32 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7540,6 +7540,8 @@ components: description: SECL expression used to target the container to apply the action on type: string + hash: + $ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionHash' kill: $ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleKill' metadata: @@ -7547,6 +7549,10 @@ components: set: $ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet' type: object + CloudWorkloadSecurityAgentRuleActionHash: + additionalProperties: {} + description: An empty object indicating the hash action + type: object CloudWorkloadSecurityAgentRuleActionMetadata: description: The metadata action applied on the scope matching the rule properties: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 639bfb30b8..dc67406f4d 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -2846,6 +2846,13 @@ datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action mod :members: :show-inheritance: +datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_hash module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_hash + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_metadata module --------------------------------------------------------------------------------------------- diff --git a/examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py b/examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py index ec28b27a1e..1cb7e28289 100644 --- a/examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py +++ b/examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py @@ -6,6 +6,9 @@ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v2.api.csm_threats_api import CSMThreatsApi from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action import CloudWorkloadSecurityAgentRuleAction +from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_hash import ( + CloudWorkloadSecurityAgentRuleActionHash, +) from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set import ( CloudWorkloadSecurityAgentRuleActionSet, ) @@ -41,6 +44,9 @@ scope="process", ), ), + CloudWorkloadSecurityAgentRuleAction( + hash=CloudWorkloadSecurityAgentRuleActionHash(), + ), ], ), type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE, diff --git a/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py b/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py index f38ea2915a..7d96ae8493 100644 --- a/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py +++ b/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py @@ -14,6 +14,9 @@ if TYPE_CHECKING: + from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_hash import ( + CloudWorkloadSecurityAgentRuleActionHash, + ) from datadog_api_client.v2.model.cloud_workload_security_agent_rule_kill import CloudWorkloadSecurityAgentRuleKill from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_metadata import ( CloudWorkloadSecurityAgentRuleActionMetadata, @@ -26,6 +29,9 @@ class CloudWorkloadSecurityAgentRuleAction(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_hash import ( + CloudWorkloadSecurityAgentRuleActionHash, + ) from datadog_api_client.v2.model.cloud_workload_security_agent_rule_kill import ( CloudWorkloadSecurityAgentRuleKill, ) @@ -38,6 +44,7 @@ def openapi_types(_): return { "filter": (str,), + "hash": (CloudWorkloadSecurityAgentRuleActionHash,), "kill": (CloudWorkloadSecurityAgentRuleKill,), "metadata": (CloudWorkloadSecurityAgentRuleActionMetadata,), "set": (CloudWorkloadSecurityAgentRuleActionSet,), @@ -45,6 +52,7 @@ def openapi_types(_): attribute_map = { "filter": "filter", + "hash": "hash", "kill": "kill", "metadata": "metadata", "set": "set", @@ -53,6 +61,7 @@ def openapi_types(_): def __init__( self_, filter: Union[str, UnsetType] = unset, + hash: Union[CloudWorkloadSecurityAgentRuleActionHash, UnsetType] = unset, kill: Union[CloudWorkloadSecurityAgentRuleKill, UnsetType] = unset, metadata: Union[CloudWorkloadSecurityAgentRuleActionMetadata, UnsetType] = unset, set: Union[CloudWorkloadSecurityAgentRuleActionSet, UnsetType] = unset, @@ -64,6 +73,9 @@ def __init__( :param filter: SECL expression used to target the container to apply the action on :type filter: str, optional + :param hash: An empty object indicating the hash action + :type hash: CloudWorkloadSecurityAgentRuleActionHash, optional + :param kill: Kill system call applied on the container matching the rule :type kill: CloudWorkloadSecurityAgentRuleKill, optional @@ -75,6 +87,8 @@ def __init__( """ if filter is not unset: kwargs["filter"] = filter + if hash is not unset: + kwargs["hash"] = hash if kill is not unset: kwargs["kill"] = kill if metadata is not unset: diff --git a/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action_hash.py b/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action_hash.py new file mode 100644 index 0000000000..7252b6a872 --- /dev/null +++ b/src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action_hash.py @@ -0,0 +1,17 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, +) + + +class CloudWorkloadSecurityAgentRuleActionHash(ModelNormal): + def __init__(self_, **kwargs): + """ + An empty object indicating the hash action + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 51dc63e762..e30ae22117 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -532,6 +532,9 @@ CloudWorkloadSecurityAgentPolicyUpdaterAttributes, ) from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action import CloudWorkloadSecurityAgentRuleAction +from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_hash import ( + CloudWorkloadSecurityAgentRuleActionHash, +) from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_metadata import ( CloudWorkloadSecurityAgentRuleActionMetadata, ) @@ -3902,6 +3905,7 @@ "CloudWorkloadSecurityAgentPolicyUpdateRequest", "CloudWorkloadSecurityAgentPolicyUpdaterAttributes", "CloudWorkloadSecurityAgentRuleAction", + "CloudWorkloadSecurityAgentRuleActionHash", "CloudWorkloadSecurityAgentRuleActionMetadata", "CloudWorkloadSecurityAgentRuleActionSet", "CloudWorkloadSecurityAgentRuleAttributes", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.frozen index 210e74a64e..07075ecafc 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.frozen @@ -1 +1 @@ -2025-05-27T10:24:57.049Z \ No newline at end of file +2025-06-13T15:16:58.034Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.yaml index d7301d4d58..ce88d208d0 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_workload_protection_agent_rule_with_set_action_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1748341497"},"type":"policy"}}' + body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1749827818"},"type":"policy"}}' headers: accept: - application/json @@ -10,8 +10,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy response: body: - string: '{"data":{"id":"qyj-iza-vbu","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My - agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1748341497","policyVersion":"1","priority":1000000011,"ruleCount":226,"updateDate":1748341497346,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + string: '{"data":{"id":"alt-4q4-baa","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My + agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1749827818","policyVersion":"1","priority":1000000013,"ruleCount":226,"updateDate":1749827818428,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -19,8 +19,8 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}}],"description":"My - Agent rule with set action","enabled":true,"expression":"exec.file.name == \"sh\"","filters":[],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1748341497","policy_id":"qyj-iza-vbu","product_tags":[]},"type":"agent_rule"}}' + body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}},{"hash":{}}],"description":"My + Agent rule with set action","enabled":true,"expression":"exec.file.name == \"sh\"","filters":[],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1749827818","policy_id":"alt-4q4-baa","product_tags":[]},"type":"agent_rule"}}' headers: accept: - application/json @@ -30,10 +30,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules response: body: - string: '{"data":{"id":"zux-bp8-zov","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false}],"category":"Process - Activity","creationDate":1748341498175,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My + string: '{"data":{"id":"ps3-64e-shx","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false},{"hash":{},"disabled":false}],"category":"Process + Activity","creationDate":1749827819065,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My Agent rule with set action","enabled":true,"expression":"exec.file.name == - \"sh\"","filters":["os == \"linux\""],"monitoring":["qyj-iza-vbu"],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1748341497","product_tags":[],"updateDate":1748341498175,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + \"sh\"","filters":["os == \"linux\""],"monitoring":["alt-4q4-baa"],"name":"testcreateaworkloadprotectionagentrulewithsetactionreturnsokresponse1749827818","product_tags":[],"updateDate":1749827819065,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -46,7 +46,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/zux-bp8-zov + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/ps3-64e-shx response: body: string: '' @@ -62,7 +62,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/qyj-iza-vbu + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/alt-4q4-baa response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.frozen index ded4aa11a6..965ca7d540 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.frozen @@ -1 +1 @@ -2025-05-27T10:25:02.351Z \ No newline at end of file +2025-06-13T15:16:43.100Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.yaml index 6a31cc0f4e..6f4f0aff10 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_workload_protection_agent_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1748341502"},"type":"policy"}}' + body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1749827803"},"type":"policy"}}' headers: accept: - application/json @@ -10,8 +10,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy response: body: - string: '{"data":{"id":"ney-zeu-tex","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My - agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1748341502","policyVersion":"1","priority":1000000011,"ruleCount":226,"updateDate":1748341502642,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + string: '{"data":{"id":"tn0-tjy-vwh","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My + agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1749827803","policyVersion":"1","priority":1000000013,"ruleCount":226,"updateDate":1749827803539,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -19,8 +19,8 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}}],"description":"My - Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1748341502","policy_id":"ney-zeu-tex","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' + body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}},{"hash":{}}],"description":"My + Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1749827803","policy_id":"tn0-tjy-vwh","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' headers: accept: - application/json @@ -30,10 +30,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules response: body: - string: '{"data":{"id":"gys-bzk-zs4","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false}],"category":"Process - Activity","creationDate":1748341503254,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My + string: '{"data":{"id":"hm0-n7p-hq7","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false},{"hash":{},"disabled":false}],"category":"Process + Activity","creationDate":1749827804150,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os - == \"linux\""],"monitoring":["ney-zeu-tex"],"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1748341502","product_tags":["security:attack","technique:T1059"],"updateDate":1748341503254,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + == \"linux\""],"monitoring":["tn0-tjy-vwh"],"name":"testdeleteaworkloadprotectionagentrulereturnsokresponse1749827803","product_tags":["security:attack","technique:T1059"],"updateDate":1749827804150,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -46,7 +46,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/gys-bzk-zs4?policy_id=ney-zeu-tex + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/hm0-n7p-hq7?policy_id=tn0-tjy-vwh response: body: string: '' @@ -62,7 +62,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/gys-bzk-zs4 + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/hm0-n7p-hq7 response: body: string: '{"errors":[{"title":"failed to delete rule"}]} @@ -80,7 +80,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/ney-zeu-tex + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/tn0-tjy-vwh response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.frozen index bfab02cf0d..e6dcf8a16a 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.frozen @@ -1 +1 @@ -2025-05-27T10:25:11.236Z \ No newline at end of file +2025-06-13T15:16:09.321Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.yaml index 88f66f5e08..290f70d5fc 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workload_protection_agent_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1748341511"},"type":"policy"}}' + body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1749827769"},"type":"policy"}}' headers: accept: - application/json @@ -10,8 +10,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy response: body: - string: '{"data":{"id":"rb7-4db-zo7","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My - agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testgetaworkloadprotectionagentrulereturnsokresponse1748341511","policyVersion":"1","priority":1000000011,"ruleCount":226,"updateDate":1748341511524,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + string: '{"data":{"id":"8ps-fwp-o64","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My + agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testgetaworkloadprotectionagentrulereturnsokresponse1749827769","policyVersion":"1","priority":1000000013,"ruleCount":226,"updateDate":1749827769724,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -19,8 +19,8 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}}],"description":"My - Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testgetaworkloadprotectionagentrulereturnsokresponse1748341511","policy_id":"rb7-4db-zo7","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' + body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}},{"hash":{}}],"description":"My + Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testgetaworkloadprotectionagentrulereturnsokresponse1749827769","policy_id":"8ps-fwp-o64","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' headers: accept: - application/json @@ -30,10 +30,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules response: body: - string: '{"data":{"id":"xll-jfj-cti","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false}],"category":"Process - Activity","creationDate":1748341512094,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My + string: '{"data":{"id":"onw-c2u-mha","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false},{"hash":{},"disabled":false}],"category":"Process + Activity","creationDate":1749827770435,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os - == \"linux\""],"monitoring":["rb7-4db-zo7"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1748341511","product_tags":["security:attack","technique:T1059"],"updateDate":1748341512094,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + == \"linux\""],"monitoring":["8ps-fwp-o64"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1749827769","product_tags":["security:attack","technique:T1059"],"updateDate":1749827770435,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -46,13 +46,13 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/xll-jfj-cti?policy_id=rb7-4db-zo7 + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/onw-c2u-mha?policy_id=8ps-fwp-o64 response: body: - string: '{"data":{"id":"xll-jfj-cti","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false}],"category":"Process - Activity","creationDate":1748341512094,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My + string: '{"data":{"id":"onw-c2u-mha","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false},{"hash":{},"disabled":false}],"category":"Process + Activity","creationDate":1749827770435,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os - == \"linux\""],"monitoring":["rb7-4db-zo7"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1748341511","product_tags":["security:attack","technique:T1059"],"updateDate":1748341512094,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + == \"linux\""],"monitoring":["8ps-fwp-o64"],"name":"testgetaworkloadprotectionagentrulereturnsokresponse1749827769","product_tags":["security:attack","technique:T1059"],"updateDate":1749827770435,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -65,7 +65,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/xll-jfj-cti + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/onw-c2u-mha response: body: string: '' @@ -81,7 +81,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/rb7-4db-zo7 + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/8ps-fwp-o64 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.frozen index 724bb514cc..682f302b0f 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.frozen @@ -1 +1 @@ -2025-05-27T10:25:17.186Z \ No newline at end of file +2025-06-13T15:16:28.583Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.yaml index 1619481ef4..0ed1b1bb27 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_a_workload_protection_agent_rule_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1748341517"},"type":"policy"}}' + body: '{"data":{"attributes":{"description":"My agent policy","enabled":true,"hostTags":["env:staging"],"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1749827788"},"type":"policy"}}' headers: accept: - application/json @@ -10,8 +10,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy response: body: - string: '{"data":{"id":"3f2-3l2-9wi","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My - agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1748341517","policyVersion":"1","priority":1000000011,"ruleCount":226,"updateDate":1748341517477,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + string: '{"data":{"id":"fuv-zyk-wli","type":"policy","attributes":{"blockingRulesCount":0,"datadogManaged":false,"description":"My + agent policy","disabledRulesCount":1,"enabled":true,"hostTags":["env:staging"],"monitoringRulesCount":225,"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1749827788","policyVersion":"1","priority":1000000013,"ruleCount":226,"updateDate":1749827789001,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -19,8 +19,8 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}}],"description":"My - Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1748341517","policy_id":"3f2-3l2-9wi","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' + body: '{"data":{"attributes":{"actions":[{"set":{"name":"test_set","scope":"process","value":"test_value"}},{"hash":{}}],"description":"My + Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1749827788","policy_id":"fuv-zyk-wli","product_tags":["security:attack","technique:T1059"]},"type":"agent_rule"}}' headers: accept: - application/json @@ -30,10 +30,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules response: body: - string: '{"data":{"id":"rhm-wzc-6qu","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false}],"category":"Process - Activity","creationDate":1748341518091,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My + string: '{"data":{"id":"f8u-th8-0er","type":"agent_rule","attributes":{"actions":[{"set":{"name":"test_set","value":"test_value","scope":"process"},"disabled":false},{"hash":{},"disabled":false}],"category":"Process + Activity","creationDate":1749827789457,"creator":{"name":"frog","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os - == \"linux\""],"monitoring":["3f2-3l2-9wi"],"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1748341517","product_tags":["security:attack","technique:T1059"],"updateDate":1748341518091,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' + == \"linux\""],"monitoring":["fuv-zyk-wli"],"name":"testupdateaworkloadprotectionagentrulereturnsbadrequestresponse1749827788","product_tags":["security:attack","technique:T1059"],"updateDate":1749827789457,"updater":{"name":"frog","handle":"frog@datadoghq.com"}}}}' headers: content-type: - application/json @@ -42,14 +42,14 @@ interactions: message: OK - request: body: '{"data":{"attributes":{"description":"My Agent rule","enabled":true,"expression":"exec.file.name - == \"sh\"","policy_id":"3f2-3l2-9wi","product_tags":[]},"id":"invalid-agent-rule-id","type":"agent_rule"}}' + == \"sh\"","policy_id":"fuv-zyk-wli","product_tags":[]},"id":"invalid-agent-rule-id","type":"agent_rule"}}' headers: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/rhm-wzc-6qu + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/f8u-th8-0er response: body: string: '{"errors":[{"title":"failed to update rule"}]} @@ -67,7 +67,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/rhm-wzc-6qu + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/f8u-th8-0er response: body: string: '' @@ -83,7 +83,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/3f2-3l2-9wi + uri: https://api.datadoghq.com/api/v2/remote_config/products/cws/policy/fuv-zyk-wli response: body: string: '' diff --git a/tests/v2/features/csm_threats.feature b/tests/v2/features/csm_threats.feature index a7ac8cc4c5..4783aea35e 100644 --- a/tests/v2/features/csm_threats.feature +++ b/tests/v2/features/csm_threats.feature @@ -65,7 +65,7 @@ Feature: CSM Threats Scenario: Create a Workload Protection agent rule with set action returns "OK" response Given there is a valid "policy_rc" in the system And new "CreateCSMThreatsAgentRule" request - And body with value {"data": {"attributes": {"description": "My Agent rule with set action", "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "name": "{{ unique_lower_alnum }}", "policy_id": "{{ policy.data.id }}", "product_tags": [], "actions": [{"set": {"name": "test_set", "value": "test_value", "scope": "process"}}]}, "type": "agent_rule"}} + And body with value {"data": {"attributes": {"description": "My Agent rule with set action", "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "name": "{{ unique_lower_alnum }}", "policy_id": "{{ policy.data.id }}", "product_tags": [], "actions": [{"set": {"name": "test_set", "value": "test_value", "scope": "process"}}, {"hash": {}}]}, "type": "agent_rule"}} When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 191f633e26..85541755d9 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -571,7 +571,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"data\": {\n \"type\": \"agent_rule\",\n \"attributes\": {\n \"name\": \"{{ unique_lower_alnum }}\",\n \"description\": \"My Agent rule\",\n \"expression\": \"exec.file.name == \\\"sh\\\"\",\n \"enabled\": true,\n \"product_tags\": [\"security:attack\", \"technique:T1059\"],\n \"actions\": [{\"set\": {\"name\": \"test_set\", \"value\": \"test_value\", \"scope\": \"process\"}}],\n \"policy_id\": \"{{ policy.data.id }}\"\n }\n }\n}" + "value": "{\n \"data\": {\n \"type\": \"agent_rule\",\n \"attributes\": {\n \"name\": \"{{ unique_lower_alnum }}\",\n \"description\": \"My Agent rule\",\n \"expression\": \"exec.file.name == \\\"sh\\\"\",\n \"enabled\": true,\n \"product_tags\": [\"security:attack\", \"technique:T1059\"],\n \"actions\": [{\"set\": {\"name\": \"test_set\", \"value\": \"test_value\", \"scope\": \"process\"}}, {\"hash\": {}}],\n \"policy_id\": \"{{ policy.data.id }}\"\n }\n }\n}" } ], "step": "there is a valid \"agent_rule_rc\" in the system",