Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

prevent object id collision in hide_secrets #936

Merged

Conversation

bmc-msft
Copy link
Contributor

This fixes an issue related to object id reuse that can occur making the object identification cache fail. Instead, this simplifies hide_secrets to always recurse and use setattr to always set the value based on the recursion.

Note, the object id reuse issue was seen in the events.filter_event_recurse development and this was the fix for the id reuse there.

Python documentation states:

id(object):
Return the “identity” of an object. This is an integer (or long integer)
which is guaranteed to be unique and constant for this object during its
lifetime. Two objects with non-overlapping lifetimes may have the same
id() value.

this fixes an issue related to object id reuse that can occur making the
object identification cache fail.  Instead, this simplifies the
hide_secrets to always recurse and use setattr to always set the value
based on the recursion.

Note, the object id reuse issue was seen in the
`events.filter_event_recurse` development and this was the fix for the
id reuse there.

Python documentation states:

id(object):

Return the “identity” of an object. This is an integer (or long integer)
which is guaranteed to be unique and constant for this object during its
lifetime. Two objects with non-overlapping lifetimes may have the same
id() value.
@bmc-msft
Copy link
Contributor Author

@ranweiler this should fix the build issues you're seeing.

src/api-service/__app__/onefuzzlib/orm.py Outdated Show resolved Hide resolved
hider: Callable[["SecretData"], None],
visited: Set[int] = set(),
) -> None:
if id(model) in visited:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is where the action is. Great catch!

@bmc-msft bmc-msft merged commit 0a6021b into microsoft:main May 27, 2021
@bmc-msft bmc-msft deleted the prevent-object-id-colision-missing-content branch May 27, 2021 12:28
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants