Skip to content

feat: add IOC type filter to Feeds API and page#617

Merged
regulartim merged 7 commits intointelowlproject:developfrom
opbot-xd:feature/add-ioc-type-filter-v2
Dec 17, 2025
Merged

feat: add IOC type filter to Feeds API and page#617
regulartim merged 7 commits intointelowlproject:developfrom
opbot-xd:feature/add-ioc-type-filter-v2

Conversation

@opbot-xd
Copy link
Copy Markdown
Contributor

feat: add IOC type filter to Feeds API and page. Closes #551

Description

This PR adds the ability to filter IOCs by type (IP address or domain) in the Feeds API and frontend page. Users can now choose to view only IP addresses, only domains, or all IOCs (default behavior).

Related issues

Closes #551

Type of change

  • New feature (non-breaking change which adds functionality).

Checklist

  • I have read and understood the rules about how to Contribute to this project.
  • The pull request is for the branch develop.
  • I have added documentation of the new features.
  • Linters (Black, Flake, Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved. All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.

Changes Made

Backend:

  • Added ioc_type parameter to FeedRequestParams in api/views/utils.py
  • Added filtering logic to support "ip", "domain", and "all" (default) options
  • Added ioc_type field validation in api/serializers.py with ChoiceField
  • Added 4 comprehensive test cases in tests/test_views.py to cover all filtering scenarios

Frontend:

  • Added IOC type dropdown in frontend/src/components/feeds/Feeds.jsx
  • Updated column layout to accommodate new filter (4 columns now)
  • Integrated with existing API call structure

Tests:

  • Added test data for domain IOCs in tests/__init__.py
  • Added tests: test_200_feeds_filter_ip_only, test_200_feeds_filter_domain_only, test_200_feeds_filter_all, test_400_feeds_invalid_ioc_type
image image

- Add optional ioc_type parameter (ip/domain/all) to FeedRequestParams
- Update FeedsRequestSerializer with ioc_type field validation
- Modify get_queryset to filter IOCs by type when ioc_type is specified
- Add IOC type dropdown in Feeds page UI with three options
- Update frontend to include ioc_type in API calls and URL generation
- Add test data with domain IOC for comprehensive testing
- Add test cases for IP-only, domain-only, and all IOC type filters

This enhancement allows users to filter feeds specifically by IP addresses
or domains, making it easier to showcase domains extracted from payload
requests separately from IP addresses.

Closes intelowlproject#551
…mprove validation

1. Synced Tests with Existing Test Data: Updated assertions to expect 3 IOCs for Heralding instead of 2, matching the setupTestData. Refactored tests to find IOCs by value.
2. Fixed Feed Filtering Bug: Updated feeds view to correctly pass query parameters (like ioc_type) to FeedRequestParams.
3. Improved Input Validation: Added check in serializers to reject invalid IP strings that were being accepted as domains.
@opbot-xd opbot-xd changed the title Feature/add ioc type filter v2 feat: add IOC type filter to Feeds API and page Dec 16, 2025
@opbot-xd
Copy link
Copy Markdown
Contributor Author

Apologies for the confusion with the previous PR #610 . I realized I had mistakenly branched off main instead of develop, which caused the commit history to become messy.

To fix this, I reset my local branch to match develop and cherry-picked my specific feature commits onto it. This ensures the history is now clean, linear, and strictly contains the changes for this feature on top of the correct base branch.

@regulartim
Copy link
Copy Markdown
Collaborator

Could you please resolve the merge conflicts?

…type-filter-v2

# Conflicts:
#	tests/test_views.py
@opbot-xd
Copy link
Copy Markdown
Contributor Author

opbot-xd commented Dec 17, 2025

I have integrated the conditional check for the license presence logic:

if settings.FEEDS_LICENSE:
    self.assertEqual(response.json()["license"], settings.FEEDS_LICENSE)
else:
    self.assertNotIn("license", response.json())

@regulartim regulartim merged commit e1f835a into intelowlproject:develop Dec 17, 2025
6 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.

2 participants