Skip to content

Prevent modifications to passed in objects #3756

Closed
@shawkins

Description

@shawkins
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

Activity

added this to the 5.12.0 milestone on Jan 18, 2022
added 2 commits that reference this issue on Jan 18, 2022

fix fabric8io#3756 prevent modifications by standard operations to us…

d060485

fix fabric8io#3756 prevent modifications by standard operations to us…

11902ef
self-assigned this
on Jan 18, 2022
shawkins

shawkins commented on Jan 19, 2022

@shawkins
ContributorAuthor

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

added a commit that references this issue on Jan 19, 2022

fix fabric8io#3756 prevent modifications by standard operations to us…

11d5b16
manusa

manusa commented on Jan 19, 2022

@manusa
Member

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

shawkins commented on Jan 19, 2022

@shawkins
ContributorAuthor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @manusa@shawkins

      Issue actions

        Prevent modifications to passed in objects · Issue #3756 · fabric8io/kubernetes-client