-
Notifications
You must be signed in to change notification settings - Fork 118
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 ] Crowdstrike API returning 406 when uploading a Fusion Workflow #1145
Comments
Hi @RoemIko - Thank you for reporting this issue! We have confirmed this issue as a bug, and have a fix ready for the from os import listdir
from falconpy import APIHarnessV2
def import_workflows():
path_to_workflows_folder = "/home/REDACTED/workflows/
falcon_w = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
for filename in listdir(path_to_workflows_folder):
if filename.endswith(".yaml") or filename.endswith(".yml"):
print(f'Importing {filename}')
with open(f'{path_to_workflows_folder + filename}', 'r') as yaml_file:
file_data = {"data_file": yaml_file.read(), "type": "application/x-yaml"}
workflow_response = falcon_w.command("WorkflowDefinitionsImport", files=file_data)
print(f'Workflow Response: {workflow_response}')
if workflow_response['status_code'] == 200:
print(f'Workflow {filename} imported successfully')
else:
print(f'Workflow {filename} failed to import') |
Hi @jshcodes, Thank you for looking into it 🙏 , and many thanks for the workaround |
I have updated falconpy to 1.4.3 but now i receive an error 500 with "Keyword arguments are required to use this method." This happens when i use the initial code from the beginning of this thread |
Can we see your call to |
Yes it still includes the data_file argument
|
Did you happen to look into this @jshcodes ? |
Yes we did! 😄 The consumption of the YAML file has been implemented within the service class, which should reduce the amount of code you need. from os import listdir
def import_workflows():
path_to_workflows_folder = "/home/REDACTED/workflows/
falcon_w = Workflows(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
for filename in listdir(path_to_workflows_folder):
if filename.endswith(".yaml") or filename.endswith(".yml"):
print(f'Importing {filename}')
workflow_response = falcon_w.import_definition(data_file=f'{path_to_workflows_folder + filename}')
print(f'Workflow Response: {workflow_response}')
if workflow_response['status_code'] == 200:
print(f'Workflow {filename} imported successfully')
else:
print(f'Workflow {filename} failed to import') |
Describe the bug
I followed the docs here: https://www.falconpy.io/Service-Collections/Workflows.html?highlight=import_definition#workflowdefinitionsimport
But i received a 406 after uploading a .yaml file, tried changing it to a .yml same results. When i upload it through the CrowdStrike Swagger UI i get a 200 back.
To Reproduce
This is my code
Expected behavior
I expect a status code of 200
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: