046fc17e53
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>