make allowed_targets an option
This commit is contained in:
parent
a31d15ddf1
commit
6c911407f0
|
@ -62,7 +62,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-support.git
|
remote: git://github.com/travis-ci/travis-support.git
|
||||||
revision: a350d17b705e3240ff4eae7973266ba36549acaa
|
revision: f78d9161369f574f12b9c0c0dbfe13b997766bdd
|
||||||
specs:
|
specs:
|
||||||
travis-support (0.0.1)
|
travis-support (0.0.1)
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,11 @@ class Travis::Api::App
|
||||||
#
|
#
|
||||||
# The entry point is [/auth/post_message](#/auth/post_message).
|
# The entry point is [/auth/post_message](#/auth/post_message).
|
||||||
class Authorization < Endpoint
|
class Authorization < Endpoint
|
||||||
set prefix: '/auth'
|
|
||||||
enable :inline_templates
|
enable :inline_templates
|
||||||
|
set prefix: '/auth', allowed_targets: %r{
|
||||||
|
^ http:// (localhost|127\.0\.0\.1)(:\d+)? $ |
|
||||||
|
^ https:// ([\w\-_]+\.)?travis-ci\.(org|com) $
|
||||||
|
}x
|
||||||
|
|
||||||
# Endpoint for retrieving an authorization code, which in turn can be used
|
# Endpoint for retrieving an authorization code, which in turn can be used
|
||||||
# to generate an access token.
|
# to generate an access token.
|
||||||
|
@ -222,10 +225,7 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
def target_ok?(target_origin)
|
def target_ok?(target_origin)
|
||||||
target_origin =~ %r{
|
target_origin =~ settings.allowed_targets
|
||||||
^ http:// (localhost|127\.0\.0\.1)(:\d+)? $ |
|
|
||||||
^ https:// ([\w\-_]+\.)?travis-ci\.(org|com) $
|
|
||||||
}x
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user