Skip to content

Commit

Permalink
fix: CWE-23 detected by Snyk in apply_spec_filters
Browse files Browse the repository at this point in the history
- RHINENG-14792, RHINENG-14796

Signed-off-by: Xiangce Liu <[email protected]>
  • Loading branch information
xiangce committed Jan 15, 2025
1 parent c530404 commit 98003b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions insights/tools/apply_spec_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def apply_filters(_format, _plugins, output=None):

load_packages(parse_plugins(_plugins))

output = os.path.realpath(output)

if _format == "yaml":
yaml_path = output
if not yaml_path:
Expand Down Expand Up @@ -85,12 +87,12 @@ def apply_filters(_format, _plugins, output=None):
uploader_json["version"] = datetime.now().isoformat()

pattern = re.compile(",")
output = "\n".join(
json_content = "\n".join(
pattern.sub(",", l) for l in json.dumps(uploader_json, indent=4).splitlines()
)

with open(json_path, "w") as fp:
fp.write(output)
fp.write(json_content)
return 0


Expand Down

0 comments on commit 98003b4

Please sign in to comment.