Open
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
andymeneely
requested changes
Aug 4, 2023
Collaborator
andymeneely
left a comment
There was a problem hiding this comment.
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.
|
|
||
| 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]+/ } |
Collaborator
There was a problem hiding this comment.
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.
Collaborator
There was a problem hiding this comment.
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 | ||
|
|
||
|
|
Collaborator
There was a problem hiding this comment.
Should have tests for directory, lessons, and related too.
3 tasks
- 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.
Contributor
Author
|
Related should be waited on until it is incorporated into the tables. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replace this with the text of what you did/doing
Have you...
Gemfile.lockandyarn.lockare't getting modified unintentionally?The above things are not required, but appreciated.