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

remove redundant parameter from vulnerability retrieval in Jira workf… #576

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

kooomix
Copy link
Contributor

@kooomix kooomix commented Jan 9, 2025

User description

…lows


PR Type

Bug fix


Description

  • Removed redundant parameter expected_results from get_vulns_v2 call.

  • Simplified vulnerability retrieval logic in Jira workflows.


Changes walkthrough 📝

Relevant files
Bug fix
jira_workflows.py
Simplify vulnerability retrieval logic in tests                   

tests_scripts/workflows/jira_workflows.py

  • Removed the expected_results parameter from get_vulns_v2 call.
  • Adjusted logic for vulnerability Jira ticket creation.
  • +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Ensure consistent test behavior by validating the number of vulnerabilities returned from the API call

    Add pagination handling or result limit validation since the expected_results
    parameter was removed from get_vulns_v2. Without limiting results, the function
    might return more vulnerabilities than expected, potentially affecting the test's
    reliability.

    tests_scripts/workflows/jira_workflows.py [119]

     response_vuln = self.backend.get_vulns_v2(body=vuln_body, enrich_tickets=True)
    +assert len(response_vuln) == 1, f"Expected 1 vulnerability, but got {len(response_vuln)}"
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: The removal of 'expected_results=1' parameter could lead to test inconsistency if multiple vulnerabilities are returned. Adding result count validation is crucial for maintaining test reliability and preventing false positives.

    9

    Copy link

    github-actions bot commented Jan 9, 2025

    Failed to generate code suggestions for PR

    @kooomix kooomix merged commit 1d988f8 into master Jan 9, 2025
    2 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.

    2 participants