-
Notifications
You must be signed in to change notification settings - Fork 8
fix(devtools-proxy-support): handle special characters in SSH URL correctly COMPASS-8254 #469
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,19 @@ describe('SSHAgent', function () { | |
expect(setup.authHandler).to.have.been.calledOnceWith('foo', 'bar'); | ||
}); | ||
|
||
it('handles special characters in username and password', async function () { | ||
setup.authHandler = sinon.stub().returns(true); | ||
agent = new SSHAgent({ | ||
proxy: `ssh://foo%5E:ba%[email protected]:${setup.sshProxyPort}/`, | ||
}); | ||
const fetch = createFetch(agent); | ||
await Promise.all([ | ||
fetch('http://example.com/hello'), | ||
fetch('http://example.com/hello'), | ||
]); | ||
expect(setup.authHandler).to.have.been.calledOnceWith('foo^', 'ba&r'); | ||
}); | ||
|
||
it('allows explicitly initializing the connection', async function () { | ||
setup.authHandler = sinon.stub().returns(true); | ||
agent = new SSHAgent({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,10 +78,10 @@ export class SSHAgent extends AgentBase implements AgentWithInitialize { | |
const sshConnectConfig: ConnectConfig = { | ||
readyTimeout: 20000, | ||
keepaliveInterval: 20000, | ||
host: this.url.hostname, | ||
host: decodeURIComponent(this.url.hostname), | ||
port: +this.url.port || 22, | ||
username: this.url.username || undefined, | ||
password: this.url.password || undefined, | ||
username: decodeURIComponent(this.url.username) || undefined, | ||
password: decodeURIComponent(this.url.password) || undefined, | ||
privateKey: this.proxyOptions.sshOptions?.identityKeyFile | ||
? await fs.readFile(this.proxyOptions.sshOptions.identityKeyFile) | ||
: undefined, | ||
|
@@ -92,7 +92,7 @@ export class SSHAgent extends AgentBase implements AgentWithInitialize { | |
this.logger.emit('ssh:establishing-conection', { | ||
host: sshConnectConfig.host, | ||
port: sshConnectConfig.port, | ||
password: !!sshConnectConfig.passphrase, | ||
password: !!sshConnectConfig.password, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😭 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be fair, this bit is unrelated to the bug itself, but still, yeah, not my smartest move 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I see now it is just in a logging event 👍 |
||
privateKey: !!sshConnectConfig.privateKey, | ||
passphrase: !!sshConnectConfig.passphrase, | ||
}); | ||
|
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 can see how this would be easy to miss.