Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Dec 3, 2024
1 parent f5c992b commit 2bb0e5f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
5 changes: 4 additions & 1 deletion lib/file_transfer_agent/azure_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ function AzureUtil(connectionConfig, azure, filestream) {
const connectionString = `https://${account}.blob.core.windows.net${sasToken}`;
let proxy = ProxyUtil.getProxy(connectionConfig.getProxy(), 'Azure Util');
if (proxy && !isBypassProxy(proxy, connectionString)) {
proxy = ProxyUtil.getAzureProxy(proxy);
Logger.getInstance().debug(`The destination host is: ${ProxyUtil.getHostFromURL(connectionString)} and the proxy host is: ${proxy.host}`);
Logger.getInstance().trace(`Initializing the proxy information for the Azure Client: ${ProxyUtil.describeProxy(proxy)}`);

Check warning on line 52 in lib/file_transfer_agent/azure_util.js

View check run for this annotation

Codecov / codecov/patch

lib/file_transfer_agent/azure_util.js#L51-L52

Added lines #L51 - L52 were not covered by tests

proxy = ProxyUtil.getAzureProxy(proxy);
Logger.getInstance().trace(connectionConfig.describe);

Check warning on line 55 in lib/file_transfer_agent/azure_util.js

View check run for this annotation

Codecov / codecov/patch

lib/file_transfer_agent/azure_util.js#L54-L55

Added lines #L54 - L55 were not covered by tests
}
ProxyUtil.hideEnvironmentProxy();
const blobServiceClient = new AZURE.BlobServiceClient(
Expand Down
7 changes: 7 additions & 0 deletions lib/proxy_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Logger = require('./logger');
const Errors = require('./errors');
const Util = require('./util');
const GlobalConfig = require('./global_config');
const LoggingUtil = require('./logger/logging_utils');
const ErrorCodes = Errors.codes;
/**
* remove http:// or https:// from the input, e.g. used with proxy URL
Expand Down Expand Up @@ -254,4 +255,10 @@ exports.restoreEnvironmentProxy = function () {
}
}
Logger.getInstance().debug('An Azure client has been created. Restore back the proxy environment variable values');
};

exports.describeProxy = function (proxy) {
return `proxyHost: ${proxy.host}, proxyPort: ${proxy.port}, proxyUser: ${proxy.user}, `

Check warning on line 261 in lib/proxy_util.js

View check run for this annotation

Codecov / codecov/patch

lib/proxy_util.js#L261

Added line #L261 was not covered by tests
+ `proxyPassword is ${LoggingUtil.describePresence(proxy.password)}, `
+ `proxyProtocol: ${proxy.protocol}, noProxy: ${proxy.noProxy}`;
};
38 changes: 1 addition & 37 deletions test/unit/util_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,42 +1057,6 @@ describe('Util', function () {
parameters: ['a', 123, ['testing'], {}],
result: true
},
{
name: 'HTTPS PROXY with authentication without port and protocol',
isHttps: true,
noProxy: '*.amazonaws.com,*.my_company.com,*.test.com',
httpsProxy: 'myproxy.server.com',
result: {
host: 'myproxy.server.com',
port: 80,
protocol: 'http:',
noProxy: '*.amazonaws.com|*.my_company.com|*.test.com',
},
},
{
name: 'HTTP PROXY with authentication without port and protocol',
isHttps: false,
noProxy: '*.amazonaws.com,*.my_company.com,*.test.com',
httpProxy: 'myproxy.server.com',
result: {
host: 'myproxy.server.com',
port: 80,
protocol: 'http:',
noProxy: '*.amazonaws.com|*.my_company.com|*.test.com',
},
},
{
name: 'HTTPS PROXY with authentication without port',
isHttps: true,
noProxy: '*.amazonaws.com,*.my_company.com,*.test.com',
httpsProxy: 'https://myproxy.server.com',
result: {
host: 'myproxy.server.com',
port: 443,
protocol: 'https:',
noProxy: '*.amazonaws.com|*.my_company.com|*.test.com',
},
},
];

for (const { name, parameters, result } of testCases) {
Expand Down Expand Up @@ -1214,7 +1178,7 @@ describe('shouldPerformGCPBucket function test', () => {
result: false,
},
{
name: 'test - test - when token is empty but the disableGCPTokenUplaod is disabled',
name: 'test - when token is empty but the disableGCPTokenUplaod is disabled',
accessToken: null,
forceGCPUseDownscopedCredential: false,
result: false,
Expand Down

0 comments on commit 2bb0e5f

Please sign in to comment.