Index: google_apis/google_api_keys.cc |
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc |
index ab92d1e4dccf7420e8c0b72b49b8f8343c995016..015b254b5494615b540d798ee3be0791c09c0db4 100644 |
--- a/google_apis/google_api_keys.cc |
+++ b/google_apis/google_api_keys.cc |
@@ -246,7 +246,8 @@ class APIKeyCache { |
// Gets a value for a key. In priority order, this will be the value |
// provided via a command-line switch, the value provided via an |
// environment variable, or finally a value baked into the build. |
- // |command_line_switch| may be NULL. |
+ // |command_line_switch| may be NULL. Official Google Chrome builds will not |
+ // use the value provided by an environment variable. |
static std::string CalculateKeyValue(const char* baked_in_value, |
const char* environment_variable_name, |
const char* command_line_switch, |
@@ -265,11 +266,17 @@ class APIKeyCache { |
<< " with value " << key_value << " from Info.plist."; |
} |
#endif |
+ |
+#if !defined(GOOGLE_CHROME_BUILD) |
+ // Don't allow using the environment to override API keys for official |
+ // Google Chrome builds. There have been reports of mangled environments |
+ // affecting users (crbug.com/710575). |
if (environment->GetVar(environment_variable_name, &temp)) { |
key_value = temp; |
VLOG(1) << "Overriding API key " << environment_variable_name |
<< " with value " << key_value << " from environment variable."; |
} |
+#endif |
if (command_line_switch && command_line->HasSwitch(command_line_switch)) { |
key_value = command_line->GetSwitchValueASCII(command_line_switch); |