k2hr3-api 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -741,9 +741,9 @@ if [ "${SCRIPTMODE}" = "r" ]; then
|
|
|
741
741
|
RESOLVE_DOMAIN=$(grep -i '^domain' /etc/resolv.conf | awk '{print $NF}')
|
|
742
742
|
fi
|
|
743
743
|
|
|
744
|
-
if [ -n "${RESOLVE_DOMAIN}" ]; then
|
|
744
|
+
if [ -n "${RESOLVE_DOMAIN}" ] && [ -n "${LOCAL_HOSTNAME}" ]; then
|
|
745
745
|
LOCAL_FULL_HOSTNAME="${LOCAL_HOSTNAME}.${RESOLVE_DOMAIN}"
|
|
746
|
-
elif [ -n "${LOCAL_DOMAIN}" ]; then
|
|
746
|
+
elif [ -n "${LOCAL_DOMAIN}" ] && [ -n "${LOCAL_HOSTNAME}" ]; then
|
|
747
747
|
LOCAL_FULL_HOSTNAME="${LOCAL_HOSTNAME}.${LOCAL_DOMAIN}"
|
|
748
748
|
else
|
|
749
749
|
LOCAL_FULL_HOSTNAME=$(hostname -f)
|
|
@@ -56,7 +56,6 @@ exports.k2hr3ppiutil = void 0;
|
|
|
56
56
|
const dns = __importStar(require("dns"));
|
|
57
57
|
const fs = __importStar(require("fs"));
|
|
58
58
|
const crypto = __importStar(require("crypto"));
|
|
59
|
-
const url = __importStar(require("url"));
|
|
60
59
|
//---------------------------------------------------------
|
|
61
60
|
// Utilities for variables
|
|
62
61
|
//---------------------------------------------------------
|
|
@@ -1143,8 +1142,8 @@ const rawComplementHostnameIpAddress = (hostname, ip, callback) => {
|
|
|
1143
1142
|
// url parser with default port
|
|
1144
1143
|
//
|
|
1145
1144
|
const rawUrlParse = (strurl) => {
|
|
1146
|
-
const ep =
|
|
1147
|
-
if (rawIsSafeEntity(ep) && (null === ep.port || !rawIsSafeEntity(ep.port) || isNaN(Number(ep.port)))) {
|
|
1145
|
+
const ep = new URL(strurl, 'http://localhost');
|
|
1146
|
+
if (rawIsSafeEntity(ep) && (null === ep.port || '' === ep.port || !rawIsSafeEntity(ep.port) || isNaN(Number(ep.port)))) {
|
|
1148
1147
|
// set default port
|
|
1149
1148
|
if (rawIsSafeString(ep.protocol) && 'https:' === ep.protocol) {
|
|
1150
1149
|
ep.port = String(443);
|
|
@@ -167,7 +167,7 @@ const rawGetUserUnscopedTokenV3 = (uname, passwd, callback) => {
|
|
|
167
167
|
};
|
|
168
168
|
const options = {
|
|
169
169
|
'host': k2hr3apiutil_1.default.getSafeString(keystone_ep.hostname),
|
|
170
|
-
'port': k2hr3apiutil_1.default.
|
|
170
|
+
'port': k2hr3apiutil_1.default.isSafeString(keystone_ep.port) ? keystone_ep.port : 0,
|
|
171
171
|
'path': k2hr3apiutil_1.default.getSafeString(keystone_ep.pathname) + '/v3/auth/tokens',
|
|
172
172
|
'method': 'POST',
|
|
173
173
|
'headers': headers,
|
|
@@ -334,7 +334,7 @@ const rawGetUserUnscopedTokenByOstokenV3 = (ostoken, callback) => {
|
|
|
334
334
|
};
|
|
335
335
|
const options = {
|
|
336
336
|
'host': k2hr3apiutil_1.default.getSafeString(keystone_ep.hostname),
|
|
337
|
-
'port': k2hr3apiutil_1.default.
|
|
337
|
+
'port': k2hr3apiutil_1.default.isSafeString(keystone_ep.port) ? keystone_ep.port : 0,
|
|
338
338
|
'path': k2hr3apiutil_1.default.getSafeString(keystone_ep.pathname) + '/v3/auth/tokens',
|
|
339
339
|
'method': 'POST',
|
|
340
340
|
'headers': headers,
|
|
@@ -557,7 +557,7 @@ const rawGetUserScopedTokenV3 = (unscopedtoken, tenantid, callback) => {
|
|
|
557
557
|
};
|
|
558
558
|
const options = {
|
|
559
559
|
'host': k2hr3apiutil_1.default.getSafeString(keystone_ep.hostname),
|
|
560
|
-
'port': k2hr3apiutil_1.default.
|
|
560
|
+
'port': k2hr3apiutil_1.default.isSafeString(keystone_ep.port) ? keystone_ep.port : 0,
|
|
561
561
|
'path': k2hr3apiutil_1.default.getSafeString(keystone_ep.pathname) + '/v3/auth/tokens',
|
|
562
562
|
'method': 'POST',
|
|
563
563
|
'headers': headers,
|
|
@@ -817,7 +817,7 @@ const rawGetUserTenantListV3 = (unscopedtoken, userid, callback) => {
|
|
|
817
817
|
};
|
|
818
818
|
const options = {
|
|
819
819
|
'host': k2hr3apiutil_1.default.getSafeString(keystone_ep.hostname),
|
|
820
|
-
'port': k2hr3apiutil_1.default.
|
|
820
|
+
'port': k2hr3apiutil_1.default.isSafeString(keystone_ep.port) ? keystone_ep.port : 0,
|
|
821
821
|
'path': k2hr3apiutil_1.default.getSafeString(keystone_ep.pathname) + '/v3/users/' + _userid + '/projects',
|
|
822
822
|
'method': 'GET',
|
|
823
823
|
'headers': headers,
|
|
@@ -116,20 +116,22 @@ const rawIsValTypeUrlKeystoneEndpoint = (val) => {
|
|
|
116
116
|
if (!k2hr3apiutil_1.default.isPlainObject(val)) {
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
|
-
// check UrlWithStringQuery
|
|
120
|
-
if ((k2hr3apiutil_1.default.isSafeEntity(val.
|
|
119
|
+
// check URL (not same UrlWithStringQuery)
|
|
120
|
+
if ((k2hr3apiutil_1.default.isSafeEntity(val.origin) && !k2hr3apiutil_1.default.isString(val.origin)) ||
|
|
121
121
|
(k2hr3apiutil_1.default.isSafeEntity(val.href) && !k2hr3apiutil_1.default.isString(val.href)) ||
|
|
122
122
|
(k2hr3apiutil_1.default.isSafeEntity(val.protocol) && !k2hr3apiutil_1.default.isString(val.protocol)) ||
|
|
123
|
-
(k2hr3apiutil_1.default.isSafeEntity(val.
|
|
123
|
+
(k2hr3apiutil_1.default.isSafeEntity(val.username) && !k2hr3apiutil_1.default.isString(val.username)) ||
|
|
124
|
+
(k2hr3apiutil_1.default.isSafeEntity(val.password) && !k2hr3apiutil_1.default.isString(val.password)) ||
|
|
124
125
|
(k2hr3apiutil_1.default.isSafeEntity(val.host) && !k2hr3apiutil_1.default.isString(val.host)) ||
|
|
125
126
|
(k2hr3apiutil_1.default.isSafeEntity(val.hostname) && !k2hr3apiutil_1.default.isString(val.hostname)) ||
|
|
126
127
|
(k2hr3apiutil_1.default.isSafeEntity(val.port) && !k2hr3apiutil_1.default.isString(val.port)) ||
|
|
127
128
|
(k2hr3apiutil_1.default.isSafeEntity(val.pathname) && !k2hr3apiutil_1.default.isString(val.pathname)) ||
|
|
128
129
|
(k2hr3apiutil_1.default.isSafeEntity(val.search) && !k2hr3apiutil_1.default.isString(val.search)) ||
|
|
129
|
-
(k2hr3apiutil_1.default.isSafeEntity(val.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
(k2hr3apiutil_1.default.isSafeEntity(val.hash) && !k2hr3apiutil_1.default.isString(val.hash))) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
// check only type as object in URL
|
|
134
|
+
if (k2hr3apiutil_1.default.isSafeEntity(val.searchParams) && !k2hr3apiutil_1.default.isSafeEntity(val.searchParams)) {
|
|
133
135
|
return false;
|
|
134
136
|
}
|
|
135
137
|
// valTypeUrlKeystoneEndpoint
|
|
@@ -321,7 +323,7 @@ const rawTestKeystoneEndpoint = (epallmap, region, endpoint, is_v3, timeout, las
|
|
|
321
323
|
};
|
|
322
324
|
const options = {
|
|
323
325
|
'host': k2hr3apiutil_1.default.getSafeString(ep.hostname),
|
|
324
|
-
'port': k2hr3apiutil_1.default.
|
|
326
|
+
'port': k2hr3apiutil_1.default.isSafeString(ep.port) ? ep.port : 0,
|
|
325
327
|
'path': _is_v3 ? '/v3/auth/tokens' : '/v2.0/tokens',
|
|
326
328
|
'method': 'POST',
|
|
327
329
|
'headers': headers,
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k2hr3-api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "K2HR3 REST API is K2hdkc based Resource and Roles and policy Rules",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@kubernetes/client-node": "^1.4.0",
|
|
8
|
-
"body-parser": "^2.
|
|
9
|
-
"config": "^4.4.
|
|
8
|
+
"body-parser": "^2.3.0",
|
|
9
|
+
"config": "^4.4.2",
|
|
10
10
|
"cookie-parser": "~1.4.7",
|
|
11
11
|
"dateformat": "^5.0.3",
|
|
12
12
|
"debug": "~4.4.3",
|
|
13
13
|
"express": "^5.2.1",
|
|
14
|
-
"jose": "^6.2.
|
|
15
|
-
"k2hdkc": "^2.0.
|
|
16
|
-
"morgan": "~1.
|
|
14
|
+
"jose": "^6.2.3",
|
|
15
|
+
"k2hdkc": "^2.0.5",
|
|
16
|
+
"morgan": "~1.11.0",
|
|
17
17
|
"rotating-file-stream": "^3.2.9"
|
|
18
18
|
},
|
|
19
19
|
"directories": {
|
|
@@ -39,23 +39,23 @@
|
|
|
39
39
|
"@eslint/js": "^10.0.1",
|
|
40
40
|
"@types/body-parser": "^1.19.6",
|
|
41
41
|
"@types/chai": "^5.2.3",
|
|
42
|
-
"@types/config": "^
|
|
42
|
+
"@types/config": "^4.4.0",
|
|
43
43
|
"@types/cookie-parser": "^1.4.10",
|
|
44
44
|
"@types/dateformat": "^5.0.3",
|
|
45
|
-
"@types/debug": "^4.1.
|
|
45
|
+
"@types/debug": "^4.1.13",
|
|
46
46
|
"@types/express": "^5.0.6",
|
|
47
47
|
"@types/mocha": "^10.0.10",
|
|
48
48
|
"@types/morgan": "^1.9.10",
|
|
49
|
-
"@types/node": "^
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
51
|
-
"@typescript-eslint/parser": "^8.
|
|
49
|
+
"@types/node": "^26.1.0",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.62.1",
|
|
51
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
52
52
|
"chai": "^6.2.2",
|
|
53
53
|
"chai-http": "^5.1.2",
|
|
54
|
-
"eslint": "^10.0
|
|
55
|
-
"globals": "^17.
|
|
56
|
-
"mocha": "^11.7.
|
|
54
|
+
"eslint": "^10.6.0",
|
|
55
|
+
"globals": "^17.7.0",
|
|
56
|
+
"mocha": "^11.7.6",
|
|
57
57
|
"nyc": "^18.0.0",
|
|
58
|
-
"typescript": "^
|
|
58
|
+
"typescript": "^6.0.3"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"help": "echo 'command list:\n npm run build\n npm run build:all\n npm run build:copyfiles\n npm run build:files\n npm run clean\n npm run start\n npm run start:prod\n npm run start:production\n npm run start:prod:dbg\n npm run start:prod:debug\n npm run start:prod:debug:break\n npm run start:prod:debug:nobreak\n npm run start:dev\n npm run start:develop\n npm run start:dev:dbg\n npm run start:dev:debug\n npm run start:dev:debug:break\n npm run start:dev:debug:nobreak\n npm run start:watcher:prod\n npm run start:watcher:production\n npm run start:watcher:dev\n npm run start:watcher:develop\n npm run start:watcher:dbg\n npm run start:watcher:debug\n npm run start:watcher:debug:break\n npm run start:watcher:debug:nobreak\n npm run start:watcher:oneshot:prod\n npm run start:watcher:oneshot:production\n npm run start:watcher:oneshot:dev\n npm run start:watcher:oneshot:develop\n npm run start:watcher:oneshot:dbg\n npm run start:watcher:oneshot:debug\n npm run start:watcher:oneshot:debug:break\n npm run start:watcher:oneshot:debug:nobreak\n npm run stop\n npm run stop:watcher\n npm run test\n npm run test:lint\n npm run test:lint:all\n npm run test:lint:files\n npm run test:checktypes\n npm run test:cover\n npm run test:auto\n npm run test:auto:all{:dbg}\n npm run test:auto:version{:dbg}\n npm run test:auto:usertokens{:dbg}\n npm run test:auto:list{:dbg}\n npm run test:auto:resource{:dbg}\n npm run test:auto:policy{:dbg}\n npm run test:auto:role{:dbg}\n npm run test:auto:tenant{:dbg}\n npm run test:auto:service{:dbg}\n npm run test:auto:acr{:dbg}\n npm run test:auto:userdata{:dbg}\n npm run test:auto:extdata{:dbg}\n npm run test:auto:watcher{:dbg}\n npm run test:auto:templengine\n npm run test:auto:templengine:async\n npm run test:manual\n npm run test:manual:apis:version_get\n npm run test:manual:apis:usertoken_postput\n npm run test:manual:apis:usertoken_gethead\n npm run test:manual:apis:policy_postput\n npm run test:manual:apis:policy_gethead\n npm run test:manual:apis:policy_delete\n npm run test:manual:apis:resource_postput\n npm run test:manual:apis:resource_gethead\n npm run test:manual:apis:resource_delete\n npm run test:manual:apis:role_postput\n npm run test:manual:apis:role_gethead\n npm run test:manual:apis:role_delete\n npm run test:manual:apis:tenant_postput\n npm run test:manual:apis:tenant_gethead\n npm run test:manual:apis:tenant_delete\n npm run test:manual:apis:service_postput\n npm run test:manual:apis:service_gethead\n npm run test:manual:apis:service_delete\n npm run test:manual:apis:acr_postput\n npm run test:manual:apis:acr_get\n npm run test:manual:apis:acr_delete\n npm run test:manual:apis:list_gethead\n npm run test:manual:apis:userdata_get\n npm run test:manual:apis:extdata_get\n npm run test:manual:apis:allusertenant_get\n npm run test:manual:apis:k2hr3keys_get\n npm run test:manual:load:k2hdkcdata:auto\n npm run test:manual:load:k2hdkcdata:local\n npm run test:manual:templengine\n npm run test:manual:templengine:async\n'",
|