-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(general): Fix jsonpath-key handling for special characters like "…
…/" and reduce log size (#6907) * remove logging of attributes to reduce log size * Handled cases of / character in complex attribute switch * Refactored unneeded method * Removed implemention of jsonpath_key in cloudformation and refactored code to one location, in addition added a test for the jsonpath key generation * flake8 --------- Co-authored-by: Barak Fatal <barakf156@gmail.com>
- Loading branch information
Showing
4 changed files
with
30 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
|
||
from checkov.common.graph.graph_builder.graph_components.blocks import Block | ||
|
||
|
||
@pytest.mark.parametrize("input_key, expected_key", ( | ||
("a.b", "$.a.b"), | ||
("a.0", "$.a[0]"), | ||
("a.0.b.1.2.c", "$.a[0].b[1][2].c"), | ||
("a.0./mock-part-of-key.d.e.1", "$.a[0].\"/mock-part-of-key\".d.e[1]"), | ||
("a.0.Fn::Region.d.e.1", "$.a[0].\"Fn::Region\".d.e[1]") | ||
)) | ||
def test__get_jsonpath_key(input_key: str, expected_key: str) -> None: | ||
result = Block._get_jsonpath_key(input_key) | ||
assert result == expected_key |