Skip to content

Add cve and protocol filters and fields to the feeds. Closes #1819 - #1860

Merged
regulartim merged 5 commits into
GreedyBear-Project:developfrom
Akshats-git:feature/feeds-cve-protocol-filter
Nov 17, 2026
Merged

regulartim merged 5 commits into
GreedyBear-Project:developfrom
Akshats-git:feature/feeds-cve-protocol-filter

Conversation

@Akshats-git

@Akshats-git Akshats-git commented Nov 13, 2026 •

Copy link
Copy Markdown

Description

The advanced feed has two new filters: cve and protocol. Both take values separated by ; and match IOCs that have any of them. A malformed CVE returns a 400.

Every feed row now also has cves and protocols in JSON and NDJSON. The ASN feed and share tokens accept the new filters too.

Related issues

Closes #1819

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Chore (refactoring, dependency updates, CI/CD changes, code cleanup, docs-only changes).

Checklist

Formalities

  • I have read and understood the rules about how to Contribute to this project.
  • I have read and understood the AI policy.
  • I chose an appropriate title for the pull request in the form: <feature name>. Closes #999
  • My branch is based on develop.
  • The pull request is for the branch develop.
  • I have reviewed and verified any LLM-generated code included in this PR.
  • I am interested in participating in GSoC.

Docs and tests

  • I documented my code changes with docstrings and/or comments.
  • I have checked if my changes affect user-facing behavior that is described in the wiki. If so, I also included an update to the wiki in the description of this PR.
  • Linter (Ruff) gave 0 errors.
  • I have added tests for the feature/bug I solved.
  • All the tests gave 0 errors.

GUI changes

No GUI changes.

AI Disclosure

Mostly wrote the code myself. Used Claude to confirm its correctness and avoid any linting issues.

@Akshats-git
Akshats-git changed the base branch from main to develop November 13, 2026 13:07

@AdeshDeshmukh AdeshDeshmukh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i verified locally — filters, case normalization, 400 handling on malformed CVEs, field output across JSON/NDJSON/public rows, and share-token replay all behave exactly as described. Tests green (85/85 module, 558/558 package)..! looks clean..!

however the ai disclosure is absent.! as it's part of the pr template, so worth adding before review..! ig

@regulartim regulartim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @Akshats-git ! Thanks for your work. Only fond some cosmetic stuff.
As @AdeshDeshmukh mentioned, please add the AI disclosure section again.

Thank you @AdeshDeshmukh for your review.

Comment thread greedybear/regex.py Outdated
REGEX_DOMAIN = r"^[a-zA-Z\d-]{1,60}(\.[a-zA-Z\d-]{1,60})*$"
REGEX_PASSWORD = r"^(?=.*[a-zA-Z])\S{12,}$" # noqa: S105

REGEX_CVE = r"CVE-\d{4}-\d{4,}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea to create a regex for that! There are two other places in the code that use similar regexes:

  • validate_cve_id in api/serializers/events.py
  • iocs_from_hits in extraction/utils.py

Can you swap this copies with the regex you made here, if possible?

@Akshats-git Akshats-git Nov 17, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done. I also bounded it to 10 digits like the extraction regex had it so a CVE always fits the 50 character column. also added 2 tests for it.

Comment thread api/serializers/feeds.py

class ReputationListField(serializers.ListField):
"""ListField for the include_reputation and exclude_reputation query params.
class SemicolonListField(serializers.ListField):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea to rename that! 👍

Comment thread api/serializers/feeds.py
Comment on lines +210 to +219
cve = SemicolonListField(
child=serializers.CharField(),
required=False,
help_text="`;`-separated CVE IDs (e.g. `CVE-2021-44228`). Only IOCs that were seen exploiting at least one of them.",
)
protocol = SemicolonListField(
child=serializers.CharField(),
required=False,
help_text="`;`-separated protocols (e.g. `ssh;telnet`). Only IOCs that were seen using at least one of them.",
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a response schema. CVEs and protocols are marked required=False even though the rows always include them. So shouldn't it be required=True?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oh yes you are right, i did the fix.

@regulartim regulartim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @Akshats-git ! Thanks for implementing the changes. Basically this is ready to merge. I only found another small nit. Also, there's unfortunately a merge conflict that you have to resolve.

Comment thread api/serializers/feeds.py Outdated
Comment on lines +20 to +22
# width of IOC.protocols items
MAX_PROTOCOL_LENGTH = 50

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realized that this information is redundant, as it is already present in the data model. You could read it from IOC._meta.get_field("protocols").base_field.max_length, am I right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes my bad. I've fixed it.

@Akshats-git
Akshats-git force-pushed the feature/feeds-cve-protocol-filter branch from d50a821 to 4d59660 Compare November 17, 2026 18:19

@regulartim regulartim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thank you! :)

Mostly wrote the code myself. Used Claude to confirm its correctness and avoid any linting issues.

I appreciate your honesty and I know how tempting it is to just use Claude, when you have it at hand. I'd strongly recommend you to try to work without it anyway when you are interested in GSoC. I don't care if your code is not as polished, but I care about what your work looks like when no LLM is involved. Keep it up! :)

Also: linting issues can be avoided by just running the linters. ;-)

@regulartim
regulartim merged commit a159aa2 into GreedyBear-Project:develop Nov 17, 2026
7 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.

Feature Request: Expose IOC CVEs and protocols in feeds and allow filtering by them

3 participants