Skip to content
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 unintentional modification of slice in GetSensitiveParameters #449

Merged

Conversation

erhancagirici
Copy link
Collaborator

Description of your changes

Fixes the prefixes slice variable scope in GetSensitiveParameters()

During resolution of sensitive values in secret ref, #406 introduced support for secret refs from initProvider fields, which introduced a prefixes slice to both check fieldpaths starting with spec.forProvider and spec.initProvider

In #417, prefixes slice was modified in the case of fieldspaths starting with status.atProvider. in response to fix the associated issue.

However, prefixes slice (that is scoped outside of for loop) was being modified in the for loop for the case above, causing remaining iterations to unintentionally operate on modified slice, resulting some secretRef fields to be not resolved into the parameters, thus failing the resource create/update operations

Affected resources are those who have connection details mapping entries include a fieldpath with .status.atProvider followed by some .spec.forProvider and .spec.initProvider entries.

Related crossplane-contrib/provider-upjet-azure#873

I have:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Manually and uptest at: crossplane-contrib/provider-upjet-azure#873

Signed-off-by: Erhan Cagirici <erhan@upbound.io>
Copy link
Collaborator

@turkenf turkenf left a comment

Choose a reason for hiding this comment

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

Thank you @erhancagirici, LGTM 🙌

@erhancagirici erhancagirici merged commit be5e036 into crossplane:main Nov 15, 2024
6 checks passed
@erhancagirici erhancagirici deleted the fix-variable-scope-prefixes-slice branch November 15, 2024 11:06
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

Successfully merging this pull request may close these issues.

2 participants