Skip to content
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: No longer collect executable files #207

Merged
merged 5 commits into from Nov 16, 2023
Merged

Conversation

daffinito
Copy link
Contributor

Issue

IHEDIAG-649
Infra log collection can collect .exe files

Goals

Ensure no executable files are being collected

Implementation Details

I updated the regex that is used in the Infra/Log/Collect task to be more specific. If the infra config has a log path that ends with newrelic-infra.log, the regex would be

  • OLD: ^newrelic-infra*
  • NEW: ^newrelic-infra.*(.gz|.zip|.log)

I updated the FileCopyEnvelope struct with a function to check if a file is executable. For windows it just checks if the suffix is .exe. For Linux/Mac, it checks the file permissions as described in this stack overflow.

I updated the paths we search for config files to include the paths for Infra on Mac installed via brew. Taken from this doc.

How to Test

go test ./...

I smoke tested by:

  • Running the Infra suite and confirming it collected the newrelic-infra.log
  • Moving the newrelic-infra.log and replacing it with an executable file
  • Running the infra suite again, and confirming that Skipping executable file: is in the debug logging and that the log file is not in the zip

Copy link
Collaborator

@cade-conklin cade-conklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@daffinito daffinito merged commit 5c6c3b7 into main Nov 16, 2023
13 checks passed
@daffinito daffinito deleted the daffi/infra-log-gathering branch November 16, 2023 20:05
@daffinito daffinito mentioned this pull request Nov 16, 2023
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.

None yet

2 participants