pulumi/pkg/backend
Chris Smith a4f087460f
Fix false-positives in login verification (#825)
Surprisingly `pulumi login -c https://google.com` would succeed. This was because we were too lax in our way of validating credentials. We take the provided cloud URL and call the "GetCurrentUserHandler" method. But we were only checking that it returned a successful response, not that it was actually valid JSON.

So in the "https://google.com" case, Google returned HTML describing a 404 error, but since the sever response was 200, the Pulumi CLI assumed things were on the up and up.

We now parse the response as JSON, and confirm the response has a `name` property that is non-nil. This heuristic covers the majority of false-positive cases, but without us needing to move all of the service's API shape for users, which includes organizations, which includes Clouds, etc. into `pulumi`.

Fixes https://github.com/pulumi/pulumi-service/issues/457. As an added bonus, we now return a much more useful error message.
2018-01-20 19:11:38 -08:00
..
cloud Fix false-positives in login verification (#825) 2018-01-20 19:11:38 -08:00
local Use per stack key for local stacks instead of per project 2018-01-19 00:50:59 -08:00
state Support secrets for cloud stacks. 2017-12-22 07:59:27 -08:00
backend.go Surface update options to the service (#806) 2018-01-18 11:10:15 -08:00
stack.go Surface update options to the service (#806) 2018-01-18 11:10:15 -08:00