Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '1490a90bc1c4cbbf13470af3408584e57d135fb2',
'dart_revision': '15b11b018364ce032eae50d78fc8a52b541e2bce',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 1ab2f2e559e655ad5cfe1e759d241b54
Signature: 866085660a05bb407caffc09636cbd32

UNUSED LICENSES:

Expand Down
4 changes: 4 additions & 0 deletions common/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ struct Settings {
uint32_t observatory_port = 0;
bool ipv6 = false;

// Determines whether an authentication code is required to communicate with
// the VM service.
bool disable_service_auth_codes = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this not be a negative please? enable_service_auth_codes = false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is meant to be temporary and will be enabled by default later. I'd really rather avoid having to change everything only to have to change it back in the next day or so.


// Font settings
bool use_test_fonts = false;

Expand Down
3 changes: 2 additions & 1 deletion runtime/dart_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
settings.observatory_port, // server observatory port
tonic::DartState::HandleLibraryTag, // embedder library tag handler
false, // disable websocket origin check
error // error (out)
settings.disable_service_auth_codes, // disable VM service auth codes
error // error (out)
)) {
// Error is populated by call to startup.
FML_DLOG(ERROR) << *error;
Expand Down
5 changes: 5 additions & 0 deletions runtime/dart_service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ bool DartServiceIsolate::Startup(std::string server_ip,
intptr_t server_port,
Dart_LibraryTagHandler embedder_tag_handler,
bool disable_origin_check,
bool disable_service_auth_codes,
char** error) {
Dart_Isolate isolate = Dart_CurrentIsolate();
FML_CHECK(isolate);
Expand Down Expand Up @@ -196,6 +197,10 @@ bool DartServiceIsolate::Startup(std::string server_ip,
Dart_SetField(library, Dart_NewStringFromCString("_originCheckDisabled"),
Dart_NewBoolean(disable_origin_check));
SHUTDOWN_ON_ERROR(result);
result =
Dart_SetField(library, Dart_NewStringFromCString("_authCodesDisabled"),
Dart_NewBoolean(disable_service_auth_codes));
SHUTDOWN_ON_ERROR(result);
return true;
}

Expand Down
1 change: 1 addition & 0 deletions runtime/dart_service_isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class DartServiceIsolate {
intptr_t server_port,
Dart_LibraryTagHandler embedder_tag_handler,
bool disable_origin_check,
bool disable_service_auth_codes,
char** error);

static std::string GetObservatoryUri();
Expand Down
9 changes: 9 additions & 0 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ static const char* kDartStartPausedArgs[]{
"--pause_isolates_on_start",
};

static const char* kDartDisableServiceAuthCodesArgs[]{
"--disable-service-auth-codes",
};

static const char* kDartTraceStartupArgs[]{
"--timeline_streams=Compiler,Dart,Debugger,Embedder,GC,Isolate,VM",
};
Expand Down Expand Up @@ -325,6 +329,11 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs));
}

if (settings_.disable_service_auth_codes) {
PushBackAll(&args, kDartDisableServiceAuthCodesArgs,
arraysize(kDartDisableServiceAuthCodesArgs));
}

if (settings_.endless_trace_buffer || settings_.trace_startup) {
// If we are tracing startup, make sure the trace buffer is endless so we
// don't lose early traces.
Expand Down
7 changes: 7 additions & 0 deletions shell/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
}
}

// Enable need for authentication codes for VM service communication, if
// specified.
// TODO(bkonyi): when authentication codes are enabled by default, change
// to 'DisableServiceAuthCodes' and un-negate.
settings.disable_service_auth_codes =
!command_line.HasOption(FlagForSwitch(Switch::EnableServiceAuthCodes));

// Checked mode overrides.
settings.disable_dart_asserts =
command_line.HasOption(FlagForSwitch(Switch::DisableDartAsserts));
Expand Down
6 changes: 6 additions & 0 deletions shell/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ DEF_SWITCH(FlutterAssetsDir,
"Path to the Flutter assets directory.")
DEF_SWITCH(Help, "help", "Display this help text.")
DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.")
// TODO(bkonyi): when authentication codes are enabled by default, change
// to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'.
DEF_SWITCH(EnableServiceAuthCodes,
"enable-service-auth-codes",
"Enable the requirement for authentication codes for communicating"
" with the VM service.")
DEF_SWITCH(StartPaused,
"start-paused",
"Start the application paused in the Dart debugger.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ private static String[] getArgsFromIntent(Intent intent) {
if (intent.getBooleanExtra("start-paused", false)) {
args.add("--start-paused");
}
if (intent.getBooleanExtra("enable-service-auth-codes", false)) {
args.add("--enable-service-auth-codes");
}
if (intent.getBooleanExtra("use-test-fonts", false)) {
args.add("--use-test-fonts");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class FlutterShellArgs {
public static final String ARG_TRACE_STARTUP = "--trace-startup";
public static final String ARG_KEY_START_PAUSED = "start-paused";
public static final String ARG_START_PAUSED = "--start-paused";
public static final String ARG_KEY_ENABLE_SERVICE_AUTH_CODES = "enable-service-auth-codes";
public static final String ARG_ENABLE_SERVICE_AUTH_CODES = "--enable-service-auth-codes";
public static final String ARG_KEY_USE_TEST_FONTS = "use-test-fonts";
public static final String ARG_USE_TEST_FONTS = "--use-test-fonts";
public static final String ARG_KEY_ENABLE_DART_PROFILING = "enable-dart-profiling";
Expand Down Expand Up @@ -56,6 +58,11 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) {
if (intent.getBooleanExtra(ARG_KEY_START_PAUSED, false)) {
args.add(ARG_START_PAUSED);
}
// TODO(bkonyi): when authentication codes are enabled by default, change
// to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'.
if (intent.getBooleanExtra(ARG_KEY_ENABLE_SERVICE_AUTH_CODES, false)) {
args.add(ARG_ENABLE_SERVICE_AUTH_CODES);
}
if (intent.getBooleanExtra(ARG_KEY_USE_TEST_FONTS, false)) {
args.add(ARG_USE_TEST_FONTS);
}
Expand Down Expand Up @@ -133,4 +140,4 @@ public String[] toArray() {
String[] argsArray = new String[args.size()];
return args.toArray(argsArray);
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why this line changed, but I'm guessing it's something to do with Vim. I tried to fix it but wasn't having much luck. If it's a problem, I'll go and fight with it some more.

Copy link
Member

Choose a reason for hiding this comment

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

Your editor (or maybe git) is adding a newline at the end of the file.