-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: target option to disable extra identity defaulting in transport tool #1223
base: main
Are you sure you want to change the base?
Conversation
While this PR is important to fix newly transferred resources, existing component versions that had this defaulting happen need to have the same hash in v1 & v2 as they otherwise would break signature calculation. This is why v3 is necessary in addition to this defaulting change which was forgotten in the original PR for defaulting. |
api/ocm/internal/modopts.go
Outdated
|
||
// RawIdentity disables the implicit defaulting of the extraIdentity. | ||
// A transfer operation must set this flag to preserve the normalizations. | ||
RawIdentity *bool |
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.
This field should be named after what it does, e.g. DisableImplicitExtraIdentityDefaulting
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.
renamed to DisableExtraIdentityDefaulting
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.
The reason for RawIdentity
was the the method GetRawIdentity
on element meta data, which returns the identity as given and not the effective identity using the implicit version adding wherever required.
Both are correlated.
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.
This fix looks mostly good, just the variable name is problematic for me.
I checked current main out and cannot actually reproduce the extra identity defaulting happening during transport. I dont know how you did it, but I couldnt replicate the apparent fixable behavior. If I transfer
from e.g. a component archive to a OCI registry, I cannot see any extra identity default:
How is this additional case triggered? |
What this PR does / why we need it
The rework of the extra identity handling unfortunately also changed the transport logic.
Setting a (re)source for a new component version now defaults the version attribute of the extra identity if it is required
to make the identity unique. This was the first step towards getting rid of this implicit identity creation incorporating
the resource's version attribute into the effective extra identity. It makes this explicit, if the version is required as part of the identity of an element, it should be explicitly set for the extra identity in the future.
This defaulting has been made explicit by manipulating the extra identity when adding a new (re)resource. It was enabled by the modification option, which basically allows to do signature relevant changes.
Unfortunately this option is also used by the transport tool, after checking the delta to compose the target version.
Therefore, the transport now explicitly defaults the version into the extra identity, which causes the signature to break.
The solution is disable this defaulting for the transport. Therefore the methods accept a new option now (
DisableExtraIdentityDefaulting
), which tells the add handling to omit the defaulting and take the meta data as presented.This PR should replace #1218.
Which issue(s) this PR fixes
Fixes #1214