Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection rule response action identifiers always return an empty list #706

Open
Dutchy- opened this issue Jan 7, 2025 · 2 comments
Open
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@Dutchy-
Copy link

Dutchy- commented Jan 7, 2025

Describe the bug

When calling a List or Get for detection rules, e.g. await self.graph_client.security.rules.detection_rules.get(), you get a DetectionRuleCollectionResponse.

This response contains a field detection_action.response_actions which is a list of type ResponseAction.

For a specific response action, e.g. IsolateDeviceResponseAction, the identifier field is always [] instead of the Enum it should be, e.g. identifier=<DeviceIdEntityIdentifier.DeviceId: 'deviceId'>.

I believe this is due to this code in the get_field_deserializers:

fields: Dict[str, Callable[[Any], None]] = {
    "identifier": lambda n : setattr(self, 'identifier', n.get_collection_of_enum_values(DeviceIdEntityIdentifier)),
    "isolationType": lambda n : setattr(self, 'isolation_type', n.get_enum_value(IsolationType)),
}

I suspect the get_collection_of_enum_values should be replaced with get_enum_value. Since I presume that this code is all generated, the root cause of this problem is probably somewhere else.

Expected behavior

Return the correct enum for all ResponseAction identifiers.

How to reproduce

Call await self.graph_client.security.rules.detection_rules.get() on a detection rule with a response action.

SDK Version

1.16.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

No response

Configuration

  • OS: MacOS 14.5
  • Architecture: Apple ARM

Other information

No response

@Dutchy- Dutchy- added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 7, 2025
@Dutchy-
Copy link
Author

Dutchy- commented Jan 7, 2025

I've patched one of the response actions locally, replacing get_collection_of_enum_values with get_enum_value and this indeed fixes the problem.

@Dutchy-
Copy link
Author

Dutchy- commented Jan 7, 2025

I've created a workaround for this here https://gist.github.com/Dutchy-/15de88f577b7b4783bedd9067f501775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant