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

ali-oss

Package Overview
Dependencies
Maintainers
7
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ali-oss - npm Package Compare versions

Comparing version 6.18.0 to 6.19.0-audit.1

2

lib/browser/client.js

@@ -245,2 +245,4 @@ const debug = require('debug')('ali-oss');

result = await this.urllib.request(reqParams.url, reqParams.params);
// After upgrading urllib to v3, the res returned no longer has data, which is to be compatible with the old code
result.res.data = result.data;
this.debug(

@@ -247,0 +249,0 @@ 'response %s %s, got %s, headers: %j',

const debug = require('debug')('ali-oss');
const sendToWormhole = require('stream-wormhole');
const xml = require('xml2js');
// const fs = require('fs');
// const path = require('path');
const AgentKeepalive = require('agentkeepalive');

@@ -10,2 +12,3 @@ const HttpsAgentKeepalive = require('agentkeepalive').HttpsAgent;

const urllib = require('urllib');
const ms = require('humanize-ms');
const pkg = require('../package.json');

@@ -207,3 +210,19 @@ const bowser = require('bowser');

try {
const { timeout } = reqParams.params;
if (typeof timeout === 'string') {
reqParams.params.timeout = ms(timeout); // Upgrading urllib to v3 no longer supports passing in strings
}
// const { writeStream } = reqParams.params;
// // check directory
// if (writeStream && writeStream.path) {
// const pname = writeStream.path;
// const dirname = path.dirname(pname);
// if (!fs.existsSync(dirname)) {
// // eslint-disable-next-line no-throw-literal
// throw { status: -1, message: `ENOENT: no such directory, open '${dirname}'` };
// }
// }
result = await this.urllib.request(reqParams.url, reqParams.params);
// After upgrading urllib to v3, the res returned no longer has data, which is to be compatible with the old code
result.res.data = result.data;
debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers);

@@ -220,3 +239,2 @@ } catch (err) {

}
if (err) {

@@ -223,0 +241,0 @@ if (params.customResponse && result && result.res) {

2

lib/common/bucket/getBucketPolicy.js

@@ -20,3 +20,3 @@ const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');

if (result.res.status === 200) {
policy = JSON.parse(result.res.data.toString());
policy = JSON.parse(result.data.toString());
}

@@ -23,0 +23,0 @@

@@ -20,2 +20,3 @@ const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');

const params = this._bucketRequestParams('PUT', bucketName, 'policy', options);
params.mime = 'json';
params.content = policy2Str(policy);

@@ -22,0 +23,0 @@ params.successStatuses = [200];

@@ -39,2 +39,3 @@ /* eslint-disable object-curly-newline */

}
const params = this._objectRequestParams('POST', '', options);

@@ -41,0 +42,0 @@ params.mime = 'xml';

@@ -1,3 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.createRequest = void 0;

@@ -14,94 +15,99 @@ const crypto = require('crypto');

const { getReqUrl } = require('../client/getReqUrl');
function getHeader(headers, name) {
return headers[name] || headers[name.toLowerCase()];
return headers[name] || headers[name.toLowerCase()];
}
function delHeader(headers, name) {
delete headers[name];
delete headers[name.toLowerCase()];
delete headers[name];
delete headers[name.toLowerCase()];
}
function createRequest(params) {
let date = new Date();
if (this.options.amendTimeSkewed) {
date = +new Date() + this.options.amendTimeSkewed;
let date = new Date();
if (this.options.amendTimeSkewed) {
date = +new Date() + this.options.amendTimeSkewed;
}
const headers = {
'x-oss-date': dateFormat(date, "UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'")
};
if (typeof window !== 'undefined') {
headers['x-oss-user-agent'] = this.userAgent;
}
if (this.userAgent.includes('nodejs')) {
headers['User-Agent'] = this.userAgent;
}
if (this.options.isRequestPay) {
Object.assign(headers, { 'x-oss-request-payer': 'requester' });
}
if (this.options.stsToken) {
headers['x-oss-security-token'] = this.options.stsToken;
}
copy(params.headers).to(headers);
if (!getHeader(headers, 'Content-Type')) {
if (params.mime && params.mime.indexOf('/') > 0) {
headers['Content-Type'] = params.mime;
} else {
headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
}
const headers = {
'x-oss-date': dateFormat(date, "UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'")
};
if (typeof window !== 'undefined') {
headers['x-oss-user-agent'] = this.userAgent;
}
if (!getHeader(headers, 'Content-Type')) {
delHeader(headers, 'Content-Type');
}
if (params.content) {
if (!params.disabledMD5) {
if (!params.headers || !params.headers['Content-MD5']) {
headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
} else {
headers['Content-MD5'] = params.headers['Content-MD5'];
}
}
if (this.userAgent.includes('nodejs')) {
headers['User-Agent'] = this.userAgent;
// if (!headers['Content-Length']) {
// headers['Content-Length'] = params.content.length;
// }
}
const { hasOwnProperty } = Object.prototype;
for (const k in headers) {
if (headers[k] && hasOwnProperty.call(headers, k)) {
headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
}
if (this.options.isRequestPay) {
Object.assign(headers, { 'x-oss-request-payer': 'requester' });
}
if (this.options.stsToken) {
headers['x-oss-security-token'] = this.options.stsToken;
}
copy(params.headers).to(headers);
if (!getHeader(headers, 'Content-Type')) {
if (params.mime && params.mime.indexOf('/') > 0) {
headers['Content-Type'] = params.mime;
}
else {
headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
}
}
if (!getHeader(headers, 'Content-Type')) {
delHeader(headers, 'Content-Type');
}
if (params.content) {
if (!params.disabledMD5) {
if (!params.headers || !params.headers['Content-MD5']) {
headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
}
else {
headers['Content-MD5'] = params.headers['Content-MD5'];
}
}
if (!headers['Content-Length']) {
headers['Content-Length'] = params.content.length;
}
}
const { hasOwnProperty } = Object.prototype;
for (const k in headers) {
if (headers[k] && hasOwnProperty.call(headers, k)) {
headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
}
}
const authResource = this._getResource(params);
headers.authorization = this.authorization(params.method, authResource, params.subres, headers, this.options.headerEncoding);
// const url = this._getReqUrl(params);
if (isIP(this.options.endpoint.hostname)) {
const { region, internal, secure } = this.options;
const hostInfo = setRegion(region, internal, secure);
headers.host = `${params.bucket}.${hostInfo.host}`;
}
const url = getReqUrl.bind(this)(params);
debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
const timeout = params.timeout || this.options.timeout;
const reqParams = {
method: params.method,
content: params.content,
stream: params.stream,
headers,
timeout,
writeStream: params.writeStream,
customResponse: params.customResponse,
ctx: params.ctx || this.ctx
};
if (this.agent) {
reqParams.agent = this.agent;
}
if (this.httpsAgent) {
reqParams.httpsAgent = this.httpsAgent;
}
reqParams.enableProxy = !!this.options.enableProxy;
reqParams.proxy = this.options.proxy ? this.options.proxy : null;
return {
url,
params: reqParams
};
}
const authResource = this._getResource(params);
headers.authorization = this.authorization(
params.method,
authResource,
params.subres,
headers,
this.options.headerEncoding
);
// const url = this._getReqUrl(params);
if (isIP(this.options.endpoint.hostname)) {
const { region, internal, secure } = this.options;
const hostInfo = setRegion(region, internal, secure);
headers.host = `${params.bucket}.${hostInfo.host}`;
}
const url = getReqUrl.bind(this)(params);
debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
const timeout = params.timeout || this.options.timeout;
const reqParams = {
method: params.method,
content: params.content,
stream: params.stream,
headers,
timeout,
writeStream: params.writeStream,
customResponse: params.customResponse,
ctx: params.ctx || this.ctx
};
if (this.agent) {
reqParams.agent = this.agent;
}
if (this.httpsAgent) {
reqParams.httpsAgent = this.httpsAgent;
}
reqParams.enableProxy = !!this.options.enableProxy;
reqParams.proxy = this.options.proxy ? this.options.proxy : null;
return {
url,
params: reqParams
};
}
exports.createRequest = createRequest;

@@ -78,5 +78,5 @@ const crypto = require('crypto');

}
if (!headers['Content-Length']) {
headers['Content-Length'] = params.content.length;
}
// if (!headers['Content-Length']) {
// headers['Content-Length'] = params.content.length;
// }
}

@@ -83,0 +83,0 @@

@@ -135,3 +135,3 @@ const debug = require('debug')('ali-oss:object');

} else {
options.headers['Transfer-Encoding'] = 'chunked';
// options.headers['Transfer-Encoding'] = 'chunked';
}

@@ -270,17 +270,22 @@ this._convertMetaToHeaders(options.meta, options.headers);

}
objects = objects.map(obj => ({
name: obj.Key,
url: that._objectUrl(obj.Key),
lastModified: obj.LastModified,
etag: obj.ETag,
type: obj.Type,
size: Number(obj.Size),
storageClass: obj.StorageClass,
owner: obj.Owner
? {
id: obj.Owner.ID,
displayName: obj.Owner.DisplayName
}
: null
}));
objects = objects.map(obj => {
let owner = null;
if (obj.Owner) {
owner = {
id: obj.Owner.ID,
displayName: obj.Owner.DisplayName
};
}
return {
name: obj.Key,
url: that._objectUrl(obj.Key),
lastModified: obj.LastModified,
etag: obj.ETag,
type: obj.Type,
size: Number(obj.Size),
storageClass: obj.StorageClass,
owner
};
});
}

