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: WorkflowBlueprints index broken if you add a blueprint with data that can't be properly json decoded #10128

Open
1 task done
Wachizungu opened this issue Dec 23, 2024 · 0 comments
Labels
needs triage This issue has been automatically labelled and needs further triage

Comments

@Wachizungu
Copy link
Contributor

Actual behavior

It's possible to set blueprint data to something that's can't be properly json decoded, which breaks the blueprint index and the associated workflow edit function.

Expected behavior

It shouldn't be possible to set blueprint data to something that breaks the index etc...

Steps to reproduce

Note you will have to do intervention in the database to get your functionality back if you do these steps:
Edit an existing blueprint, set data to / , submit.
-> cry :)

Things break here:

$results[$k]['WorkflowBlueprint']['data'] = JsonTool::decode($result['WorkflowBlueprint']['data']);

Version

2.4.201

Operating System

Ubuntu

Operating System version

22.04

PHP version

7.4

Browser

No response

Browser version

No response

Relevant log output

2024-12-23 19:48:17 Error: [JsonException] Syntax error
Request URL: /workflowBlueprints
Stack Trace:
#0 /var/www/MISP/app/Lib/Tools/JsonTool.php(35): json_decode()
#1 /var/www/MISP/app/Model/WorkflowBlueprint.php(66): JsonTool::decode()
#2 /var/www/MISP/app/Lib/Tools/BetterCakeEventManager.php(21): WorkflowBlueprint->afterFind()
#3 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3371): BetterCakeEventManager->dispatch()
#4 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3057): Model->_filterResults()
#5 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3025): Model->_readDataSource()
#6 /var/www/MISP/app/Model/AppModel.php(4359): Model->find()
#7 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Component/PaginatorComponent.php(212): AppModel->find()
#8 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(1107): PaginatorComponent->paginate()
#9 /var/www/MISP/app/Controller/Component/CRUDComponent.php(56): Controller->paginate()
#10 /var/www/MISP/app/Controller/WorkflowBlueprintsController.php(31): CRUDComponent->index()
#11 [internal function]: WorkflowBlueprintsController->index()
#12 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(499): ReflectionMethod->invokeArgs()
#13 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction()
#14 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke()
#15 /var/www/MISP/app/webroot/index.php(105): Dispatcher->dispatch()
#16 {main}

Extra attachments

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Wachizungu Wachizungu added the needs triage This issue has been automatically labelled and needs further triage label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has been automatically labelled and needs further triage
Projects
None yet
Development

No branches or pull requests

1 participant