Commit 18a1bcf8 authored by Steve Azzopardi's avatar Steve Azzopardi

Fix authorization for web terminals

Workhorse was not able to parse the `headers` property since it was expecting a
key => array as a structure.

Error from workhorse: preAuthorizeHandler: decode authorization response: json:
cannot unmarshal string into Go struct field TerminalSettings.Header of type
[]string

Workhorse was not changed since this api is already used for the environment
terminals.

gitlab-org/gitlab-ce#25990
parent c90d7633
...@@ -17,7 +17,7 @@ module Ci ...@@ -17,7 +17,7 @@ module Ci
{ {
subprotocols: ['terminal.gitlab.com'].freeze, subprotocols: ['terminal.gitlab.com'].freeze,
url: "#{url}/exec".sub("https://", "wss://"), url: "#{url}/exec".sub("https://", "wss://"),
headers: { Authorization: authorization.presence }.compact, headers: { Authorization: [authorization.presence] }.compact,
ca_pem: certificate.presence ca_pem: certificate.presence
} }
end end
......
---
title: Fix authorization for interactive web terminals
merge_request: 20811
author:
type: fixed
...@@ -29,7 +29,7 @@ describe Ci::BuildRunnerSession, model: true do ...@@ -29,7 +29,7 @@ describe Ci::BuildRunnerSession, model: true do
it 'adds Authorization header if authorization is present' do it 'adds Authorization header if authorization is present' do
subject.authorization = 'whatever' subject.authorization = 'whatever'
expect(terminal_specification[:headers]).to include(Authorization: 'whatever') expect(terminal_specification[:headers]).to include(Authorization: ['whatever'])
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment