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

Specify an optional case template parameter to promote_alert_to_case #115

Merged

Conversation

agix
Copy link

@agix agix commented May 31, 2019

As a workaround for this issues

#114

TheHive-Project/TheHive#929

You can firstly get the alert caseTemplate before promoting it.

@nadouani
Copy link
Contributor

Quick question, did you set the caseTemplate field when you create the alert?

@nadouani
Copy link
Contributor

Yes, comments are here TheHive-Project/TheHive#929

@agix
Copy link
Author

agix commented Jun 13, 2019

So I think the workaround idea is to get_alert to read the specified caseTemplate linked to the alert and promote it to case with this parameter.

And maybe someday in TheHive if no caseTemplate is specified in createCase, it could use the one linked to the alert by default.

@nadouani
Copy link
Contributor

This is a better workaround in fact

@agix
Copy link
Author

agix commented Jun 13, 2019

This is the expected solution I think. But it's not incompatible with promote_alert_to_case using an optional caseTemplate which could override the one linked in the alert. It may exists use case for this too.

@nadouani
Copy link
Contributor

I'd remove the optional caseTemplate param

@nadouani
Copy link
Contributor

Ok, use it if the alert.caseTemplate is not specified

@agix
Copy link
Author

agix commented Jun 13, 2019

For me there should be 3 cases :

  1. alert.caseTemplate is null and case_template is not specified in promote_alert_to_case

case_template would be None so it would convert to {"caseTemplate": null} so I guess/hope in scala customCaseTemplate = request.body.getString("caseTemplate") would be None and it should act the same as sending {} to createCase.

Case is created without case template

  1. alert.caseTemplate is not null and case_template is not specified in promote_alert_to_case

Same as above but if they implement a fix to use linked alert.caseTemplate then it would use it to create the case.

  1. alert.caseTemplate is not null and case_template is specified in promote_alert_to_case

The specified case_template override the linked alert.caseTemplate.

Case is created using case_template, not alert.caseTemplate.

@nadouani
Copy link
Contributor

I agree with the latest comment, if you can update the PR then it works for me, I can merge it

@agix
Copy link
Author

agix commented Jun 13, 2019

I don't see what I have to change. I described the actual situation with the current PR.

@nadouani
Copy link
Contributor

I thought you wanted this PR to work without the API fix in TheHive. This PR will then solve just case (1) and (3).

That works also for me, but the issue will be 100% fixed with the next release of TheHive

@nadouani nadouani changed the base branch from master to 1.x June 13, 2019 12:33
@nadouani nadouani added this to the 1.7.0 milestone Jun 13, 2019
@nadouani nadouani merged commit 3d0d308 into TheHive-Project:1.x Jun 13, 2019
@agix agix deleted the promote_alert_to_case_with_template branch June 13, 2019 13:26
@agix
Copy link
Author

agix commented Jun 13, 2019

Nice we agree :).

Indeed it solves 1) and 3).

  1. is totally unrelated to theHive4py and this PR won't mess with a potential future fix.

Anyway, thx ! I'll look at scala code some day to try to help on TheHive.

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.

2 participants