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

Failure analysis for InvalidConfigurationPropertyValueException doesn't correctly handle fuzzy matching of environment variables #43380

Closed
wilkinsona opened this issue Dec 4, 2024 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

For example, the property management.endpoints.enabled-by-default could be resolved from the environment variable MANAGEMENT_ENDPOINTS_ENABLED_BY_DEFAULT or the environment variable MANAGEMENT_ENDPOINTS_ENABLEDBYDEFAULT. In the former case, the failure analysis reports that the system environment is the origin. In the latter case, it doesn't report the origin as it fails to find the property.

This behavior is due to the failure analyzer filtering out the ConfigurationPropertySource that's attached to the environment. The fuzzy matching of environment variables happens with ConfigurationPropertySource so this is lost when it's filtered out. If the filtering is removed, things work for MANAGEMENT_ENDPOINTS_ENABLEDBYDEFAULT. Unfortunately, it creates a different problem with MANAGEMENT_ENDPOINTS_ENABLED_BY_DEFAULT as the property is then found twice – once in ConfigurationPropertySource's view of the system environment and once directly from the system environment property source.

@wilkinsona wilkinsona added the type: bug A general bug label Dec 4, 2024
@wilkinsona wilkinsona added this to the 3.3.x milestone Dec 4, 2024
@wilkinsona wilkinsona self-assigned this Dec 4, 2024
@wilkinsona wilkinsona modified the milestones: 3.3.x, 3.3.7 Dec 4, 2024
wilkinsona added a commit that referenced this issue Dec 12, 2024
Prior to this change, the failure analysis for an invalid
configuration property value filtered out the configuration property
sources property source. This property source contains a "duplicate"
of all of the environment's other property sources but with
configuration property support (such as relaxed/fuzzy matching of
environment variables). This was done to prevent the reporting of
duplicates when a property was found in both the configuration
property sources property source and the "normal" property sources.
An unwanted side-effect of this was that fuzzy matching of
environment variables was lost so the origin of
com.example.some-property would be found in the environment variable
was COM_EXAMPLE_SOME_PROPERTY but would not be found if it was
COM_EXAMPLE_SOMEPROPERTY.

This commit addresses this side-effect by no longer filtering out
the configuration property sources property source. To then
prevent duplicates from being reported in the analysis, it instead
deduplicates things based on the origin of each property that's
found in the environment's property sources.

Fixes gh-43380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant