DataDog / datadog-for-vscode

Datadog for VS Code
https://marketplace.visualstudio.com/items?itemName=Datadog.datadog-vscode
Other
10 stars 1 forks source link

Issue on mac #15

Closed bck01215 closed 5 months ago

bck01215 commented 5 months ago

Getting this error when attempting to use code analysis in the datadog extension

2024-06-17 14:28:11.705 [error] shell-desktop.staticAnalysis: error trying to set permissions for mac binary Command failed: "xattr" -dr com.apple.quarantine /Users/username/Library/Application\ Support/Code/User/globalStorage/datadog.datadog-vscode/file-downloader-downloads/staticAnalyzer-0.3.4/datadog-static-analyzer-server

m-paternostro commented 5 months ago

Thank you for reporting the issue. We run this comment whenever we update the Static Analysis engine to ensure the Mac OS does not mark it as a quarantined file, which prevents it from being executed.

Do you mind sharing if you are using an admin account? I assume you are not but would like to be sure.

bck01215 commented 5 months ago

Correct, I am. The issue appears to be that -r is not a recognized flag for my xattr

m-paternostro commented 5 months ago

The issue appears to be that -r is not a recognized flag for my xattr

That is interesting because it seems that -r has been supported for quite a while - I found this reference from a 2012 book.

Regardless, what happens when you run the command without the r?

"xattr" -d com.apple.quarantine /Users/username/Library/Application\ Support/Code/User/globalStorage/datadog.datadog-vscode/file-downloader-downloads/staticAnalyzer-0.3.4/datadog-static-analyzer-server

If the command above works, do you see the Static Analysis version on the Datadog Menu? You can open it by clicking on the Datadog Status item as indicated below:

image

bck01215 commented 5 months ago

No such xattr: com.apple.quarantine

I can run the binary so it appears to be trusted, but I do not see the static analysis engine running

I do see the version pop up

image
m-paternostro commented 5 months ago

Awesome!

Again thank you for reporting the issue and helping out debugging it. I will try to reproduce it here and also discuss if we should simply remove the -r option given that we are changing the attributes of a single file.

We will update this issue as we progress.

robertohuertasm commented 5 months ago

Hi @bck01215, can you tell us whether you were actually having an issue with the static analysis feature or you just realized you had this error in the Datadog Output? I mean, did you really need to run the xattr command at all? We were unsure about that and it would be really useful for us to try to mitigate this issue in the future. Thanks!

bck01215 commented 5 months ago

@robertohuertasm I expected the static analysis tool to immediately start automatically. It did not do this until after I follow the steps and manually analyzed workspaces through the menu. Now it appears to be automatically analyzing other workspaces. I'm not sure if that's a big or just something unclear in the documentation.

robertohuertasm commented 5 months ago

The expected behaviour would be the following:

So basically, there are 2 kinds of analysis.

  1. One that should happen automatically whenever the user opens a file that uses a language which is supported by the extension (see here the currently supported languages).
  2. Another one that happens on user demand which will inspect a folder or a workspace.

Now, for what I understood from your message, you seem to imply that the workspace analysis is happening automatically for you. Is that correct?

It would be awesome if we could get more feedback on that as if that's happening to you, it's definitely a bug.

On the other hand, regarding the issue about xattr, we have provided a fix that will be out in the next release.

Thanks again @bck01215 for your help and feedback ❤️!

bck01215 commented 5 months ago

Correct, so now it is operating as you described but it didn't work that way until I ran the workspace analysis initially. Now working in other workspaces it appears to be working that way.

I attempted to remove and re-install the extension to reproduce the issue. Upon opening a Dockerfile it prompted as expected. It's possible that originally when navigating with the extension I simply did not open compatible languages and stumbled upon the error message before seeing it work

robertohuertasm commented 5 months ago

@bck01215 that may make sense. We will keep an eye on the behaviour you described and see if we can reproduce it. Let us know if it happen again to you.

Next version will incorporate the feedback you provided and fix the issue with the xattr command.