-
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
base: master
Are you sure you want to change the base?
Conversation
- Able to complete both cwe and lessons endpoints
-Wrote tests for vulnerabilities controller
sql in vulnerabilities.rb - Added tests to yml - Fixed SQL statement for same-cwe
- Added similarVulnerability endpoint to openapi.yml
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.
Finally got around to this! Ok let's split these out to separate endpoints so we don't have to deal with if-statements and processing options. Simplifies things I think.
config/routes.rb
Outdated
@@ -4,6 +4,7 @@ | |||
|
|||
get '/vulnerabilities', controller: :vulnerabilities, action: :index | |||
get '/vulnerabilities/:id', controller: :vulnerabilities, action: :show, constraints: { id: /CVE\-\d+\-\d+/ } | |||
get '/api/vulnerabilities/:id/:similarity', controller: :vulnerabilities, action: :similarVulnerabilities, constraints: { id: /CVE\-\d+\-\d+/, similarity: /[-A-Za-z]+/ } |
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
and same_directory
assert_equal expected_results, vulnResults, 'SQL statement is not correct' | ||
end | ||
|
||
|
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.
Should have tests for directory, lessons, and related too.
- sameCWE - sameDirectory - sameLessons -related should be reverted back to its old issue, as it needs a schema change. - routing to the separation of similarVulnerabilities was also done.
-reworked and fixed all tests.
Related should be waited on until it is incorporated into the tables. |
Summary
Replace this with the text of what you did/doing
Have you...
Gemfile.lock
andyarn.lock
are't getting modified unintentionally?The above things are not required, but appreciated.