Skip to content

Prevent modifications to passed in objects #3756

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

Closed
shawkins opened this issue Jan 17, 2022 · 3 comments
Closed

Prevent modifications to passed in objects #3756

shawkins opened this issue Jan 17, 2022 · 3 comments
Assignees
Milestone

Comments

@shawkins
Copy link
Contributor

Is your task related to a problem? Please describe

Related to #3078 and possibly to operator-framework/java-operator-sdk#830 modifications should not be directly made to passed in objects.

Describe the solution you'd like

Simply reverting the change is not quite enough. As the object could have been obtained from a cache that simply creates a narrow race condition. More than likely the only solution is to clone prior to making the modification. The impetus for that cloning is mitigated if cloning were enforced for any resource obtained by the informer cache.

Describe alternatives you've considered

No response

Additional context

No response

@manusa manusa added this to the 5.12.0 milestone Jan 18, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 18, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 18, 2022
@shawkins shawkins self-assigned this Jan 18, 2022
@shawkins
Copy link
Contributor Author

Related to this, do we want another issue on write protecting the informer caches?

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Jan 19, 2022
@manusa
Copy link
Member

manusa commented Jan 19, 2022

Related to this, do we want another issue on write protecting the informer caches?

Wasn't this something we discarded?

It's OK for me, but given the additional processing overhead, it should be something configurable.

@shawkins
Copy link
Contributor Author

It's OK for me, but given the additional processing overhead, it should be something configurable.

That is the idea, to propose/collect possible solutions - that would be optional:

secrets().withImmutableStore().inform()
or
SharedInformer.getImmutableStore() - returns a store that returns copies.

Either could be implemented with a wrapper that clones or adding logic for storage functions - for example to hold just strings in memory.

@manusa manusa closed this as completed in edb32df Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants