Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd867bd

Browse files
authored
fix: fix jetbrains toolbox connection tracking (#19348)
Fixes#18350I attempted the route of relying on just the session env vars, in hopesthat this issue was fixed in Toolbox and the process name matching wasno longer need, but it was not a fruitful endeavor and it seems to beusing the same connection logic as it did in gateway, just with newbinary and flag names.
1 parent560cf84 commitdd867bd

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

‎agent/agentssh/agentssh.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const (
4646
// MagicProcessCmdlineJetBrains is a string in a process's command line that
4747
// uniquely identifies it as JetBrains software.
4848
MagicProcessCmdlineJetBrains="idea.vendor.name=JetBrains"
49+
MagicProcessCmdlineToolbox="com.jetbrains.toolbox"
50+
MagicProcessCmdlineGateway="remote-dev-server"
4951

5052
// BlockedFileTransferErrorCode indicates that SSH server restricted the raw command from performing
5153
// the file transfer.

‎agent/agentssh/jetbrainstrack.go‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func NewJetbrainsChannelWatcher(ctx ssh.Context, logger slog.Logger, reportConne
5353

5454
// If this is not JetBrains, then we do not need to do anything special. We
5555
// attempt to match on something that appears unique to JetBrains software.
56-
if!strings.Contains(strings.ToLower(cmdline),strings.ToLower(MagicProcessCmdlineJetBrains)) {
56+
if!isJetbrainsProcess(cmdline) {
5757
returnnewChannel
5858
}
5959

@@ -104,3 +104,18 @@ func (c *ChannelOnClose) Close() error {
104104
c.once.Do(c.done)
105105
returnc.Channel.Close()
106106
}
107+
108+
funcisJetbrainsProcess(cmdlinestring)bool {
109+
opts:= []string{
110+
MagicProcessCmdlineJetBrains,
111+
MagicProcessCmdlineToolbox,
112+
MagicProcessCmdlineGateway,
113+
}
114+
115+
for_,opt:=rangeopts {
116+
ifstrings.Contains(strings.ToLower(cmdline),strings.ToLower(opt)) {
117+
returntrue
118+
}
119+
}
120+
returnfalse
121+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp