Repository navigation
Project: Private Image Sharing - #633
Conversation
…aring Added support for Private Image Sharing
* Create integration tests for share groups - part 1 * Create test test_try_to_add_member_invalid_token * Update integration tests for private image sharing feature * Apply code review sugestions --------- Co-authored-by: Erik Zilber <ezilber@akamai.com>
| from .database import * | ||
| from .domain import * | ||
| from .image import * | ||
| from .image_share_group import * |
Check notice
Code scanning / CodeQL
'import *' may pollute namespace
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 months ago
In general, the way to fix this kind of issue is either (1) define __all__ in the imported module so that from module import * only brings in an intentional, controlled set of names, or (2) avoid import * and instead explicitly import either specific names or the module object itself. Because we can’t edit image_share_group here, we must stop using from .image_share_group import * in this file.
The single best fix in this file, without changing the rest of the design, is to replace from .image_share_group import * with a regular module import such as from . import image_share_group. This keeps access to everything in image_share_group via the image_share_group namespace (e.g. image_share_group.SomeClass) but stops it from polluting the linode_api4.groups namespace. We do not remove or alter any other imports, and we don’t add any new external dependencies.
Concretely:
- In
linode_api4/groups/__init__.py, line 9, replacefrom .image_share_group import *withfrom . import image_share_group. - No new helper methods or additional imports are required beyond this change.
| @@ -6,7 +6,7 @@ | ||
| from .database import * | ||
| from .domain import * | ||
| from .image import * | ||
| from .image_share_group import * | ||
| from . import image_share_group | ||
| from .linode import * | ||
| from .lke import * | ||
| from .lke_tier import * |
jriddle-linode
left a comment
There was a problem hiding this comment.
LGTM, works locally
📝 Description
Merge Private Image Sharing project branch into dev branch to stage for release.