Merge pull request #168 from travis-ci/rkh-less-gh-error-noise
Rkh less gh error noise
This commit is contained in:
commit
5fb2feb7e7
|
@ -39,7 +39,7 @@ class Travis::Api::App
|
||||||
# Logging is set up by custom middleware
|
# Logging is set up by custom middleware
|
||||||
disable :protection, :logging, :setup
|
disable :protection, :logging, :setup
|
||||||
enable :raise_errors
|
enable :raise_errors
|
||||||
# disable :dump_errors
|
disable :dump_errors
|
||||||
register :subclass_tracker, :expose_pattern
|
register :subclass_tracker, :expose_pattern
|
||||||
helpers :respond_with, :mime_types
|
helpers :respond_with, :mime_types
|
||||||
end
|
end
|
||||||
|
@ -48,6 +48,7 @@ class Travis::Api::App
|
||||||
# We want error pages in development, but only
|
# We want error pages in development, but only
|
||||||
# when we don't have an error handler specified
|
# when we don't have an error handler specified
|
||||||
set :show_exceptions, :after_handler
|
set :show_exceptions, :after_handler
|
||||||
|
enable :dump_errors
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -274,6 +274,9 @@ class Travis::Api::App
|
||||||
user = manager.fetch
|
user = manager.fetch
|
||||||
halt 403, 'not a Travis user' if user.nil?
|
halt 403, 'not a Travis user' if user.nil?
|
||||||
user
|
user
|
||||||
|
rescue GH::Error
|
||||||
|
# not a valid token actually, but we don't want to expose that info
|
||||||
|
halt 403, 'not a Travis user'
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_token(endpoint, values)
|
def get_token(endpoint, values)
|
||||||
|
|
|
@ -138,9 +138,18 @@ describe Travis::Api::App::Endpoint::Authorization do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "errors if no token is given" do
|
it "errors if no token is given" do
|
||||||
|
User.stubs(:find_by_github_id).with(111).returns(user)
|
||||||
post("/auth/github").should_not be_ok
|
post("/auth/github").should_not be_ok
|
||||||
last_response.status.should == 422
|
last_response.status.should == 422
|
||||||
body.should_not include("access_token")
|
body.should_not include("access_token")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "errors if github throws an error" do
|
||||||
|
GH.stubs(:with).raises(GH::Error)
|
||||||
|
post("/auth/github", github_token: 'foo bar').should_not be_ok
|
||||||
|
last_response.status.should == 403
|
||||||
|
body.should_not include("access_token")
|
||||||
|
body.should include("not a Travis user")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,28 +9,31 @@ Gem::Specification.new do |s|
|
||||||
s.require_path = 'lib'
|
s.require_path = 'lib'
|
||||||
|
|
||||||
s.authors = [
|
s.authors = [
|
||||||
"Piotr Sarnacki",
|
|
||||||
"Konstantin Haase",
|
"Konstantin Haase",
|
||||||
|
"Piotr Sarnacki",
|
||||||
"Sven Fuchs",
|
"Sven Fuchs",
|
||||||
"Hiro Asari",
|
"Hiro Asari",
|
||||||
"Mathias Meyer",
|
"Mathias Meyer",
|
||||||
"Josh Kalderimis",
|
"Josh Kalderimis",
|
||||||
"Henrik Hodne",
|
"Henrik Hodne",
|
||||||
|
"carlad",
|
||||||
|
"Tyranja",
|
||||||
"Andre Arko",
|
"Andre Arko",
|
||||||
"Dan Buch",
|
"Dan Buch",
|
||||||
|
"C. Scott Ananian",
|
||||||
"Erik Michaels-Ober",
|
"Erik Michaels-Ober",
|
||||||
"Steve Richert",
|
|
||||||
"Brian Ford",
|
"Brian Ford",
|
||||||
"Patrick Williams",
|
"Steve Richert",
|
||||||
"Bryan Goldstein",
|
|
||||||
"Puneeth Chaganti",
|
"Puneeth Chaganti",
|
||||||
"Thais Camilo and Konstantin Haase",
|
"Thais Camilo and Konstantin Haase",
|
||||||
"Tim Carey-Smith",
|
"Tim Carey-Smith",
|
||||||
|
"Bryan Goldstein",
|
||||||
"Zachary Scott",
|
"Zachary Scott",
|
||||||
"James Dennes",
|
"James Dennes",
|
||||||
"rainsun",
|
"rainsun",
|
||||||
"Dan Rice",
|
"Nick Schonning",
|
||||||
"Nick Schonning"
|
"Patrick Williams",
|
||||||
|
"Dan Rice"
|
||||||
]
|
]
|
||||||
|
|
||||||
s.email = [
|
s.email = [
|
||||||
|
@ -43,24 +46,28 @@ Gem::Specification.new do |s|
|
||||||
"me@henrikhodne.com",
|
"me@henrikhodne.com",
|
||||||
"henrik@hodne.io",
|
"henrik@hodne.io",
|
||||||
"konstantin.haase@gmail.com",
|
"konstantin.haase@gmail.com",
|
||||||
|
"carla@travis-ci.org",
|
||||||
|
"tyranja@cassiopeia.uberspace.de",
|
||||||
"andre@arko.net",
|
"andre@arko.net",
|
||||||
"svenfuchs@artweb-design.de",
|
"svenfuchs@artweb-design.de",
|
||||||
"dan@travis-ci.org",
|
"dan@travis-ci.org",
|
||||||
"sferik@gmail.com",
|
"sferik@gmail.com",
|
||||||
|
"cscott@cscott.net",
|
||||||
|
"henrik@travis-ci.com",
|
||||||
"steve.richert@gmail.com",
|
"steve.richert@gmail.com",
|
||||||
"bford@engineyard.com",
|
"bford@engineyard.com",
|
||||||
"henrik@travis-ci.com",
|
"patrick@bittorrent.com",
|
||||||
"brysgo@gmail.com",
|
"punchagan@muse-amuse.in",
|
||||||
"jdennes@gmail.com",
|
"carlad@users.noreply.github.com",
|
||||||
|
"dan@zoombody.com",
|
||||||
"rainsuner@gmail.com",
|
"rainsuner@gmail.com",
|
||||||
"dev+narwen+rkh@rkh.im",
|
"dev+narwen+rkh@rkh.im",
|
||||||
"tim@spork.in",
|
"tim@spork.in",
|
||||||
|
"brysgo@gmail.com",
|
||||||
"e@zzak.io",
|
"e@zzak.io",
|
||||||
"punchagan@muse-amuse.in",
|
"jdennes@gmail.com",
|
||||||
"dan@zoombody.com",
|
|
||||||
"dan@meatballhat.com",
|
|
||||||
"nschonni@gmail.com",
|
"nschonni@gmail.com",
|
||||||
"patrick@bittorrent.com"
|
"dan@meatballhat.com"
|
||||||
]
|
]
|
||||||
|
|
||||||
s.files = [
|
s.files = [
|
||||||
|
@ -101,6 +108,7 @@ Gem::Specification.new do |s|
|
||||||
"lib/travis/api/app/endpoint/singleton_settings_endpoint.rb",
|
"lib/travis/api/app/endpoint/singleton_settings_endpoint.rb",
|
||||||
"lib/travis/api/app/endpoint/uptime.rb",
|
"lib/travis/api/app/endpoint/uptime.rb",
|
||||||
"lib/travis/api/app/endpoint/users.rb",
|
"lib/travis/api/app/endpoint/users.rb",
|
||||||
|
"lib/travis/api/app/error_handling.rb",
|
||||||
"lib/travis/api/app/extensions.rb",
|
"lib/travis/api/app/extensions.rb",
|
||||||
"lib/travis/api/app/extensions/expose_pattern.rb",
|
"lib/travis/api/app/extensions/expose_pattern.rb",
|
||||||
"lib/travis/api/app/extensions/scoping.rb",
|
"lib/travis/api/app/extensions/scoping.rb",
|
||||||
|
@ -170,11 +178,54 @@ Gem::Specification.new do |s|
|
||||||
"lib/travis/api/v3/access_control/scoped.rb",
|
"lib/travis/api/v3/access_control/scoped.rb",
|
||||||
"lib/travis/api/v3/access_control/signature.rb",
|
"lib/travis/api/v3/access_control/signature.rb",
|
||||||
"lib/travis/api/v3/access_control/user.rb",
|
"lib/travis/api/v3/access_control/user.rb",
|
||||||
|
"lib/travis/api/v3/constant_resolver.rb",
|
||||||
"lib/travis/api/v3/error.rb",
|
"lib/travis/api/v3/error.rb",
|
||||||
|
"lib/travis/api/v3/extensions/belongs_to.rb",
|
||||||
|
"lib/travis/api/v3/extensions/encrypted_column.rb",
|
||||||
|
"lib/travis/api/v3/github.rb",
|
||||||
|
"lib/travis/api/v3/model.rb",
|
||||||
|
"lib/travis/api/v3/models.rb",
|
||||||
|
"lib/travis/api/v3/models/branch.rb",
|
||||||
|
"lib/travis/api/v3/models/broadcast.rb",
|
||||||
|
"lib/travis/api/v3/models/build.rb",
|
||||||
|
"lib/travis/api/v3/models/commit.rb",
|
||||||
|
"lib/travis/api/v3/models/email.rb",
|
||||||
|
"lib/travis/api/v3/models/job.rb",
|
||||||
|
"lib/travis/api/v3/models/log.rb",
|
||||||
|
"lib/travis/api/v3/models/log_part.rb",
|
||||||
|
"lib/travis/api/v3/models/membership.rb",
|
||||||
|
"lib/travis/api/v3/models/organization.rb",
|
||||||
|
"lib/travis/api/v3/models/permission.rb",
|
||||||
|
"lib/travis/api/v3/models/repository.rb",
|
||||||
|
"lib/travis/api/v3/models/request.rb",
|
||||||
|
"lib/travis/api/v3/models/ssl_key.rb",
|
||||||
|
"lib/travis/api/v3/models/token.rb",
|
||||||
|
"lib/travis/api/v3/models/user.rb",
|
||||||
"lib/travis/api/v3/opt_in.rb",
|
"lib/travis/api/v3/opt_in.rb",
|
||||||
|
"lib/travis/api/v3/queries.rb",
|
||||||
|
"lib/travis/api/v3/queries/branch.rb",
|
||||||
|
"lib/travis/api/v3/queries/build.rb",
|
||||||
|
"lib/travis/api/v3/queries/organization.rb",
|
||||||
|
"lib/travis/api/v3/queries/organizations.rb",
|
||||||
|
"lib/travis/api/v3/queries/repositories.rb",
|
||||||
|
"lib/travis/api/v3/queries/repository.rb",
|
||||||
|
"lib/travis/api/v3/queries/request.rb",
|
||||||
|
"lib/travis/api/v3/queries/requests.rb",
|
||||||
|
"lib/travis/api/v3/queries/user.rb",
|
||||||
|
"lib/travis/api/v3/query.rb",
|
||||||
"lib/travis/api/v3/renderer.rb",
|
"lib/travis/api/v3/renderer.rb",
|
||||||
|
"lib/travis/api/v3/renderer/accepted.rb",
|
||||||
|
"lib/travis/api/v3/renderer/branch.rb",
|
||||||
|
"lib/travis/api/v3/renderer/build.rb",
|
||||||
|
"lib/travis/api/v3/renderer/collection_renderer.rb",
|
||||||
"lib/travis/api/v3/renderer/error.rb",
|
"lib/travis/api/v3/renderer/error.rb",
|
||||||
|
"lib/travis/api/v3/renderer/model_renderer.rb",
|
||||||
|
"lib/travis/api/v3/renderer/organization.rb",
|
||||||
|
"lib/travis/api/v3/renderer/organizations.rb",
|
||||||
|
"lib/travis/api/v3/renderer/repositories.rb",
|
||||||
"lib/travis/api/v3/renderer/repository.rb",
|
"lib/travis/api/v3/renderer/repository.rb",
|
||||||
|
"lib/travis/api/v3/renderer/requests.rb",
|
||||||
|
"lib/travis/api/v3/renderer/user.rb",
|
||||||
"lib/travis/api/v3/result.rb",
|
"lib/travis/api/v3/result.rb",
|
||||||
"lib/travis/api/v3/router.rb",
|
"lib/travis/api/v3/router.rb",
|
||||||
"lib/travis/api/v3/routes.rb",
|
"lib/travis/api/v3/routes.rb",
|
||||||
|
@ -183,8 +234,22 @@ Gem::Specification.new do |s|
|
||||||
"lib/travis/api/v3/service.rb",
|
"lib/travis/api/v3/service.rb",
|
||||||
"lib/travis/api/v3/service_index.rb",
|
"lib/travis/api/v3/service_index.rb",
|
||||||
"lib/travis/api/v3/services.rb",
|
"lib/travis/api/v3/services.rb",
|
||||||
"lib/travis/api/v3/services/find_repository.rb",
|
"lib/travis/api/v3/services/branch/find.rb",
|
||||||
|
"lib/travis/api/v3/services/build/find.rb",
|
||||||
|
"lib/travis/api/v3/services/organization/find.rb",
|
||||||
|
"lib/travis/api/v3/services/organizations/for_current_user.rb",
|
||||||
|
"lib/travis/api/v3/services/repositories/for_current_user.rb",
|
||||||
|
"lib/travis/api/v3/services/repository/disable.rb",
|
||||||
|
"lib/travis/api/v3/services/repository/enable.rb",
|
||||||
|
"lib/travis/api/v3/services/repository/find.rb",
|
||||||
|
"lib/travis/api/v3/services/requests/create.rb",
|
||||||
|
"lib/travis/api/v3/services/requests/find.rb",
|
||||||
|
"lib/travis/api/workers/build_cancellation.rb",
|
||||||
|
"lib/travis/api/workers/build_restart.rb",
|
||||||
|
"lib/travis/api/workers/job_cancellation.rb",
|
||||||
|
"lib/travis/api/workers/job_restart.rb",
|
||||||
"lib/travis/private_key.rb",
|
"lib/travis/private_key.rb",
|
||||||
|
"lib/travis/sidekiq.rb",
|
||||||
"public/favicon.ico",
|
"public/favicon.ico",
|
||||||
"public/images/result/canceled.png",
|
"public/images/result/canceled.png",
|
||||||
"public/images/result/canceled.svg",
|
"public/images/result/canceled.svg",
|
||||||
|
@ -201,6 +266,7 @@ Gem::Specification.new do |s|
|
||||||
"script/console",
|
"script/console",
|
||||||
"script/repos_stats.rb",
|
"script/repos_stats.rb",
|
||||||
"script/server",
|
"script/server",
|
||||||
|
"spec/integration/error_handling_spec.rb",
|
||||||
"spec/integration/formats_handling_spec.rb",
|
"spec/integration/formats_handling_spec.rb",
|
||||||
"spec/integration/responders_spec.rb",
|
"spec/integration/responders_spec.rb",
|
||||||
"spec/integration/routes.backup.rb",
|
"spec/integration/routes.backup.rb",
|
||||||
|
@ -278,9 +344,15 @@ Gem::Specification.new do |s|
|
||||||
"spec/unit/middleware/user_agent_tracker_spec.rb",
|
"spec/unit/middleware/user_agent_tracker_spec.rb",
|
||||||
"spec/unit/responders/json_spec.rb",
|
"spec/unit/responders/json_spec.rb",
|
||||||
"spec/unit/responders/service_spec.rb",
|
"spec/unit/responders/service_spec.rb",
|
||||||
|
"spec/v3/extensions/belongs_to_spec.rb",
|
||||||
"spec/v3/result_spec.rb",
|
"spec/v3/result_spec.rb",
|
||||||
"spec/v3/service_index_spec.rb",
|
"spec/v3/service_index_spec.rb",
|
||||||
"spec/v3/services/find_repository_spec.rb",
|
"spec/v3/services/branch/find_spec.rb",
|
||||||
|
"spec/v3/services/organization/find_spec.rb",
|
||||||
|
"spec/v3/services/organizations/for_current_user_spec.rb",
|
||||||
|
"spec/v3/services/repositories/for_current_user_spec.rb",
|
||||||
|
"spec/v3/services/repository/find_spec.rb",
|
||||||
|
"spec/v3/services/requests/create_spec.rb",
|
||||||
"tmp/.gitkeep",
|
"tmp/.gitkeep",
|
||||||
"travis-api.gemspec"
|
"travis-api.gemspec"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user