New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ibm-cos-sdk

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-cos-sdk - npm Package Compare versions

Comparing version 1.4.4 to 1.4.5

lib/credentials/anonymous_credentials.d.ts

10

CHANGELOG.md
# CHANGELOG
# 1.4.5
## Content
### Features
* Public Access
### Defect Fixes
* COSSDK-50781: https://github.ibm.com/objectstore/cases/issues/137
* COSSDK-52371: https://github.ibm.com/objectstore/objectstorage-issues/issues/634
* AWS Patches aligned to version v2.425.0 of the AWS NodeJS SDK
# 1.4.4

@@ -5,0 +15,0 @@ ## Content

16

lib/config.js

@@ -308,2 +308,9 @@ var AWS = require('./core');

function finish(err) {
if (self.credentials.apiKeyId || self.credentials.tokenManager) {
self.signatureVersion = 'iam';
} else if (self.credentials.accessKeyId) {
self.signatureVersion = 'v4';
} else if (self.credentials && self.credentials.constructor === AWS.AnonymousCredentials) {
self.signatureVersion = 'none';
}
callback(err, err ? null : self.credentials);

@@ -380,2 +387,5 @@ }

});
if (this.credentials.accessKeyId || this.credentials.tokenManager) {
this.credentials.expired = true;
}
},

@@ -498,8 +508,2 @@

options.credentials = new AWS.Credentials(options);
if (options.accessKeyId && options.secretAccessKey && !options.apiKeyId && !options.signatureVersion) {
this.signatureVersion = 'v4';
}
else if (options.credentials.tokenManager) {
this.signatureVersion = 'iam';
}
}

@@ -506,0 +510,0 @@ return options;

@@ -0,1 +1,2 @@

export {AnonymousCredentials} from './credentials/anonymous_credentials';
export {Config} from './config';

@@ -2,0 +3,0 @@ export {Credentials} from './credentials';

@@ -20,3 +20,3 @@ /**

*/
VERSION: '1.4.4',
VERSION: '1.4.5',

@@ -23,0 +23,0 @@ /**

@@ -79,14 +79,13 @@ var AWS = require('./core');

var creds = arguments[0].credentials || arguments[0];
if (creds.tokenManager) {
this.tokenManager = creds.tokenManager;
this.serviceInstanceId = creds.serviceInstanceId;
} else if (creds.apiKeyId || creds.authCallback) {
this.apiKeyId = creds.apiKeyId;
this.serviceInstanceId = creds.serviceInstanceId;
this.tokenManager = new TokenManager(creds);
} else {
this.accessKeyId = creds.accessKeyId;
this.secretAccessKey = creds.secretAccessKey;
this.sessionToken = creds.sessionToken;
}
this.apiKeyId = creds.apiKeyId;
this.serviceInstanceId = creds.serviceInstanceId;
this.authCallback = creds.authCallback;
this.tokenManager = creds.tokenManager;
this.ibmAuthEndpoint = creds.ibmAuthEndpoint;
this.accessKeyId = creds.accessKeyId;
this.secretAccessKey = creds.secretAccessKey;
this.sessionToken = creds.sessionToken;
this.httpOptions = creds.httpOptions;
} else {

@@ -140,2 +139,11 @@ this.accessKeyId = arguments[0];

var self = this;
try {
if ((self.apiKeyId || self.token || self.authCallback) && !self.tokenManager) {
self.tokenManager = new TokenManager(self);
}
} catch (e) {
return callback(e);
}
if (this.needsRefresh()) {

@@ -223,3 +231,3 @@ this.refresh(function(err) {

/**refresh
/**
* @api private

@@ -226,0 +234,0 @@ */

var AWS = require('../core');
var path = require('path');
var TokenManager = require('../iam/token_manager');

