diff options
-rw-r--r-- | lib/ci/api/builds.rb | 2 | ||||
-rw-r--r-- | lib/ci/api/helpers.rb | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index 3c4cfccb19a..142bce82286 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -41,7 +41,7 @@ module Ci put ":id" do authenticate_runner! build = Ci::Build.where(runner_id: current_runner.id).running.find(params[:id]) - authenticate_build!(build, verify_token: false) + validate_build!(build) update_runner_info diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 0202b3cf8a3..51b05aa0cb6 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -13,9 +13,14 @@ module Ci forbidden! unless current_runner end - def authenticate_build!(build, verify_token: true) + def authenticate_build!(build) + not_found! unless build + forbidden! if !build_token_valid?(build) + validate_build!(build) + end + + def validate_build!(build) not_found! unless build - forbidden! if verify_token && !build_token_valid?(build) forbidden!('Project has been deleted!') unless build.project forbidden!('Build has been erased!') if build.erased? end |