Skip to content

fix: validate zeek folder contents to only contain zeek log files (#1… - #2137

Open
Adnan9-63 wants to merge 1 commit into
stratosphereips:developfrom
Adnan9-63:fix-zeek-dir-validation
Open

Adnan9-63 wants to merge 1 commit into
stratosphereips:developfrom
Adnan9-63:fix-zeek-dir-validation

Conversation

@Adnan9-63

Copy link
Copy Markdown

Fixes Issue

Closes #1593

Changes proposed

  • Updated get_input_file_type() in slips/main.py to rigorously validate Zeek directories. It now checks every item in the folder and cleanly throws an error if it encounters subdirectories, empty directories, or invalid files (not ending in .log or .log.labeled), preventing IsADirectoryError crashes.
  • Added comprehensive unit tests in tests/unit/slips/test_main.py (test_get_input_file_type_zeek_folder) covering valid, empty, subdirectory, and invalid file scenarios.

Steps I followed to test the changes proposed in this PR:

  • Ran python3 -m pytest tests/unit/slips/test_main.py directly, passing all assertions for the validation logic.
  • Ran the entire canonical unit test suite, resulting in 100% pass rate.
  • Verified the directory iteration logic handles ignored log files gracefully.

Check List

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.
  • My PR is based on develop branch. (mandatory)

Note to reviewers

Fixes #1593. ZeekDirInput previously threw an IsADirectoryError if os.listdir()[0] was a subdirectory. This PR strictly enforces that the -f directory contains exclusively valid zeek log files, cleanly printing an error otherwise.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 06:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Adnan9-63
Adnan9-63 deployed to external-pr-approval October 7, 2026 07:59 — with GitHub Actions Active
@eldraco

eldraco commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Adnan9-63 , let us check it

@Adnan9-63
Adnan9-63 changed the base branch from master to develop November 2, 2026 20:26
@Adnan9-63
Adnan9-63 force-pushed the fix-zeek-dir-validation branch from 93d32ad to 7be96e5 Compare November 4, 2026 12:43

This branch was successfully deployed

1 active (outdated) deployment
external-pr-approval — 93d32ad0 Deployed Oct 7, 2026 by Adnan9-63 via External PR approval #35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Print an error to the user if the zeek dir given doesn't contain only zeek log files

3 participants