-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Implement buttons in VNet diag report #52346
Conversation
b25f6e0
to
e23d168
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a snapshot test for this as I feel it's one of those cases where snapshot tests are actually useful. Matter of fact, I already benefited from it – I was doing a small refactoring of reportToText
and the snapshot test guarantees that the output stays the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! (i hate it)
| Conflicting destination | VNet destination | Interface | Set up by | | ||
| ----------------------- | ---------------- | --------- | --------- | | ||
| 100.64.0.0/10 | 100.64.0.1 | utun5 | VPN: Foobar | | ||
| 0.0.0.0/1 | 100.64.0.0/10 | utun6 | unknown | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really want to spend time on making the whole table line up perfectly as that's not the point. I sparingly used Markdown in the report so that the output is rendered correctly when pasted into Zendesk and Slack. Slack doesn't support tables, but Zendesk does.

CLI command output looks particularly bad without code blocks, as in that case most Markdown parsers (or I guess all of them?) do not interpret a single newline character as the start of a new line. So the output from netstat
ends up all garbled if code blocks are not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I should probably document that it's supposed to be Zendesk/Slack friendly. Edit: Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that you thought of making it Zendesk/Slack friendly.
@@ -103,6 +103,9 @@ export default function createMainProcessClient(): MainProcessClient { | |||
showFileSaveDialog(filePath: string) { | |||
return ipcRenderer.invoke('main-process-show-file-save-dialog', filePath); | |||
}, | |||
saveTextToFile(args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already showFileSaveDialog
which is used for SSH file transfers. Compared to saveTextToFile
, showFileSaveDialog
merely shows the dialog and returns the path chosen by the user.
If I wanted to use this for saving the report, I'd have to implement an IPC API that would let the renderer save arbitrary text to an arbitrary file on the disk, which seems bad. It seems much simpler to just not let the path chosen by the user escape the main process. This way an attacker cannot abuse this through an XSS to silently write to an arbitrary file. They'd have to show a prompt first.
Mind you, I think the renderer already has this ability but in a much smaller scope, as it can do so file transfers. So technically an XSS in Connect would allow the attacker to write to an arbitrary file on disk, as long as they first store whatever text they want to save in a file on an SSH server. 🫠
e23d168
to
2bc35d6
Compare
This was implemented back when we were thinking of showing recent VNet connections in the panel. We've never had time to implement this, so it's better to just remove this rather keeping this component in the project.
JSDocs for individual methods should be defined on the type, so that the JSDocs are available in any place that uses the type, rather than only where we use the implementation of the type.
2bc35d6
to
a23f460
Compare
a441ab7
to
2a6a20f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These reports are so sick! super rad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! (i hate it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and works great.
Created at (local): ${localCreatedAt} | ||
Created at (UTC): ${utcCreatedAt} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make it less verbose and combine into one line: Created at: 2025-02-21 10:28:58 (Fri, 21 Feb 2025 09:28:58 GMT)
| Conflicting destination | VNet destination | Interface | Set up by | | ||
| ----------------------- | ---------------- | --------- | --------- | | ||
| 100.64.0.0/10 | 100.64.0.1 | utun5 | VPN: Foobar | | ||
| 0.0.0.0/1 | 100.64.0.0/10 | utun6 | unknown | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that you thought of making it Zendesk/Slack friendly.
@ravicious See the table below for backport results.
|
This PR provides the implementation for the three buttons in the top right of a VNet diag report.