@@ -233,7 +233,8 @@ class APIKeyCache {
233
233
// Gets a value for a key. In priority order, this will be the value
234
234
// provided via a command-line switch, the value provided via an
235
235
// environment variable, or finally a value baked into the build.
236
- // |command_line_switch| may be NULL.
236
+ // |command_line_switch| may be NULL. Official Google Chrome builds will not
237
+ // use the value provided by an environment variable.
237
238
static std::string CalculateKeyValue (const char * baked_in_value,
238
239
const char * environment_variable_name,
239
240
const char * command_line_switch,
@@ -252,11 +253,17 @@ class APIKeyCache {
252
253
<< " with value " << key_value << " from Info.plist." ;
253
254
}
254
255
#endif
256
+
257
+ #if !defined(GOOGLE_CHROME_BUILD)
258
+ // Don't allow using the environment to override API keys for official
259
+ // Google Chrome builds. There have been reports of mangled environments
260
+ // affecting users (crbug.com/710575).
255
261
if (environment->GetVar (environment_variable_name, &temp)) {
256
262
key_value = temp;
257
263
VLOG (1 ) << " Overriding API key " << environment_variable_name
258
264
<< " with value " << key_value << " from environment variable." ;
259
265
}
266
+ #endif
260
267
261
268
if (command_line_switch && command_line->HasSwitch (command_line_switch)) {
262
269
key_value = command_line->GetSwitchValueASCII (command_line_switch);
0 commit comments