@@ -287,0 +292,0 @@ let prefixes = result.data.CommonPrefixes || null;

@@ -36,2 +36,3 @@ /**

const params = this._objectRequestParams('PUT', id, options);
params.mime = 'xml';
params.xmlResponse = true;

@@ -38,0 +39,0 @@ params.content = jstoxml.toXML({

@@ -95,2 +95,4 @@ const debug = require('debug')('ali-oss:sts');

const result = await this.urllib.request(reqUrl, reqParams);
// After upgrading urllib to v3, the res returned no longer has data, which is to be compatible with the old code
result.res.data = result.data;
debug('response %s %s, got %s, headers: %j', reqParams.method, reqUrl, result.status, result.headers);

@@ -97,0 +99,0 @@

{
"name": "ali-oss",
"version": "6.18.0",
"version": "6.19.0-audit.1",
"description": "aliyun oss(object storage service) node client",

@@ -65,3 +65,3 @@ "main": "./lib/client.js",

"engines": {
"node": ">=8"
"node": ">=14"
},

@@ -75,3 +75,3 @@ "homepage": "https://github.com/aliyun/oss-nodejs-sdk",

"@babel/runtime": "^7.11.2",
"@commitlint/cli": "^16.2.4",
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^16.2.4",

@@ -83,2 +83,3 @@ "@snyk/protect": "^1.1196.0",

"aliasify": "^2.0.0",
"axios": "^1.4.0",
"babelify": "^10.0.0",

@@ -88,3 +89,3 @@ "beautify-benchmark": "^0.2.4",

"bluebird": "^3.1.5",
"browserify": "13.3.0",
"browserify": "^17.0.0",
"core-js": "^3.6.5",

@@ -101,7 +102,8 @@ "crypto-js": "^3.1.9-1",

"filereader": "^0.10.3",
"form-data": "^4.0.0",
"git-pre-hooks": "^1.2.0",
"husky": "^8.0.3",
"husky": "^7.0.4",
"immediate": "^3.3.0",
"karma": "^6.3.4",
"karma-browserify": "^5.1.1",
"karma-browserify": "^8.1.0",
"karma-chrome-launcher": "^2.2.0",

@@ -119,5 +121,4 @@ "karma-firefox-launcher": "^1.0.1",

"puppeteer": "^20.9.0",
"request": "^2.88.0",
"should": "^11.0.0",
"sinon": "^1.17.7",
"sinon": "^15.2.0",
"standard-version": "^9.3.1",

@@ -128,3 +129,3 @@ "stream-equal": "^1.1.0",

"uglify-js": "^3.14.2",
"watchify": "^3.11.1"
"watchify": "^4.0.0"
},

@@ -137,3 +138,3 @@ "dependencies": {

"dateformat": "^2.0.0",
"debug": "^2.2.0",
"debug": "^4.3.4",
"destroy": "^1.0.4",

@@ -153,5 +154,5 @@ "end-or-error": "^1.0.1",

"stream-wormhole": "^1.0.4",
"urllib": "^2.33.1",
"urllib": "^3.17.1",
"utility": "^1.18.0",
"xml2js": "^0.4.16"
"xml2js": "^0.6.2"
},

@@ -158,0 +159,0 @@ "snyk": true,

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