-
Notifications
You must be signed in to change notification settings - Fork 344
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
Fixes Server Capabilities apis to respond with RFC3339 date/time Format #7408 #7482
Fixes Server Capabilities apis to respond with RFC3339 date/time Format #7408 #7482
Conversation
|
||
selectQuery := "SELECT name, description, last_updated FROM server_capability sc" | ||
query := selectQuery + where + orderBy + pagination | ||
rows, err := tx.NamedQuery(query, queryValues) |
Check failure
Code scanning / CodeQL
Database query built from user-controlled sources
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.
This alert is valid but already exists in the current version, this is not a new vuln.
Codecov Report
@@ Coverage Diff @@
## master #7482 +/- ##
============================================
- Coverage 30.32% 30.31% -0.01%
Complexity 98 98
============================================
Files 789 789
Lines 82307 82304 -3
Branches 815 815
============================================
- Hits 24957 24954 -3
Misses 55245 55245
Partials 2105 2105
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@jagan-parthiban If you rebase this onto the master branch, the CiaB workflow should pass, since #7489 is what makes it fail |
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.
Type parameters were not in Go when this code was first written. Now that we need to support a new API version, we should be able to save a lot of lines of code using type parameters, rather than copying.
@@ -367,3 +367,157 @@ func (v *TOServerCapability) SelectMaxLastUpdatedQuery(where, orderBy, paginatio | |||
|
|||
func (v *TOServerCapability) Create() (error, error, int) { return api.GenericCreateNameBasedID(v) } | |||
func (v *TOServerCapability) Delete() (error, error, int) { return api.GenericDelete(v) } | |||
|
|||
func GetServerCapabilityV5(w http.ResponseWriter, r *http.Request) { |
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.
Rather than copying all of the content from GetServerCapability
to GetServerCapabilityV5
, we should be able to use the same function for either and use a type parameter for which ServerCapability
type to use.
|
||
selectQuery := "SELECT name, description, last_updated FROM server_capability sc" | ||
query := selectQuery + where + orderBy + pagination | ||
rows, err := tx.NamedQuery(query, queryValues) |
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.
This alert is valid but already exists in the current version, this is not a new vuln.
return | ||
} | ||
|
||
func CreateServerCapabilityV5(w http.ResponseWriter, r *http.Request) { |
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.
Same here: CreateServerCapability
can be reused if it accepts a type parameter.
return | ||
} | ||
|
||
func UpdateServerCapabilityV5(w http.ResponseWriter, r *http.Request) { |
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.
Same here: UpdateServerCapability
can be reused if it accepts a type parameter.
On second thought, maybe this is a little complicated to be able to easily save time with generics. Once the branch is rebased onto the master branch, #7482 should be good to merge. |
be7638c
to
0682d59
Compare
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.
Looks good, thanks!
Closes: #7465
Related: #5911
What is the best way to verify this PR?
Make Api calls to service_category 5.0
If this is a bugfix, which Traffic Control versions contained the bug?
PR submission checklist