-
Notifications
You must be signed in to change notification settings - Fork 5
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
Issue 1101 similar vul endpoint #1154
Open
diego-avila-358
wants to merge
9
commits into
master
Choose a base branch
from
issue-1101-SimilarVulEndpoint
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1eedcb0
- Added proper routing
diego-avila-358 2c72fe7
Merge branch 'master' into issue-1101-SimilarVulEndpoint
diego-avila-358 e94bbda
-Changed Error message
diego-avila-358 3f5e6a7
-Created test for similarVulnerabilities
diego-avila-358 2b31031
-Added ordering to similarVulnerability query
diego-avila-358 43fa99a
-Finisehd same directory event
diego-avila-358 eaab285
-fixed broken tests :)
diego-avila-358 18a1776
- Separated similarVulnerabilities and related assets
diego-avila-358 b7b9d6a
-finished all tests.
diego-avila-358 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,14 @@ class VulnerabilityTest < ActiveSupport::TestCase | |
assert_nil Vulnerability.find_by(cve: "CVE-2011-3096") | ||
end | ||
|
||
test 'similar vulnerabilities, same-cwe' do | ||
vuln = Vulnerability.similarVulnerabilities('CVE-2013-2878', 'cwe', 10, 0) | ||
vulnResults = vuln.map { |v| v['cve']} | ||
expected_results = %w( | ||
CVE-2016-1676 | ||
) | ||
assert_equal expected_results, vulnResults, 'SQL statement is not correct' | ||
end | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should have tests for directory, lessons, and related too. |
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's actually split this out into four endpoints -
:id/samedirectory
,:id/samecwe
, etc.. That saves us from having a giant if-statement with different queries.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would also mean the model would be different methods too, e.g.
same_cwe
andsame_directory