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

[BUG] artifact_update custom function fails if cef_value passed is 0 #2821

Open
ianwills-splunk opened this issue Aug 22, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@ianwills-splunk
Copy link

If you have a Splunk Support contract, creating a support case for your issue may result in faster resolution.

Describe the bug

Calling artifact_update with an artifact_id, cef_field and cef_value fails if the cef_value is 0.

Error is:

Aug 22, 14:10:56 : Error: Encountered an unhandled exception in custom function "artifact_update" for the parameter dictionary at index=0: {'artifact_id': 2, 'cef_data_type': None, 'cef_field': 'total_hits', 'cef_value': 0, 'input_json': None, 'label': None, 'name': None, 'overwrite_tags': None, 'severity': None, 'tags': None}
Traceback (most recent call last):
File "artifact_update", line 149, in cfentry
File "lib3/phantom/decided/playbook_resource_score.py/playbook_resource_score.py", line 126, in _wrapper
File "lib3/phantom/decided/playbook_resource_score.py/playbook_resource_score.py", line 123, in _wrapper
File "artifact_update", line 73, in artifact_update
ValueError: only one of cef_field and cef_value was provided

Expected behavior

You should be able to pass 0 as the cef_value

Screenshots

If applicable, add screenshots to help explain your problem.

App Version:

Community Custom Function artifact_update - SOAR 6.1

Additional context

The check for cef_field and cef_value is using "not", when it should be checking "is None"

Code snippet (lines 68-70) in the community repo

# validate that if cef_field or cef_value is provided, the other is also provided
if (cef_field and **not cef_value**) or (cef_value and not cef_field):
    raise ValueError("only one of cef_field and cef_value was provided")
@ianwills-splunk ianwills-splunk added the bug Something isn't working label Aug 22, 2023
@ljstella ljstella self-assigned this Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants