-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Harden system/package parsing of deb size #17188
Merged
Merged
Conversation
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
Deb packages report their installed size in a field, Installed-Size, which is an integer interpreted as KiB. Some unoficial packages are adding a unit at the end of this field: Installed-Size: 65M Dpkg/Apt ignore everything after the number. Auditbeat is currently failing to parse the list of packages once this mistake is reached. This updates the dataset to: - Do not fail when installed size can't be parsed. - Understand prefixes k/K, m/M and G/b. Fixes elastic#16661
adriansr
added
bug
review
needs_backport
PR is waiting to be backported to other branches.
Auditbeat
Team:SIEM
labels
Mar 23, 2020
Pinging @elastic/siem (Team:SIEM) |
leehinman
approved these changes
Mar 23, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It is probably overkill in this case but we could look at https://godoc.org/github.com/dustin/go-humanize if we have more cases to worry about.
Thanks for the suggestion @leehinman. I didn't use it because I couldn't find a way to make it parse as KiB by default. |
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Mar 23, 2020
* Harden system/package parsing of deb size Deb packages report their installed size in a field, Installed-Size, which is an integer interpreted as KiB. Some unofficial packages are adding a unit at the end of this field: Installed-Size: 65M System tools dpkg/apt ignore everything after the number. Auditbeat is currently failing to parse the list of installed packages once this mistake is reached. This updates the dataset to: - Do not fail when installed size can't be parsed. - Understand prefixes k/K, m/M and G/b. Fixes elastic#16661 (cherry picked from commit b131405)
3 tasks
adriansr
added
v7.7.0
and removed
needs_backport
PR is waiting to be backported to other branches.
labels
Mar 23, 2020
adriansr
added a commit
that referenced
this pull request
Mar 24, 2020
* Harden system/package parsing of deb size Deb packages report their installed size in a field, Installed-Size, which is an integer interpreted as KiB. Some unofficial packages are adding a unit at the end of this field: Installed-Size: 65M System tools dpkg/apt ignore everything after the number. Auditbeat is currently failing to parse the list of installed packages once this mistake is reached. This updates the dataset to: - Do not fail when installed size can't be parsed. - Understand prefixes k/K, m/M and G/b. Fixes #16661 (cherry picked from commit b131405)
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Mar 24, 2020
* Harden system/package parsing of deb size Deb packages report their installed size in a field, Installed-Size, which is an integer interpreted as KiB. Some unofficial packages are adding a unit at the end of this field: Installed-Size: 65M System tools dpkg/apt ignore everything after the number. Auditbeat is currently failing to parse the list of installed packages once this mistake is reached. This updates the dataset to: - Do not fail when installed size can't be parsed. - Understand prefixes k/K, m/M and G/b. Fixes elastic#16661 (cherry picked from commit b131405)
3 tasks
adriansr
added a commit
that referenced
this pull request
Mar 24, 2020
…17230) Deb packages report their installed size in a field, Installed-Size, which is an integer interpreted as KiB. Some unofficial packages are adding a unit at the end of this field: Installed-Size: 65M System tools dpkg/apt ignore everything after the number. Auditbeat is currently failing to parse the list of installed packages once this mistake is reached. This updates the dataset to: - Do not fail when installed size can't be parsed. - Understand prefixes k/K, m/M and G/b. Fixes #16661 (cherry picked from commit b131405)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes system/package dataset parsing of Deb package's
Installed-Size
field in order to:Why is it important?
Deb packages report their installed size in a field,
Installed-Size
, which is an integer interpreted as KiB. Some rare third-party packages are adding a unit at the end of this field, by mistake:System tools dpkg/apt ignore everything after the number. However, Auditbeat is currently failing to parse the list of packages once this malformed field is reached.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesHow to test this PR locally
To generate a package with a malformed
Installed-Size
:Related issues
Fixes #16661
Logs