fix(query): resolve false positive on API Gateway access logging#7996
Open
cx-prathmesh-borle wants to merge 1 commit intoCheckmarx:masterfrom
Open
Conversation
dbdd7e2 to
c952c1d
Compare
c952c1d to
72af7d5
Compare
This file contains hidden or 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
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.
Closes #7466
Reason for Proposed Changes
80d45af4-4920-4236-a56e-b7ef419d1941(API Gateway V2 Stage Access Logging Settings Not Defined) produces false positives on CloudFormation templates because 3 Rego rules accessMethodSettingsas a flat object (properties.MethodSettings.LoggingLevel) instead of iterating it as an array;MethodSettingsas aList of MethodSetting, meaning it is always an array of objects (e.g.,MethodSettings[0].LoggingLevel), not a single object;MethodSettings.LoggingLevel) silently failed to match array elements;MethodSettings.LoggingLevelinstead ofMethodSettings[0].LoggingLevel), making it difficult to identify which method setting was affected;Proposed Changes
query.regoto iterate overMethodSettingsas an array usingproperties.MethodSettings[j]instead of accessingproperties.MethodSettingsdirectly:not common_lib.valid_key(methodSetting, "LoggingLevel")per array element;properties.MethodSettings[j].LoggingLevel == ""per array element;properties.MethodSettings[j].LoggingLevel == "OFF"per array element;searchKey,keyExpectedValue,keyActualValue, andsearchLinein all 3 rules to include the array index[j]for precise result identification;MethodSettingsin array brackets;MethodSettings.LoggingLeveltoMethodSettings: - LoggingLevel(YAML list syntax);positive_expected_result.jsonto reflect corrected line numbers and removed stale entries frompositive11.yamlthat no longer apply;I submit this contribution under the Apache-2.0 license.