Skip to content

feat(security_groups): enhance unused security group detection with ENI-based approach #30

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

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

dannysteenman
Copy link
Member

@dannysteenman dannysteenman commented Jun 10, 2025

GitHub Issue

#25


PR Type

Enhancement


Description

  • Improved security group detection using ENI-based approach

  • Enhanced type filtering based on naming conventions

  • Streamlined code by removing service-specific checks

  • Updated documentation for clarity and accuracy


Changes walkthrough 📝

Relevant files
Enhancement
delete_unused_security_groups.py
Refactor security group detection and improve documentation

general/delete_unused_security_groups.py

  • Replaced service-specific checks with ENI-based detection
  • Updated type filtering to use naming conventions
  • Removed unnecessary AWS client initializations
  • Enhanced documentation and usage instructions
  • +54/-69 

    @dannysteenman dannysteenman added the enhancement New feature or request label Jun 10, 2025
    @dannysteenman dannysteenman changed the title feat(security_groups): enhance script to identify and delete unused s… feat(security_groups): enhance unused security group detection with ENI-based approach Jun 10, 2025
    @dannysteenman dannysteenman requested a review from Copilot June 10, 2025 08:21
    Copy link

    @Copilot 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 enhances the detection of unused security groups by shifting from service-specific checks to an ENI-based approach, streamlining AWS client usage and updating documentation accordingly.

    • Replaces individual service checks with a unified ENI-based detection method.
    • Updates type filtering to rely on naming conventions.
    • Removes extraneous AWS client initializations and clarifies usage in the documentation.
    Comments suppressed due to low confidence (2)

    general/delete_unused_security_groups.py:159

    • [nitpick] Consider using a multiline string or reformatting the help text for the '--type' argument to enhance readability in the CLI.
    help="Specify the type of security groups to consider based on naming conventions: - all: All security groups - ec2: Security groups not starting with 'rds-' or 'elb-' - rds: Security groups starting with 'rds-' - elb: Security groups starting with 'elb-'"
    

    general/delete_unused_security_groups.py:40

    • [nitpick] Consider removing the trailing newline from the log message to maintain consistency with other log outputs.
    logger.info(f"Unused Security Group IDs: {list(unused_sg)}\n")
    

    …ecurity groups using ENI-based detection and improved type filtering
    @dannysteenman dannysteenman merged commit 249766a into main Jul 4, 2025
    1 check passed
    @dannysteenman dannysteenman deleted the fix/gh-25 branch July 4, 2025 06:58
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant