security: validate custom node pack names#9256
Conversation
Signed-off-by: Security Researcher <security@example.com>
FindingsMedium —
|
|
Thanks for the review. I added focused coverage for the direct uninstall path in 6ce7839: _validate_pack_name() now has direct accept/reject tests, and uninstall_custom_node_pack() is checked to reject invalid direct path parameters before resolving the custom nodes path, calling shutil.rmtree(), or touching workflow cleanup helpers. |
Summary
Validates custom node pack names before using them in filesystem paths during install and uninstall operations.
Security impact
The custom node installer derived
pack_namedirectly from the submitted git source and then used it for clone targets, module loading, tags, and cleanup paths. This change rejects empty names, dot segments, path separators, and unsafe characters before any filesystem operation is attempted.This is especially important on Windows, where backslashes in a URL segment can be interpreted as path separators when building
Pathtargets.Changes
Verification
python -m py_compile invokeai/app/api/routers/custom_nodes.py tests/app/routers/test_custom_nodes.pyI could not run the focused pytest module locally because the checkout is missing the
blake3dependency before test collection reaches this module.