Skip to content

Fix crash in unix users plugins if GID or UID is empty#996

Merged
Horofic merged 5 commits intofox-it:mainfrom
wbi-ocd:995_linux_passwd_compat
Jan 23, 2025
Merged

Fix crash in unix users plugins if GID or UID is empty#996
Horofic merged 5 commits intofox-it:mainfrom
wbi-ocd:995_linux_passwd_compat

Conversation

@wbi-ocd
Copy link
Contributor

@wbi-ocd wbi-ocd commented Jan 16, 2025

This PR fix an issue while processing /etc/passwd entry where gid or uid id empty.
This kind OS issue could also be fixed more generally in flow, by checking if entry is empty before coercing into an int, but I'm not sure if this would be the expected comportment for all entries.
Also modify error handler to backslash replace, to prevent crash in case file contains non utf-8 characters.

fix #995

@Horofic Horofic self-assigned this Jan 20, 2025
wbi-ocd and others added 2 commits January 23, 2025 09:11
Co-authored-by: Stefan de Reuver <9864602+Horofic@users.noreply.github.com>
@wbi-ocd
Copy link
Contributor Author

wbi-ocd commented Jan 23, 2025

@Horofic, changes have been applied. I have also completed test with the new entry

@wbi-ocd wbi-ocd requested a review from Horofic January 23, 2025 08:49
@codecov
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.76%. Comparing base (e7d007a) to head (d025884).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #996   +/-   ##
=======================================
  Coverage   77.76%   77.76%           
=======================================
  Files         327      327           
  Lines       28654    28654           
=======================================
  Hits        22282    22282           
  Misses       6372     6372           
Flag Coverage Δ
unittests 77.76% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Horofic Horofic merged commit 3c370ff into fox-it:main Jan 23, 2025
18 of 20 checks passed
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.

unix : users plugin crash if UID/GID is empty in passwd file

3 participants