Skip to content

Commit 9a2f57e

Browse files
committed
Merge branch 'revert-522645a3' into 'main'
Revert "Merge branch 'wrc-label-fix' into 'main'" See merge request weblogic-cloud/weblogic-toolkit-ui!305
2 parents 522645a + ab2cf57 commit 9a2f57e

File tree

189 files changed

+31571
-16736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+31571
-16736
lines changed

THIRD_PARTY_LICENSES.txt

Lines changed: 2379 additions & 1865 deletions
Large diffs are not rendered by default.

documentation/1.7/content/release/release-1.6.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Release 1.6.0"
2+
title = "Release Notes 1.6.0"
33
date = 2022-11-03T12:48:00-05:00
44
weight = 90
55
pre = "<b> </b>"

documentation/1.7/content/release/release-1.6.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
22
title = "Release 1.6.3"
33
date = 2022-11-03T12:48:00-05:00
4-
weight = 87
4+
weight = 88
55
pre = "<b> </b>"
66
+++
77

electron/.eslintrc.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es2021": true
6+
},
7+
"extends": "eslint:recommended",
8+
"parserOptions": {
9+
"ecmaVersion": 2022
10+
},
11+
"rules": {
12+
"indent": [
13+
"error",
14+
2,
15+
{
16+
"SwitchCase": 1
17+
}
18+
],
19+
"quotes": [
20+
"error",
21+
"single"
22+
],
23+
"semi": [
24+
"error",
25+
"always"
26+
],
27+
"no-unused-vars": [
28+
"warn"
29+
]
30+
}
31+
}

electron/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
/Library
1010
/.env
1111
/app/webui.json
12-
/app/locales/en/*.missing.json
1312
/coverage

electron/app/js/credentialEncryptor.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
* Copyright (c) 2021, Oracle and/or its affiliates.
44
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
6-
const {
7-
createCipheriv,
8-
createDecipheriv,
9-
pbkdf2Sync,
10-
randomBytes
11-
} = require('node:crypto');
6+
const crypto = require('crypto');
127
const zlib = require('zlib');
138

149
const _ivLength = 16;
@@ -25,11 +20,11 @@ class CredentialEncryptor {
2520
}
2621

2722
getEncryptedText(clearText) {
28-
const salt = randomBytes(_saltLength);
23+
const salt = crypto.randomBytes(_saltLength);
2924
const derivedKey = this._getDerivedKey(salt);
3025

31-
const iv = randomBytes(_ivLength);
32-
const cipher = createCipheriv(_encryptionAlgorithm, derivedKey, iv);
26+
const iv = crypto.randomBytes(_ivLength);
27+
const cipher = crypto.createCipheriv(_encryptionAlgorithm, derivedKey, iv);
3328
const encrypted = Buffer.concat([ cipher.update(clearText, 'utf8'), cipher.final() ]);
3429
let authTag = cipher.getAuthTag();
3530

@@ -44,7 +39,7 @@ class CredentialEncryptor {
4439
const salt = Buffer.from(data.salt, 'base64');
4540
const derivedKey = this._getDerivedKey(salt);
4641

47-
const decipher = createDecipheriv(_encryptionAlgorithm, derivedKey, iv);
42+
const decipher = crypto.createDecipheriv(_encryptionAlgorithm, derivedKey, iv);
4843
decipher.setAuthTag(authTag);
4944
const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
5045
return decrypted.toString('utf8');
@@ -53,7 +48,7 @@ class CredentialEncryptor {
5348
_getDerivedKey(salt) {
5449
// derive key with password and salt
5550
// keylength adheres to the "ECRYPT-CSA Recommendations" on "www.keylength.com"
56-
return pbkdf2Sync(this.passphrase, salt, _iterations, _keyLength, _digestAlgorithm);
51+
return crypto.pbkdf2Sync(this.passphrase, salt, _iterations, _keyLength, _digestAlgorithm);
5752
}
5853

5954
_packCipherData(authTag, content, iv, salt) {

electron/app/js/credentialManager.js

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates.
44
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
66
const CredentialEncryptor = require('./credentialEncryptor');
@@ -9,6 +9,7 @@ const { getLogger } = require('./wktLogging');
99

1010
const DECRYPTION_FAILED_STRING = 'Unsupported state or unable to authenticate data';
1111

12+
/* global Buffer */
1213
class CredentialManager {
1314
constructor(credentialStorePolicy) {
1415
this.credentialStorePolicy = credentialStorePolicy;
@@ -56,17 +57,63 @@ class CredentialManager {
5657
refObj.reference = { };
5758
}
5859
const cipherText = refObj.reference[refObj.field];
59-
if (cipherText) {
60-
refObj.reference[refObj.field] = await this.manager.loadCredential(jsonPath, cipherText);
61-
} else {
62-
logger.debug('Failed to load credential from %s so skipping it', jsonPath);
63-
}
60+
refObj.reference[refObj.field] = await this.manager.loadCredential(jsonPath, cipherText);
6461
}
6562
}
6663
return Promise.resolve(loadedProject);
6764
}
6865
}
6966

