Skip to content

Conversation

@Tbaile
Copy link
Collaborator

@Tbaile Tbaile commented Apr 29, 2025

Added APIs for feature linked below

Ref: #924

@Tbaile Tbaile changed the title feat(threatshield): active block list feat(threatshield): active block list and ip search May 7, 2025
@Tbaile Tbaile requested a review from gsanchietti May 7, 2025 12:43
@gsanchietti gsanchietti requested a review from Copilot May 7, 2025 13:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new APIs for managing the threat shield active block list and IP search functionality, expanding the command dispatch and error handling capabilities.

  • Introduces functions to parse IP expressions and sets, list active IP blocks, remove an active block, and search if an IP is blocked.
  • Updates command mapping to include 'list-active-blocks', 'remove-active-block', and 'is-ip-blocked'.
Comments suppressed due to low confidence (2)

packages/ns-api/files/ns.threatshield:585

  • The subprocess module is used in multiple functions but it is not imported in this file. Please add 'import subprocess' at the top of the file.
output_ipv4 = subprocess.run(["nft", "-j", "list", "set", "inet", "banIP", "blocklistv4"], check=True, capture_output=True, text=True)

packages/ns-api/files/ns.threatshield:602

  • [nitpick] The sorting key using 'timeout - expires' is not immediately clear; please verify that this logic correctly reflects the intended ordering or add a comment to clarify the purpose.
blocks = sorted(blocks, key=lambda x: x["timeout"] - x["expires"])

@Tbaile Tbaile requested a review from gsanchietti May 7, 2025 15:07
@Tbaile Tbaile linked an issue May 14, 2025 that may be closed by this pull request
@Tbaile Tbaile merged commit 44e146b into main May 21, 2025
1 check passed
@Tbaile Tbaile deleted the issue-924 branch May 21, 2025 08:55
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.

Threat shield IP UI: manage list of blocked IPs

3 participants