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

Bug: invalid metadata dates cause rule_output TypeError #48

Open
DocArmoryTech opened this issue Feb 15, 2025 · 0 comments
Open

Bug: invalid metadata dates cause rule_output TypeError #48

DocArmoryTech opened this issue Feb 15, 2025 · 0 comments

Comments

@DocArmoryTech
Copy link

During the #Age Check phase of rule output (main/rule_output.py#L95), the date or modified fields in the metadata[] may contain invalid dates and thereby cause a TypeError

File "/builds/group-a/yara/yara-forge/main/rule_output.py", line 107, in write_yara_packages
    if (datetime.datetime.now() - rule_date).days > rule_package['max_age']:
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType'
DocArmoryTech added a commit to DocArmoryTech/yara-forge that referenced this issue Feb 15, 2025
fixes issue YARAHQ#48 where a TypeError is caused when age-checking invalid metadata date fields.

To avoid errors caused  by missing or improperly formatted dates in rule metadata, this commit ensures `rule_date` is not `None` before performing date calculations,
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

No branches or pull requests

1 participant