67+
class CredentialStoreManager extends CredentialManager {
68+
constructor(projectGuid) {
69+
super('native');
70+
const CredentialStore = require('./credentialStore');
71+
72+
this.projectGuid = projectGuid;
73+
this.credentialStore = new CredentialStore();
74+
super.credentialManager = this;
75+
}
76+
77+
get credentialStoreType() {
78+
return super.credentialStoreType;
79+
}
80+
81+
async storeCredentials(project) {
82+
return super.storeCredentials(project);
83+
}
84+
85+
async loadCredentials(project) {
86+
return super.loadCredentials(project);
87+
}
88+
89+
async storeCredential(jsonPath, clearText) {
90+
return new Promise((resolve, reject) => {
91+
if (clearText) {
92+
this.credentialStore.storeCredential(this._getCredentialName(jsonPath), clearText)
93+
.then(() => resolve())
94+
.catch(err => reject(new Error(`Failed to save credential for ${jsonPath}: ${err}`)));
95+
} else {
96+
this.credentialStore.deleteCredential(this._getCredentialName(jsonPath))
97+
.then(() => resolve())
98+
.catch(err => reject(new Error(`Failed to delete empty credential for ${jsonPath}: ${err}`)));
99+
}
100+
});
101+
}
102+
103+
// eslint-disable-next-line no-unused-vars
104+
async loadCredential(jsonPath, cipherText) {
105+
return new Promise((resolve, reject) => {
106+
this.credentialStore.getCredential(this._getCredentialName(jsonPath))
107+
.then(clearText => resolve(clearText))
108+
.catch(err => reject(new Error(`Failed to load credential for ${jsonPath}: ${err}`)));
109+
});
110+
}
111+
112+
_getCredentialName(jsonPath) {
113+
return Buffer.from(`${this.projectGuid}:${jsonPath}`, 'utf8').toString('base64');
114+
}
115+
}
116+
70117
class EncryptedCredentialManager extends CredentialManager {
71118
static BAD_PASSPHRASE_KEY = 'Incorrect passphrase';
72119

@@ -152,5 +199,6 @@ class CredentialNoStoreManager extends CredentialManager {
152199

153200
module.exports = {
154201
CredentialNoStoreManager,
202+
CredentialStoreManager,
155203
EncryptedCredentialManager
156204
};

electron/app/js/credentialStore.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright (c) 2021, Oracle and/or its affiliates.
44
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
6-
// eslint-disable-next-line no-redeclare
76
const { name } = require('../../package.json');
87
const { getLogger } = require('./wktLogging');
98

electron/app/js/fsUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ function getExecutableFilePath(exeName, mode) {
209209
let resolvedPath;
210210
try {
211211
resolvedPath = which.sync(exeName);
212-
} catch {
212+
} catch (err) {
213213
// not found...
214214
if (osUtils.isMac() && mode === 'exe') {
215215
try {
216216
resolvedPath = which.sync(exeName, { path: '/usr/local/bin' });
217-
} catch {
217+
} catch (nestedErr) {
218218
// still not found...
219219
}
220220
}

electron/app/js/githubUtils.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
'use strict';
77

88
const { HttpsProxyAgent } = require('https-proxy-agent');
9-
10-
// Node.js now has a built-in fetch implementation but it does not appear to
11-
// support proxies so let's stick with node-fetch for now...
12-
//
13-
// eslint-disable-next-line no-redeclare
149
const fetch = require('node-fetch');
1510

1611
// WARNING: This file contains functions that are called by build scripts

0 commit comments

Comments
 (0)