-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
“Visual Studio Code” would like to access data from other apps. #208105
Comments
Possible duplicate of #201087 |
Still happening on Version: 1.90.1 despite the other ticket being closed. |
This dialog box needs an explanation as 35 others also agreed within a similar closed issue. It shows a lack of respect for people's right to manage their security. To blindly click allow is not very smart.. |
They locked the issue #201087 with no explanation whatsoever. I wonder why |
This is a duplicate of #201087, but there was no solution given or official response from microsoft about why this is happening and how to set a setting to stop it from asking every single time. This has been non-stop for about 6 months. |
I managed to catch this in a debugger: (llnode) up
frame #1: 0x0000000188599de8 libsystem_kernel.dylib`open + 64
libsystem_kernel.dylib`open:
-> 0x188599de8 <+64>: mov x21, x0
0x188599dec <+68>: tbnz w0, #0x1f, 0x188599e58 ; <+176>
0x188599df0 <+72>: adrp x8, 420761
0x188599df4 <+76>: ldr x8, [x8, #0xd58]
(llnode) p (char*)$x20
(char *) 0x0000000100bb0090 "/Users/tmm1/Library/Containers/com.apple.news.widget/Data/Library/Caches/com.apple.news.public-production-143441"
(llnode) up
frame #2: 0x0000000100c54404 watcher.node`FSEventsCallback(__FSEventStream const*, void*, unsigned long, void*, unsigned int const*, unsigned long long const*) + 812 The issue appears to occur when a The implicated code-path is here: // macOS has a case insensitive file system by default. In order to detect
// file renames that only affect case, we need to get the canonical path
// and compare it with the input path to determine if a file was created or deleted.
bool pathExists(char *path) {
int fd = open(path, O_RDONLY | O_SYMLINK); // If multiple flags were set, then we need to call `stat` to determine if the file really exists.
// This helps disambiguate creates, updates, and deletes.
struct stat file;
if (!pathExists(paths[i]) || stat(paths[i], &file)) {
// File does not exist, so we have to assume it was removed. This is not exact since the And was introduced in https://github.com/parcel-bundler/watcher/pull/69/files#diff-6202fd99b7ea6bfc7a55c32b204393c7545302a980c15058a43b4fc1fade4747R111 |
I found this in my
|
@tmm1 great finding, as a mitigation we could also think about forcing that folder
|
@tmm1 thanks for investigating this issue, this is great find! I believe this privacy prompt should only show when VSCode attempts to access data from an app sandbox container (refs https://developer.apple.com/videos/play/wwdc2023/10053) which would be in @bpasero from the logs posted in #208105 (comment), seems like the typescript extension is setting up a recursive watch inside |
I have opened microsoft/TypeScript#59831 on TypeScript side and will push a change to hardcode If anyone knows more paths like these that result in access dialogs that are not persisted per application (and thus very annoying), please let me know! |
Thanks @bpasero! Though, I do wonder if your commit will help mitigate this.. the issue is that a watcher is installed onto |
|
I'm pretty sure a watcher for What I observed was:
The macOS FSEvents api is recursive by default, so adding a recursive watcher on ~/Library does not result in another watcher or open on ~/Library/Container The issue happens later, when the recursive watch notices files changing inside ~/Library. I see open calls to all sorts of random files such as:
any file being modified under Library is opened by parcel-build/watcher EDIT: trace logs from Output > File Watcher
|
@tmm1 this is what I tried, // watcher.js
const watcher = require('@parcel/watcher');
const path = require('path');
const { homedir } = require('os');
async function watch() {
// Subscribe to events
let subscription = await watcher.subscribe('/Users/demohan/Library', async (err, events) => {
for (let event of events) {
if (event.path.indexOf('Containers') !== -1) {
console.log(event);
}
}
}, {
ignore: [
path.join(homedir(), 'Library', 'Containers')
]
});
}
watch();
Remove the |
I realized the intention of the code is to install a non-recursive watch on ~/Library, but its ending up recursive. See microsoft/TypeScript#59831 (comment) I believe this is a bug introduced in https://github.com/microsoft/vscode/pull/139881/files#diff-a6ce3fa0fba995f3aeda03efa26f5e51cbab5e424cdf99869120da5539ee0a88R103-R106 where any watcher with a --- a/src/vs/workbench/api/common/extHostFileSystemEventService.ts
+++ b/src/vs/workbench/api/common/extHostFileSystemEventService.ts
@@ -129,7 +129,7 @@ class FileSystemWatcher implements vscode.FileSystemWatcher {
const proxy = mainContext.getProxy(MainContext.MainThreadFileSystemEventService);
let recursive = false;
- if (globPattern.pattern.includes(GLOBSTAR) || globPattern.pattern.includes(GLOB_SPLIT)) {
+ if (globPattern.pattern.includes(GLOBSTAR)) {
recursive = true; // only watch recursively if pattern indicates the need for it
}
|
Your test case is sound. Thank you for sharing it. I misunderstood how parcel's ignore option works, and now see how The ignored paths are fed directly into the underlying macOS watcher, so the fix in 6e8e175 is indeed correct. Note my previous comment, however. I think the ignore paths would be unnecessary if the watcher on ~/Library was being installed as non-recursive, which appears to be the original intention. |
Makes sense, the api contract does define values with path separators are treated as recursive vscode/src/vscode-dts/vscode.d.ts Lines 13509 to 13512 in 673112c
vscode/extensions/typescript-language-features/src/tsServer/fileWatchingManager.ts Line 69 in 673112c
Thanks again for investigating and narrowing down the root cause! I will let @bpasero follow-up. |
I misunderstood how So that's not the cause, but there is some other reason the ~/Library watch is being installed as recursive. The pattern used for it is: this.logger.trace(`Creating parent dir watcher for ${dirUri.toString()}`);
const glob = new vscode.RelativePattern(Utils.dirname(dirUri), Utils.basename(dirUri)); |
Sorry for all the wild goose chasing here, but I confirmed this is a tsserver bug: microsoft/TypeScript#59831 (comment) You can close this issue. |
@tmm1 I noticed your PR in parcel-bundler/watcher#186. If you look at this code a few lines above your code: My change would cause any file path to be ignored that is in Are you saying your fix is not helpful for parcel watcher? |
You're absolutely right. I was mistaken. Thanks again for the quick fix! |
@tmm1 recursive watchers are only set when the glob pattern portion contains a Thanks again for all your analysis, closing then. |
Type: Bug
this popup keep show up althought I click allow multiple time
VS Code version: Code 1.87.2 (863d258, 2024-03-08T15:21:31.043Z)
OS version: Darwin x64 23.4.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Extensions (60)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: