-
Notifications
You must be signed in to change notification settings - Fork 350
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
Source root for conversion from absolute to relative with invocation.workingDirectory.uri
does not work
#2460
Comments
@shaikhul I believe this is one for your team? |
I can confirm this is a bug. The sarif example given in the OP does not reproduce it because it contains no alerts (the
I'll look more into it. |
On further investigation, it turned out that there was another problem with the input that I had missed. It does not look like there is a bug on our side. The invocation object in the above sarif file is contained in This sarif file works as expected:
So, while there is no bug on our side I think this identifies a flaw in our documentation here which just says to use the "invocation.workingDirectory.uri property in the SARIF file" without saying where the invocation object needs to be located. I'll create an issue with the docs team to get this improved. |
Hey @cannist! Please note that I provided two variations of the sarif report: one with After running exactly the file that you've attached, the preview still does not appear: |
Hmm, weird. I admit I had not tested end-to-end and only observed that the filepath was getting correctly relativized in the db in local dev. Are you sure you're not still looking at the page for the old alert? The alert from the new sarif upload would now be considered a new one, since it has a different location. What repo are you testing in? |
Yes, 100% positive. Changing uri of the |
Ok... I have a test that reproduces it and I know why it is happening and why I could initially not reproduce it in local dev. There are two ways to specify the source root: in the sarif file or via API parameter. Our server code currently prefers the API one over the sarif one. The upload-sarif action seems to always set the parameter to the checkout directory on the worker if it is not explicitly set as input to the action. We'll have to fix this but there are multiple solutions and all of them have the potential to affect existing setups. I'll have to do some data gathering before I make any changes, possibly implement some metrics on Monday and have them collect data for at least a week. |
Sounds wonderful, thank you! Please let me know if I can help somehow. |
@vivaat, just to keep you in the loop: We've started collecting metrics for how a change would affect existing setups. It is looking good so far but I still want to wait and collect more data and then make a decision at the beginning of next week. |
Today we've shipped the change and the server now prefers the information from the sarif file over the api parameter. This should resolve the issue. I have confirmed this also in my testing repo. 🙂 |
Summary
Specifying 'workingDirectory' in 'invocation' property does not convert absolute paths in
result
object.Details
After specifying the option, the paths remain absolute and the preview to the file is thus absent.

PoC
In the below example,
invocation
property has no effect.There is another way to specify it. Doesn't work either.
The text was updated successfully, but these errors were encountered: