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

added attacker ip #430

Merged
merged 1 commit into from
Jan 21, 2025
Merged

added attacker ip #430

merged 1 commit into from
Jan 21, 2025

Conversation

afek854
Copy link
Contributor

@afek854 afek854 commented Jan 21, 2025

PR Type

Enhancement


Description

  • Added a new AttackerIp field to the HttpRuleAlert struct.

  • Enhanced the HttpRuleAlert struct to include attacker IP information.


Changes walkthrough 📝

Relevant files
Enhancement
runtimeincidents.go
Introduced `AttackerIp` field in `HttpRuleAlert` struct   

armotypes/runtimeincidents.go

  • Added a new AttackerIp field to the HttpRuleAlert struct.
  • The new field is optional and supports JSON and BSON serialization.
  • +2/-0     

    Need help?
  • Type /help how to ... in the comments thread for any question about Qodo Merge usage.
  • Check out the documentation for more information.
  • Signed-off-by: Afek Berger <[email protected]>
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The AttackerIp field could potentially expose sensitive network information about attackers/users. While storing attacker IPs is a common security practice, care should be taken to ensure this data is properly protected, anonymized if needed, and compliant with relevant privacy regulations (e.g., GDPR). Consider adding documentation about data retention policies and access controls for this field.

    ⚡ No major issues detected

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Enforce valid IP address format

    Validate the IP address format before storing it in AttackerIp to ensure it's a
    valid IPv4 or IPv6 address.

    armotypes/runtimeincidents.go [140]

    -AttackerIp string `json:"attackerIp,omitempty" bson:"attackerIp,omitempty"`
    +AttackerIp net.IP `json:"attackerIp,omitempty" bson:"attackerIp,omitempty"`
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Using net.IP type instead of string provides built-in validation and proper handling of IP addresses, preventing invalid IP values from being stored and ensuring type safety. This is particularly important for security-related fields.

    8

    @@ -136,6 +136,8 @@ type HttpRuleAlert struct {
    Body string `json:"body,omitempty" bson:"body,omitempty"` // e.g., "<html>...</html>"
    Proto string `json:"proto,omitempty" bson:"proto,omitempty"` // e.g., "HTTP/1.1"
    } `json:"response,omitempty" bson:"response,omitempty"`

    AttackerIp string `json:"attackerIp,omitempty" bson:"attackerIp,omitempty"`
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    SourceIp

    @afek854 afek854 merged commit 3d04711 into main Jan 21, 2025
    3 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants