-
Notifications
You must be signed in to change notification settings - Fork 6k
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
9117: Prevent api_key sharing #9130
Conversation
d9a7ca3
to
f9b6755
Compare
@kenjones-cisco |
@@ -22,10 +22,16 @@ class TypeWithDefault(type): | |||
def __call__(cls): | |||
if cls._default is None: | |||
cls._default = type.__call__(cls) | |||
return copy.copy(cls._default) | |||
return cls._two_level_copy(cls._default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you try to use copy.deepcopy(cls._default)
to see if that would provide the expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure. Deepcopy fails with TypeError: can't pickle thread.lock objects
cause we have reach attributes such as logger file/handler.
@kenjones-cisco |
This would definitely be much easier to read and maintain. |
@wing328 Seems to be ready fo merge. |
thanks @ruslanlazin @kenjones-cisco , i'll take a time to port these changes to 3.0.0 version. |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Description of the PR
These changes prevent sharing
api_key
,api_key_prefix
,logger
between configuration instances.Error was caused by using shallow copy in #6554
Test cases added.
fix #9117