Previously, FileSystem.readFileAsString, writeFileAsString, and
listDirectoryContents only validated the requested path textually against the
configured IDE workspace roots. A symlink inside the workspace could
therefore resolve to a location outside the workspace and still be accessed.
This patch resolves workspace roots and requested filesystem targets before
performing the authorization check, and resolves the nearest existing ancestor
for write targets so new files inside a workspace continue to work.
It also adds a source-backed regression test in pkg/dtd_impl/test/dtd_test.dart
that verifies read, write, and directory listing requests through a symlink
escaping the workspace all fail with permission denied.
R=bquinlan@google.com
Tested:
- HOME=/tmp XDG_CONFIG_HOME=/tmp DART_SUPPRESS_ANALYTICS=1 /tmp/dart-sdk-3.12.0-221.0.dev/dart-sdk/bin/dart test pkg/dtd_impl/test/dtd_test.dart
Change-Id: I7abf00f6220bff42b352e2942f396167af53adb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493420
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Auto-Submit: 진호 <orangemush777@gmail.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)
Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
The WebSocket client that IntelliJ is using does not handle pings (despite them being part of the spec), so this change resulted in connections being dropped after 15s.
This changes pings to be opt-in, which unfortunately means other clients that don't opt-in won't get the behaviour (and therefore might see issues with Norton and other antivirus programs that proxy and drop idle connections), but this is better than all IJ users being broken.
See https://github.com/flutter/dart-intellij-third-party/issues/205
Change-Id: I7d5f5225cb9d04c15552970a821f5441c45ace18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472580
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This enables the web socket ping by default at an interval of 15s. Having ping enables can prevent proxies/antivirus from dropping the web connections if they have no traffic for some period.
Having Norton 360 installed results in idle DTD connections dropping after 60s even if every feature is disabled, because the connections still go through it and it still drops idle connections.
I implemented this in the server because it applies to all uses of DTD regardless of client and it was easier to do here because pingInterval isn't exposed everywhere (but pkg:shelf does have a pass-through).
See https://github.com/Dart-Code/Dart-Code/issues/5794
Fixes https://github.com/dart-lang/sdk/issues/62148
Change-Id: If9df674b061b397cef1aa321602b563f44b9525d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465680
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This CL contains breaking changes for package:dtd and prepares both package:dart_service_protocol_shared and package:dtd for publish.
This CL also fixes https://github.com/dart-lang/sdk/issues/60757 so that DTD-registered services are sent over the `Service` stream upon initial subscription like what is done for client-registered services.
Change-Id: I619af816e64af01864c7ed9b98743c6691bf7e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429161
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
This question came up in another change, about whether a client would have hanging requests if the other DTD client providing the service disconnected.
This adds a test to ensure that any pending requests are terminated with an error.
It also tidies up some other tests to give better errors if they fail.
Change-Id: I77e04ee59f757498af090878da542d6ed1d152b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374946
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Removes the port from `startService()` (which as far as I can see is unused) and parses it from `args` instead.
I had to add support for "options" in the argument classes and switched from a bool flag `isFlag` to an enum to be a bit more descriptive (and be easier to support multi-options in future if required).
Fixes https://github.com/dart-lang/sdk/issues/56000
Change-Id: Ib08513139f58e8845a7c2cbbeeea06787dbc2df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371840
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
- devtools server can now take the dtd uri as a parameter on startup
- dtdUri is passed to the server handler so that devtools can request it.
- FileService is implemented inside the Dart Tooling Daemon (dtd_impl)
- Added FileService.setProjectRoots
- Added unit tests and rpc exceptions
- on startup dtd now prints { uri, secret } so that the caller has the secret that allows them to call FileService.setProjectRoots
Fixes: https://github.com/dart-lang/sdk/issues/54790
Change-Id: I7a66aca2f8f06f6a611a46c727a9d5c2485fbe3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346922
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
This will contain the code for running the DTD server.
When this is fully funcitonal VSCode will be responsible for running the, and letting our other tools(i.e. DevTools) know which address it is running at.
Change-Id: Ia4cc9553f000a5e765f604541f4846b107d4d00c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338501
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>