Skip to content

Conversation

@cx-ricardo-jesus
Copy link
Contributor

@cx-ricardo-jesus cx-ricardo-jesus commented Jan 26, 2026

Reason for Proposed Changes

  • Currently, when the remediation tests fail. There is no indication of which files were actually remediated.
  • This information could help in situations where the remediation tests fail, because it will be easier to see which files were remediated, decreasing the time spent analysing which scenarios are causing these tests to fail.

Proposed Changes

  • On the Summary struct present inside the utils.go file, added the RemediatedFiles, which is an array of strings, meant to store the path of the files that were remediated.
  • Inside the method testRemediationQuery, added a new map, meant to store the connections between the temporary files used to do the remediations and the original files from which those temporary files came. The key is the path to these temporary files, and the value is the path to the original file.
  • The new map tempToOriginal will be necessary to send the path to the original file through the RemediateFile method inside the summary, which now takes one more argument (original_file_name). Within this RemediateFile method, this path is passed to the writeRemediation function to append the original filename to the new field RemediatedFiles in the Summary struct.
  • Returning to the method mentioned earlier, testRemediationQuery, the test now returns a different message from the original, and now also mentions the files that were remediated.
  • Other changes can be seen in the remediation_test.go and remediate.go, because both use the changed RemediateFile method that now takes one more argument.
  • On the remediation_test.go, I passed the filePathCopyFrom, which is the path of the original file used for the tests.
  • On the remediate.go, I passed an empty string, because this file handles the remediation command, and in this command, which is meant to apply a remediation to a certain file, the original file path was already sent to the RemediateFile method.

I submit this contribution under the Apache-2.0 license.

@cx-ricardo-jesus cx-ricardo-jesus requested a review from a team as a code owner January 26, 2026 15:46
@cx-ricardo-jesus cx-ricardo-jesus marked this pull request as draft January 26, 2026 15:46
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.18

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

…igured_for_organization/payloads/all_payloads.json
…automated_using_release_channels/payloads/all_payloads.json
…automated_using_release_channels/payloads directory
…have_alpha_features_enabled/payloads/all_payloads.json
…older_google_projects/payloads/test_payload.json
…figuration_changes/payloads/all_payloads.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant