Fix axios CVE and improve npm check_publish script
This commit is contained in:
parent
2841bdea52
commit
9e8de5bf46
|
|
@ -6,11 +6,12 @@ Hurl is [distributed on npm] as a thin wrapper around the native binary.
|
|||
|
||||
## Publish
|
||||
|
||||
To publish a new version `x.y.z`:
|
||||
To publish a new version of the package `PACKAGE_VERSION` using the binary `HURL_VERSION`:
|
||||
|
||||
```shell
|
||||
$ cp docs/manual/*.1 contrib/npm/hurl/docs/
|
||||
$ python3 ./contrib/npm/check_publish.py x.y.z
|
||||
$ python3 ./contrib/npm/check_publish.py $HURL_VERSION $PACKAGE_VERSION
|
||||
$ rm -rfd contrib/npm/hurl/dist contrib/npm/hurl/node_modules
|
||||
$ npm publish --dry-run contrib/npm/hurl/
|
||||
$ npm publish contrib/npm/hurl/
|
||||
```
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ def bold_red(text: str) -> str:
|
|||
return f"\x1b[1;31m{text}\x1b[0m"
|
||||
|
||||
|
||||
def check_archive(version: str):
|
||||
def check_archive(hurl_version: str, package_version: str):
|
||||
print(bold_blue("Checking archives:"))
|
||||
path = Path("contrib/npm/hurl/platform.json")
|
||||
platforms = json.loads(path.read_text())
|
||||
|
|
@ -35,7 +35,7 @@ def check_archive(version: str):
|
|||
target = platform["rust_target"]
|
||||
extension = platform["archive_extension"]
|
||||
expected_checksum = platform["checksum"]
|
||||
url = f"https://github.com/Orange-OpenSource/hurl/releases/download/{version}/hurl-{version}-{target}{extension}"
|
||||
url = f"https://github.com/Orange-OpenSource/hurl/releases/download/{hurl_version}/hurl-{hurl_version}-{target}{extension}"
|
||||
print(f" Downloading: {bold(url)}")
|
||||
with request.urlopen(url) as response:
|
||||
if response.status != 200:
|
||||
|
|
@ -60,37 +60,51 @@ def check_archive(version: str):
|
|||
print()
|
||||
|
||||
|
||||
def check_version(version: str):
|
||||
def check_version(hurl_version: str, package_version: str):
|
||||
print(bold_blue("Checking version:"))
|
||||
path = Path("contrib/npm/hurl/package.json")
|
||||
package = json.loads(path.read_text())
|
||||
expected_version = version
|
||||
actual_version = package["version"]
|
||||
if actual_version != expected_version:
|
||||
expected_hurl_version = hurl_version
|
||||
actual_hurl_version = package["hurlBinaryVersion"]
|
||||
expected_package_version = package_version
|
||||
actual_package_version = package["version"]
|
||||
|
||||
if actual_hurl_version != expected_hurl_version:
|
||||
print(
|
||||
bold_red(
|
||||
f" Version KO actual={actual_version} expected={expected_version}, please update "
|
||||
f" Hurl version KO actual={actual_hurl_version} expected={expected_hurl_version}, please update "
|
||||
f"hurlBinaryVersion in contrib/npm/hurl/package.json"
|
||||
)
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(bold_green(" Hurl version OK"))
|
||||
|
||||
if actual_package_version != expected_package_version:
|
||||
print(
|
||||
bold_red(
|
||||
f" Package version KO actual={actual_package_version} expected={expected_package_version}, please update "
|
||||
f"version in contrib/npm/hurl/package.json"
|
||||
)
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(bold_green(" Version OK"))
|
||||
print(bold_green(" Package version OK"))
|
||||
|
||||
|
||||
def check_manual(version: str):
|
||||
def check_manual(hurl_version: str, package_version: str):
|
||||
print(bold_blue("Checking manual:"))
|
||||
print()
|
||||
pass
|
||||
|
||||
|
||||
def main(version: str):
|
||||
check_version(version)
|
||||
check_manual(version)
|
||||
check_archive(version)
|
||||
def main(hurl_version: str, package_version):
|
||||
check_version(hurl_version, package_version)
|
||||
check_manual(hurl_version, package_version)
|
||||
check_archive(hurl_version, package_version)
|
||||
|
||||
print(bold("Everything looks OK!"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1])
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const cTable = require("console.table");
|
||||
const archive = require("./archive");
|
||||
//const {version} = require("./package.json");
|
||||
const version = "4.3.0";
|
||||
const {hurlBinaryVersion} = require("./package.json");
|
||||
|
||||
const supportedPlatforms = require("./platform.json");
|
||||
|
||||
|
|
@ -25,14 +23,16 @@ function getPlatformMetadata() {
|
|||
return supportedPlatform;
|
||||
}
|
||||
}
|
||||
const platforms = supportedPlatforms.map((p) => `${p.type} ${p.architecture}`)
|
||||
.join("\n");
|
||||
error(
|
||||
`Platform with type "${type}" and architecture "${architecture}" is not supported.
|
||||
Your system must be one of the following:
|
||||
${cTable.getTable(supportedPlatforms)}`
|
||||
Your system must be one of the following:
|
||||
${platforms}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const metadata = getPlatformMetadata();
|
||||
const url = `https://github.com/Orange-OpenSource/hurl/releases/download/${version}/hurl-${version}-${metadata.rust_target}${metadata.archive_extension}`;
|
||||
const url = `https://github.com/Orange-OpenSource/hurl/releases/download/${hurlBinaryVersion}/hurl-${hurlBinaryVersion}-${metadata.rust_target}${metadata.archive_extension}`;
|
||||
archive.install(url, path.join(__dirname, "dist"), metadata.checksum);
|
||||
|
|
@ -1,20 +1,19 @@
|
|||
{
|
||||
"name": "@orangeopensource/hurl",
|
||||
"version": "4.3.1",
|
||||
"version": "4.3.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@orangeopensource/hurl",
|
||||
"version": "4.3.1",
|
||||
"version": "4.3.3",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"axios": "1.6.8",
|
||||
"console.table": "0.10.0",
|
||||
"axios": "1.7.4",
|
||||
"extract-zip": "2.0.1",
|
||||
"rimraf": "5.0.5",
|
||||
"tar": "7.0.1"
|
||||
"tar": "7.4.3"
|
||||
},
|
||||
"bin": {
|
||||
"hurl": "hurl.js",
|
||||
|
|
@ -101,9 +100,9 @@
|
|||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.8",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
||||
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz",
|
||||
"integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
|
|
@ -139,15 +138,6 @@
|
|||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
|
|
@ -175,17 +165,6 @@
|
|||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/console.table": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz",
|
||||
"integrity": "sha1-CRcCVYiHW+/XDPLv9L7yxuLXXQQ=",
|
||||
"dependencies": {
|
||||
"easy-table": "1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "> 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
|
|
@ -215,15 +194,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"clone": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
|
|
@ -237,14 +207,6 @@
|
|||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
||||
},
|
||||
"node_modules/easy-table": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz",
|
||||
"integrity": "sha1-hvmrTBAvA3G3KXuSplHVgkvIy3M=",
|
||||
"optionalDependencies": {
|
||||
"wcwidth": ">=1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
|
|
@ -439,9 +401,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
|
||||
"integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
|
|
@ -663,13 +625,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.0.1.tgz",
|
||||
"integrity": "sha512-IjMhdQMZFpKsHEQT3woZVxBtCQY+0wk3CVxdRkGXEgyGa0dNS/ehPvOMr2nmfC7x5Zj2N+l6yZUpmICjLGS35w==",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
|
||||
"integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
|
||||
"dependencies": {
|
||||
"@isaacs/fs-minipass": "^4.0.0",
|
||||
"chownr": "^3.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minipass": "^7.1.2",
|
||||
"minizlib": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"yallist": "^5.0.0"
|
||||
|
|
@ -678,23 +640,6 @@
|
|||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
|
@ -875,9 +820,9 @@
|
|||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"axios": {
|
||||
"version": "1.6.8",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
||||
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz",
|
||||
"integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
|
|
@ -907,12 +852,6 @@
|
|||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
||||
"integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="
|
||||
},
|
||||
"clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
||||
"optional": true
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
|
|
@ -934,14 +873,6 @@
|
|||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"console.table": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz",
|
||||
"integrity": "sha1-CRcCVYiHW+/XDPLv9L7yxuLXXQQ=",
|
||||
"requires": {
|
||||
"easy-table": "1.1.0"
|
||||
}
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
|
|
@ -960,15 +891,6 @@
|
|||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"clone": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
|
|
@ -979,14 +901,6 @@
|
|||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
||||
},
|
||||
"easy-table": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz",
|
||||
"integrity": "sha1-hvmrTBAvA3G3KXuSplHVgkvIy3M=",
|
||||
"requires": {
|
||||
"wcwidth": ">=1.0.1"
|
||||
}
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
|
|
@ -1109,9 +1023,9 @@
|
|||
}
|
||||
},
|
||||
"minipass": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
|
||||
"integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ=="
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "3.0.1",
|
||||
|
|
@ -1263,32 +1177,16 @@
|
|||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.0.1.tgz",
|
||||
"integrity": "sha512-IjMhdQMZFpKsHEQT3woZVxBtCQY+0wk3CVxdRkGXEgyGa0dNS/ehPvOMr2nmfC7x5Zj2N+l6yZUpmICjLGS35w==",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
|
||||
"integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
|
||||
"requires": {
|
||||
"@isaacs/fs-minipass": "^4.0.0",
|
||||
"chownr": "^3.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minipass": "^7.1.2",
|
||||
"minizlib": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"yallist": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "@orangeopensource/hurl",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.3",
|
||||
"hurlBinaryVersion": "4.3.0",
|
||||
"description": "Run and Test HTTP Requests with plain text and curl",
|
||||
"author": "Jean-Christophe Amiel <jeanchristophe.amiel@orange.com>",
|
||||
"contributors": [
|
||||
|
|
@ -22,11 +23,10 @@
|
|||
"postinstall": "node ./install.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "1.6.8",
|
||||
"console.table": "0.10.0",
|
||||
"axios": "1.7.4",
|
||||
"extract-zip": "2.0.1",
|
||||
"rimraf": "5.0.5",
|
||||
"tar": "7.0.1"
|
||||
"tar": "7.4.3"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"keywords": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue