-
Notifications
You must be signed in to change notification settings - Fork 75
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 getOpenApiHighestElevatedVersion bug for unsupported API version #683
Merged
Didainius
merged 5 commits into
vmware:main
from
Didainius:fix_openapi_version_elevation
Jun 12, 2024
Merged
Fix getOpenApiHighestElevatedVersion bug for unsupported API version #683
Didainius
merged 5 commits into
vmware:main
from
Didainius:fix_openapi_version_elevation
Jun 12, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Dainius Serplis <[email protected]>
Didainius
commented
Jun 12, 2024
Signed-off-by: Dainius Serplis <[email protected]>
Didainius
commented
Jun 12, 2024
Didainius
commented
Jun 12, 2024
Didainius
commented
Jun 12, 2024
Signed-off-by: Dainius Serplis <[email protected]>
Didainius
changed the title
Fix getOpenApiHighestElevatedVersion bug
Fix getOpenApiHighestElevatedVersion bug for unsupported API version
Jun 12, 2024
Didainius
requested review from
lvirbalas,
adambarreiro and
dataclouder
as code owners
June 12, 2024 08:23
adambarreiro
approved these changes
Jun 12, 2024
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.
LGTM
dataclouder
approved these changes
Jun 12, 2024
Signed-off-by: Dainius Serplis <[email protected]>
lvirbalas
approved these changes
Jun 12, 2024
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.
A suggestion inline to add more logs for this case.
Signed-off-by: Dainius Serplis <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a bug in core OpenAPI version picking function
getOpenApiHighestElevatedVersion
that could choose an unsupported API version when automatic elevation mechanismendpointElevatedApiVersions
is used.This bug can start occurring when API v36.0 is no longer supported.
The bug occurs in OpenAPI handling function
getOpenApiHighestElevatedVersion
that picks client API versions for OpenAPI endpoints. It occurs when both of the following conditions are met:endpointElevatedApiVersions
map)endpointElevatedApiVersions
, but all of these entries only elevate to API versions older than default minimum supported API version (37.0 at this moment)Example
So an example when the bug occurs is: We have an endpoint
1.0.0/firewallGroups/
. This endpoint leverages automatic elevation mechanism and only has a single record:"36.0", // Adds support for Dynamic Security Groups by deprecating Type field in favor of TypeValue in endpointElevatedApiVersions.
The function
getOpenApiHighestElevatedVersion
has a bug when evaluating such conditions and it picks the version that is in theendpointElevatedApiVersions
which is36.0
in a given example. This is not good and will fail when minimum supported version is37.0
.There are many, but example test that surfaces this bug is
Test_NsxtFirewall
Affected tests: