Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f0417dc

Browse files
committed
Revert most of the changes
1 parent 5d1eff8 commit f0417dc

File tree

10 files changed

+37
-0
lines changed

10 files changed

+37
-0
lines changed

common/settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ struct Settings {
189189
// target indicating the URL at which the VM service can be accessed.
190190
uint32_t vm_service_port = 0;
191191

192+
// Determines whether an authentication code is required to communicate with
193+
// the VM service.
194+
bool disable_service_auth_codes = true;
195+
192196
// Determine whether the vmservice should fallback to automatic port selection
193197
// after failing to bind to a specified port.
194198
bool enable_service_port_fallback = false;

runtime/dart_isolate.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
805805
settings.vm_service_port, // server VM service port
806806
tonic::DartState::HandleLibraryTag, // embedder library tag handler
807807
false, // disable websocket origin check
808+
settings.disable_service_auth_codes, // disable VM service auth codes
808809
settings.enable_service_port_fallback, // enable fallback to port 0
809810
// when bind fails.
810811
error // error (out)

runtime/dart_service_isolate.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ bool DartServiceIsolate::Startup(const std::string& server_ip,
130130
intptr_t server_port,
131131
Dart_LibraryTagHandler embedder_tag_handler,
132132
bool disable_origin_check,
133+
bool disable_service_auth_codes,
133134
bool enable_service_port_fallback,
134135
char** error) {
135136
Dart_Isolate isolate = Dart_CurrentIsolate();
@@ -181,6 +182,10 @@ bool DartServiceIsolate::Startup(const std::string& server_ip,
181182
Dart_SetField(library, Dart_NewStringFromCString("_originCheckDisabled"),
182183
Dart_NewBoolean(disable_origin_check));
183184
SHUTDOWN_ON_ERROR(result);
185+
result =
186+
Dart_SetField(library, Dart_NewStringFromCString("_authCodesDisabled"),
187+
Dart_NewBoolean(disable_service_auth_codes));
188+
SHUTDOWN_ON_ERROR(result);
184189
result = Dart_SetField(
185190
library, Dart_NewStringFromCString("_enableServicePortFallback"),
186191
Dart_NewBoolean(enable_service_port_fallback));

runtime/dart_service_isolate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class DartServiceIsolate {
4747
/// @param[in] embedder_tag_handler The library tag handler.
4848
/// @param[in] disable_origin_check If websocket origin checks must
4949
/// be enabled.
50+
/// @param[in] disable_service_auth_codes If service auth codes must be
51+
/// enabled.
5052
/// @param[in] enable_service_port_fallback If fallback to port 0 must be
5153
/// enabled when the bind fails.
5254
/// @param error The error when this method
@@ -61,6 +63,7 @@ class DartServiceIsolate {
6163
intptr_t server_port,
6264
Dart_LibraryTagHandler embedder_tag_handler,
6365
bool disable_origin_check,
66+
bool disable_service_auth_codes,
6467
bool enable_service_port_fallback,
6568
char** error);
6669

shell/common/switches.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
293293
command_line.GetOptionValue(FlagForSwitch(Switch::DomainNetworkPolicy),
294294
&settings.domain_network_policy);
295295

296+
// Disable need for authentication codes for VM service communication, if
297+
// specified.
298+
settings.disable_service_auth_codes =
299+
command_line.HasOption(FlagForSwitch(Switch::DisableServiceAuthCodes));
300+
296301
// Allow fallback to automatic port selection if binding to a specified port
297302
// fails.
298303
settings.enable_service_port_fallback =

shell/common/switches.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ DEF_SWITCH(FlutterAssetsDir,
146146
"Path to the Flutter assets directory.")
147147
DEF_SWITCH(Help, "help", "Display this help text.")
148148
DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.")
149+
DEF_SWITCH(DisableServiceAuthCodes,
150+
"disable-service-auth-codes",
151+
"Disable the requirement for authentication codes for communicating"
152+
" with the VM service.")
149153
DEF_SWITCH(EnableServicePortFallback,
150154
"enable-service-port-fallback",
151155
"Allow the VM service to fallback to automatic port selection if"

shell/platform/android/io/flutter/app/FlutterActivityDelegate.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ private static String[] getArgsFromIntent(Intent intent) {
293293
if (intent.getBooleanExtra("start-paused", false)) {
294294
args.add("--start-paused");
295295
}
296+
if (intent.getBooleanExtra("disable-service-auth-codes", false)) {
297+
args.add("--disable-service-auth-codes");
298+
}
296299
if (intent.getBooleanExtra("use-test-fonts", false)) {
297300
args.add("--use-test-fonts");
298301
}

shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class FlutterShellArgs {
2424
public static final String ARG_TRACE_STARTUP = "--trace-startup";
2525
public static final String ARG_KEY_START_PAUSED = "start-paused";
2626
public static final String ARG_START_PAUSED = "--start-paused";
27+
public static final String ARG_KEY_DISABLE_SERVICE_AUTH_CODES = "disable-service-auth-codes";
28+
public static final String ARG_DISABLE_SERVICE_AUTH_CODES = "--disable-service-auth-codes";
2729
public static final String ARG_KEY_ENDLESS_TRACE_BUFFER = "endless-trace-buffer";
2830
public static final String ARG_ENDLESS_TRACE_BUFFER = "--endless-trace-buffer";
2931
public static final String ARG_KEY_USE_TEST_FONTS = "use-test-fonts";
@@ -90,6 +92,9 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) {
9092
args.add(ARG_VM_SERVICE_PORT + Integer.toString(vmServicePort));
9193
}
9294
}
95+
if (intent.getBooleanExtra(ARG_KEY_DISABLE_SERVICE_AUTH_CODES, false)) {
96+
args.add(ARG_DISABLE_SERVICE_AUTH_CODES);
97+
}
9398
if (intent.getBooleanExtra(ARG_KEY_ENDLESS_TRACE_BUFFER, false)) {
9499
args.add(ARG_ENDLESS_TRACE_BUFFER);
95100
}

shell/platform/fuchsia/dart_runner/service_isolate.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ Dart_Isolate CreateServiceIsolate(
186186
Dart_NewBoolean(false));
187187
SHUTDOWN_ON_ERROR(result);
188188

189+
// _authCodesDisabled = false
190+
result =
191+
Dart_SetField(library, Dart_NewStringFromCString("_authCodesDisabled"),
192+
Dart_NewBoolean(false));
193+
SHUTDOWN_ON_ERROR(result);
194+
189195
InitBuiltinLibrariesForIsolate(std::string(uri), nullptr, fileno(stdout),
190196
fileno(stderr), zx::channel(), true);
191197

shell/testing/observatory/launcher.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ShellLauncher {
4848
'--vm-service-port=0',
4949
'--non-interactive',
5050
'--run-forever',
51+
'--disable-service-auth-codes',
5152
];
5253
final String shellExecutablePath;
5354
final String mainDartPath;

0 commit comments

Comments
 (0)