Changes to tests to make them correct
This commit is contained in:
5
ProjectSourceCode/node_modules/.package-lock.json
generated
vendored
5
ProjectSourceCode/node_modules/.package-lock.json
generated
vendored
@@ -4022,8 +4022,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.2.0",
|
"version": "6.2.1",
|
||||||
"license": "ISC",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
"fs-minipass": "^2.0.0",
|
"fs-minipass": "^2.0.0",
|
||||||
|
|||||||
10
ProjectSourceCode/node_modules/tar/README.md
generated
vendored
10
ProjectSourceCode/node_modules/tar/README.md
generated
vendored
@@ -115,6 +115,8 @@ Handlers receive 3 arguments:
|
|||||||
encountered an error which prevented it from being unpacked. This occurs
|
encountered an error which prevented it from being unpacked. This occurs
|
||||||
when:
|
when:
|
||||||
- an unrecoverable fs error happens during unpacking,
|
- an unrecoverable fs error happens during unpacking,
|
||||||
|
- an entry is trying to extract into an excessively deep
|
||||||
|
location (by default, limited to 1024 subfolders),
|
||||||
- an entry has `..` in the path and `preservePaths` is not set, or
|
- an entry has `..` in the path and `preservePaths` is not set, or
|
||||||
- an entry is extracting through a symbolic link, when `preservePaths` is
|
- an entry is extracting through a symbolic link, when `preservePaths` is
|
||||||
not set.
|
not set.
|
||||||
@@ -427,6 +429,10 @@ The following options are supported:
|
|||||||
`process.umask()` to determine the default umask value, since tar will
|
`process.umask()` to determine the default umask value, since tar will
|
||||||
extract with whatever mode is provided, and let the process `umask` apply
|
extract with whatever mode is provided, and let the process `umask` apply
|
||||||
normally.
|
normally.
|
||||||
|
- `maxDepth` The maximum depth of subfolders to extract into. This
|
||||||
|
defaults to 1024. Anything deeper than the limit will raise a
|
||||||
|
warning and skip the entry. Set to `Infinity` to remove the
|
||||||
|
limitation.
|
||||||
|
|
||||||
The following options are mostly internal, but can be modified in some
|
The following options are mostly internal, but can be modified in some
|
||||||
advanced use cases, such as re-using caches between runs.
|
advanced use cases, such as re-using caches between runs.
|
||||||
@@ -749,6 +755,10 @@ Most unpack errors will cause a `warn` event to be emitted. If the
|
|||||||
`process.umask()` to determine the default umask value, since tar will
|
`process.umask()` to determine the default umask value, since tar will
|
||||||
extract with whatever mode is provided, and let the process `umask` apply
|
extract with whatever mode is provided, and let the process `umask` apply
|
||||||
normally.
|
normally.
|
||||||
|
- `maxDepth` The maximum depth of subfolders to extract into. This
|
||||||
|
defaults to 1024. Anything deeper than the limit will raise a
|
||||||
|
warning and skip the entry. Set to `Infinity` to remove the
|
||||||
|
limitation.
|
||||||
|
|
||||||
### class tar.Unpack.Sync
|
### class tar.Unpack.Sync
|
||||||
|
|
||||||
|
|||||||
27
ProjectSourceCode/node_modules/tar/lib/unpack.js
generated
vendored
27
ProjectSourceCode/node_modules/tar/lib/unpack.js
generated
vendored
@@ -48,6 +48,7 @@ const crypto = require('crypto')
|
|||||||
const getFlag = require('./get-write-flag.js')
|
const getFlag = require('./get-write-flag.js')
|
||||||
const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
|
const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform
|
||||||
const isWindows = platform === 'win32'
|
const isWindows = platform === 'win32'
|
||||||
|
const DEFAULT_MAX_DEPTH = 1024
|
||||||
|
|
||||||
// Unlinks on Windows are not atomic.
|
// Unlinks on Windows are not atomic.
|
||||||
//
|
//
|
||||||
@@ -181,6 +182,12 @@ class Unpack extends Parser {
|
|||||||
this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?
|
this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?
|
||||||
process.getgid() : null
|
process.getgid() : null
|
||||||
|
|
||||||
|
// prevent excessively deep nesting of subfolders
|
||||||
|
// set to `Infinity` to remove this restriction
|
||||||
|
this.maxDepth = typeof opt.maxDepth === 'number'
|
||||||
|
? opt.maxDepth
|
||||||
|
: DEFAULT_MAX_DEPTH
|
||||||
|
|
||||||
// mostly just for testing, but useful in some cases.
|
// mostly just for testing, but useful in some cases.
|
||||||
// Forcibly trigger a chown on every entry, no matter what
|
// Forcibly trigger a chown on every entry, no matter what
|
||||||
this.forceChown = opt.forceChown === true
|
this.forceChown = opt.forceChown === true
|
||||||
@@ -238,13 +245,13 @@ class Unpack extends Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CHECKPATH] (entry) {
|
[CHECKPATH] (entry) {
|
||||||
|
const p = normPath(entry.path)
|
||||||
|
const parts = p.split('/')
|
||||||
|
|
||||||
if (this.strip) {
|
if (this.strip) {
|
||||||
const parts = normPath(entry.path).split('/')
|
|
||||||
if (parts.length < this.strip) {
|
if (parts.length < this.strip) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
entry.path = parts.slice(this.strip).join('/')
|
|
||||||
|
|
||||||
if (entry.type === 'Link') {
|
if (entry.type === 'Link') {
|
||||||
const linkparts = normPath(entry.linkpath).split('/')
|
const linkparts = normPath(entry.linkpath).split('/')
|
||||||
if (linkparts.length >= this.strip) {
|
if (linkparts.length >= this.strip) {
|
||||||
@@ -253,11 +260,21 @@ class Unpack extends Parser {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
parts.splice(0, this.strip)
|
||||||
|
entry.path = parts.join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
|
||||||
|
this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {
|
||||||
|
entry,
|
||||||
|
path: p,
|
||||||
|
depth: parts.length,
|
||||||
|
maxDepth: this.maxDepth,
|
||||||
|
})
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.preservePaths) {
|
if (!this.preservePaths) {
|
||||||
const p = normPath(entry.path)
|
|
||||||
const parts = p.split('/')
|
|
||||||
if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) {
|
if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) {
|
||||||
this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {
|
this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {
|
||||||
entry,
|
entry,
|
||||||
|
|||||||
2
ProjectSourceCode/node_modules/tar/package.json
generated
vendored
2
ProjectSourceCode/node_modules/tar/package.json
generated
vendored
@@ -2,7 +2,7 @@
|
|||||||
"author": "GitHub Inc.",
|
"author": "GitHub Inc.",
|
||||||
"name": "tar",
|
"name": "tar",
|
||||||
"description": "tar for node",
|
"description": "tar for node",
|
||||||
"version": "6.2.0",
|
"version": "6.2.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/isaacs/node-tar.git"
|
"url": "https://github.com/isaacs/node-tar.git"
|
||||||
|
|||||||
5
ProjectSourceCode/package-lock.json
generated
5
ProjectSourceCode/package-lock.json
generated
@@ -4044,8 +4044,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.2.0",
|
"version": "6.2.1",
|
||||||
"license": "ISC",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
"fs-minipass": "^2.0.0",
|
"fs-minipass": "^2.0.0",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ describe('Server!', () => {
|
|||||||
it('positive: /register', done => {
|
it('positive: /register', done => {
|
||||||
// Define mock user data
|
// Define mock user data
|
||||||
const userData = {
|
const userData = {
|
||||||
username: 'Vishal Vunnam',
|
username: 'Vishal',
|
||||||
password: '123456'
|
password: '123456'
|
||||||
};
|
};
|
||||||
// Make a POST request to /register with mock user data
|
// Make a POST request to /register with mock user data
|
||||||
|
|||||||
Reference in New Issue
Block a user