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

ISSUE-1776: Fixing filename in the results #82

Merged
merged 1 commit into from
Dec 6, 2023
Merged

Conversation

varunsharma0286
Copy link
Contributor

HostMountDir = "/fenced/mnt/host"
MalwareScanDir = "/"
HostMountDir = "/fenced/mnt/host"
cntnrPathPrefixRegex = `.+?\/overlay2\/[A-z0-9a-z]+\/merged`
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC merged is not guaranteed, it might be diff, lower or work as per https://pkg.go.dev/github.com/barracks510/go-overlay2

@@ -157,7 +163,9 @@ func (s *gRPCServer) FindMalwareInfo(c context.Context, r *pb.MalwareRequest) (*
}

for malware := range malwares {
if trim {
if isContainer {
malware.CompleteFilename = cntnrPathPrefixRegexObj.ReplaceAllString(malware.CompleteFilename, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we want to remove a prefix, we might as well just find the end of the prefix and cut a slice out of malware.CompleteFilename (preventing extra string allocation)

@varunsharma0286 varunsharma0286 merged commit e859c10 into main Dec 6, 2023
1 check passed
@varunsharma0286 varunsharma0286 deleted the ISSUE-1776 branch December 6, 2023 07:00
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.

2 participants