Skip to content

Added Metadata-Flavor header in request for IsRunningOnComputeEngine#1410

Merged
chrisdunelm merged 1 commit intogoogleapis:masterfrom
cilliemalan:master
Jun 11, 2019
Merged

Added Metadata-Flavor header in request for IsRunningOnComputeEngine#1410
chrisdunelm merged 1 commit intogoogleapis:masterfrom
cilliemalan:master

Conversation

@cilliemalan
Copy link
Copy Markdown
Contributor

Fixes #1409

The method IsRunningOnComputeEngineNoCache checks that the metadata server returns the header Metadata-Flavor: Google. However, that endpoint will return an error if that same header is not also supplied in the request.

This means that one cannot use the default compute service account or Workload Identity

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 10, 2019
try
{
var httpRequest = new HttpRequestMessage(HttpMethod.Get, MetadataServerUrl);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, MetadataServerUrl);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell in GitHub what's changed on this line of code. Was there some whitespace that I'm failing to see?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out I use windows line endings 😄

Copy link
Copy Markdown
Collaborator

@jskeet jskeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but will wait for @chrisdunelm to weigh in too.

@chrisdunelm chrisdunelm merged commit 06a2ee0 into googleapis:master Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComputeCredential.IsRunningOnComputeEngine doesn't work

4 participants