@@ -86,4 +87,9 @@ /**

this.sessionToken = profile['aws_session_token'];
this.apiKeyId = profile['ibm_api_key_id'];
this.serviceInstanceId = profile['ibm_service_instance_id'];
if (profile['ibm_auth_endpoint']) {
this.ibmAuthEndpoint = profile['ibm_auth_endpoint'];
}
if (!this.accessKeyId || !this.secretAccessKey) {
if ((!this.accessKeyId || !this.secretAccessKey) && !this.apiKeyId) {
throw AWS.util.error(

@@ -95,4 +101,8 @@ new Error('Credentials not set in ' + this.filename +

}
this.expired = false;
callback();
if (this.apiKeyId) {
this.tokenManager = new TokenManager(this);
this.tokenManager.refreshToken(callback);
} else {
callback();
}
} catch (err) {

@@ -99,0 +109,0 @@ callback(err);

var querystring = require('querystring');
var AWS = require('../../lib/core');
var util = AWS.util;

@@ -59,2 +58,3 @@ /**

function TokenManager() {
var options = {};
var config = {};

@@ -64,3 +64,3 @@ var authCallback;

if (typeof arguments[0] === 'object') {
config = arguments[0];
options = arguments[0];
} else if (typeof arguments[0] === 'function') {

@@ -78,3 +78,3 @@ authCallback = arguments[0];

// Default config
this.config = {
config = {
ibmAuthEndpoint: 'https://iam.ng.bluemix.net/oidc/token',

@@ -89,3 +89,3 @@ apiKeyId: null,

// Check that we have some sort of authentication mechanism
if (!(config.apiKeyId || config.token || (authCallback || config.authCallback))) {
if (!(options.apiKeyId || options.token || (authCallback || options.authCallback))) {
throw new Error('An authentication mechanism must be provided to the IAM token manager. This could be ' +

@@ -96,3 +96,3 @@ 'either an API Key, a valid API token, or a custom authentication callback.');

// Check that we still have an endpoint. This can happen if `null` or `''` is passed in by accident.
if (typeof config.ibmAuthEndpoint !== 'undefined' && !config.ibmAuthEndpoint) {
if (typeof options.ibmAuthEndpoint !== 'undefined' && !options.ibmAuthEndpoint) {
throw new Error('Endpoint must not be null or empty string.');

@@ -102,3 +102,10 @@ }

// Merge passed in config with default config
Object.assign(this.config, config);
AWS.util.each(options, function(key, value) {
if (value) {
config[key] = value;
}
});
// API Key is "hidden" from arrayEach
config.apiKeyId = options.apiKeyId;
this.config = config;
}

@@ -121,3 +128,3 @@

};
util.update(tokenRequestConfig, this.config.httpOptions);
AWS.util.update(tokenRequestConfig, this.config.httpOptions);
if (typeof tokenRequestConfig.body === 'object') {

@@ -133,6 +140,6 @@ tokenRequestConfig.body = JSON.stringify(tokenRequestConfig.body);

httpOptions: this.config.httpOptions,
maxRetries : 2
maxRetries : 2,
errorMessage: 'Unable to get IAM token'
};
var sendRefreshTokenRequest = function(resolve, reject) {

@@ -265,3 +272,3 @@ AWS.util.handleRequestWithRetries(httpRequest, httpRequestOptions, function(requestErr, response) {

var args = arguments;
util.arrayEach(this._callbacks, function(cb) {
AWS.util.arrayEach(this._callbacks, function(cb) {
cb.apply(this, args);

@@ -274,10 +281,14 @@ }.bind(this));

var config = Object.assign({}, this.config, options);
config.headers = Object.assign({}, this.DEFAULT_HEADERS, config.headers);
var config = AWS.util.merge(this.config, options);
config.headers = AWS.util.merge(this.DEFAULT_HEADERS, config.headers);
var rejectOrCallbackError = function(message) {
var err = new Error(message);
this._callbacks.forEach(function(cb) {
cb(err);
});
if (this._callbacks) {
this._callbacks.forEach(function (cb) {
cb(err);
});
} else if (callback) {
callback(err)
}
if (sdkPromise !== undefined) {

@@ -284,0 +295,0 @@ return sdkPromise.reject(err);

@@ -23,2 +23,3 @@ var util = require('./util');

// Load custom credential providers
require('./credentials/anonymous_credentials');
require('./credentials/environment_credentials');

@@ -25,0 +26,0 @@ require('./credentials/file_system_credentials');

@@ -235,5 +235,11 @@ var AWS = require('../core');

abort: function() {
this.cleanup(AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
}));
var self = this;
//abort putObject request
if (self.isDoneChunking === true && self.totalPartNumbers === 1 && self.singlePart) {
self.singlePart.abort();
} else {
self.cleanup(AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
}));
}
},

@@ -456,2 +462,3 @@

req.on('httpUploadProgress', self.progress).send(self.finishSinglePart);
self.singlePart = req; //save the single part request
return null;

@@ -458,0 +465,0 @@ } else if (self.service.config.params.ContentMD5) {

@@ -62,2 +62,5 @@ var AWS = require('../core');

var isPresigned = request ? request.isPresigned() : false;
if (request && request.service.config.credentials.tokenManager) {
defaultApiVersion = 'iam';
}
/*

@@ -930,2 +933,6 @@ 1) User defined version specified:

}
if (!credentials.accessKeyId || !credentials.secretAccessKey) {
throw new Error('Unable to create a POST object policy without a ' +
'credential containing an accessKeyId and secretAccessKey');
}
fields = AWS.util.copy(fields || {});

@@ -932,0 +939,0 @@ conditions = (conditions || []).slice(0);

@@ -30,2 +30,3 @@ var AWS = require('../core');

case 'iam': return AWS.Signers.IAM;
case 'none': return AWS.Signers.None;
}

@@ -42,1 +43,2 @@ throw new Error('Unknown signing version ' + version);

require('./iam');
require('./none');

@@ -895,4 +895,9 @@ /* eslint guard-for-in:0 */

var retryAfter = parseInt(httpResponse.headers['retry-after'], 10) * 1000 || 0;
var err = util.error(new Error(),
{ retryable: statusCode >= 500 || statusCode === 429 }
var err = util.error(new Error(options.errorMessage || 'HTTP error'),
{
retryable: statusCode >= 500 || statusCode === 429,
statusCode: statusCode,
request: httpRequest,
response: httpResponse
}
);

@@ -899,0 +904,0 @@ if (retryAfter && err.retryable) err.retryAfter = retryAfter;

{
"name": "ibm-cos-sdk",
"description": "IBM SDK for JavaScript",
"version": "1.4.4",
"version": "1.4.5",
"author": {

@@ -6,0 +6,0 @@ "name": "IBM",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc