Skip to content

Commit a8546ab

Browse files
committed
iolog_parse_loginfo_json: Add check for required eventlog entries
Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 3c78d08 commit a8546ab

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/iolog/iolog_json.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ iolog_parse_loginfo_json(FILE *fp, const char *iolog_dir, struct eventlog *evlog
4545

4646
/* Cleanup. */
4747
eventlog_json_free(root);
48+
49+
/* Check for required entries (some may be set to "unknown"). */
50+
if (evlog->command == NULL || evlog->cwd == NULL ||
51+
evlog->runargv == NULL || evlog->runuser == NULL ||
52+
evlog->submituser == NULL || evlog->ttyname == NULL) {
53+
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
54+
"missing required log.json entries");
55+
ret = false;
56+
}
4857
}
4958

5059
debug_return_bool(ret);

0 commit comments

Comments
 (0)