Generalized the find_build service's parameters#254
Generalized the find_build service's parameters#254Aaron1011 wants to merge 8 commits intotravis-ci:masterfrom
Conversation
|
we should probably whitelist params which are accepted, as this could become a DDOS vector by creating slow queries, and also potentially a security attack vector. |
|
I think just |
|
@henrikhodne @joshk: Does this look good? |
lib/travis/services/find_build.rb
Outdated
There was a problem hiding this comment.
I'd use params.slice(ALLOWED_PARAMS) instead.
There was a problem hiding this comment.
That might have to be params.slice(*ALLOWED_PARAMS), now that I think about it.
There was a problem hiding this comment.
👍 to slice
On 13/09/2013, at 12:03 AM, Henrik Hodne notifications@github.com wrote:
In lib/travis/services/find_build.rb:
@@ -30,7 +32,7 @@ def all_resources
enddef result
@result ||= scope(:build).find_by_id(params[:id]) That might have to be params.slice(*ALLOWED_PARAMS), now that I think about it.@result ||= scope(:build).where(params.select { |k| ALLOWED_PARAMS.include? k.to_sym } ).first—
Reply to this email directly or view it on GitHub.
|
@henrikhodne @joshk: Okay, fixed |
There was a problem hiding this comment.
Are all those params currently used for the where search? Does it make sense to allow all these? Especially as the previous implementation was find_by_id?
There was a problem hiding this comment.
@joshk: I need to add at least owner_id and pull_request_number for my other PR to cancel builds when a PR is closed. I don't think the others are necessary right now, so we could remove them.
There was a problem hiding this comment.
Can you point me to the related PRs again.
There was a problem hiding this comment.
I can't see owner_id being used here, and although pull_request_number is needed, it feels like the interaction can be encapsulated a little better. I need to think about this a little. Will look at it more this week.
|
@joshk: Ping |
1 similar comment
|
@joshk: Ping |
No description provided.