mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 01:46:46 +00:00
bugfix(auth): Update authentication logic in settings.xml, unit tests, and documentation examples
To resolve this, we've made significant updates to the logic within settings.xml for better handling of authentication information. Additionally, unit tests have been updated to reflect these changes and ensure robust verification. The documentation and examples have also been revised to provide clearer guidance on configuring and utilizing this updated process successfully.
This commit is contained in:
parent
9704b39bf2
commit
c6b8c532e9
5 changed files with 66 additions and 20 deletions
20
dist/setup/index.js
vendored
20
dist/setup/index.js
vendored
|
@ -122463,9 +122463,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.generate = exports.createAuthenticationSettings = exports.configureAuthentication = void 0;
|
||||
const path = __importStar(__nccwpck_require__(71017));
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
const io = __importStar(__nccwpck_require__(47351));
|
||||
const path = __importStar(__nccwpck_require__(71017));
|
||||
const fs = __importStar(__nccwpck_require__(57147));
|
||||
const os = __importStar(__nccwpck_require__(22037));
|
||||
const xmlbuilder2_1 = __nccwpck_require__(70151);
|
||||
|
@ -122507,7 +122507,19 @@ function createAuthenticationSettings(id, username, password, settingsDirectory,
|
|||
}
|
||||
exports.createAuthenticationSettings = createAuthenticationSettings;
|
||||
// only exported for testing purposes
|
||||
function escapeXml(unsafeStr) {
|
||||
return unsafeStr
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
function generate(id, username, password, gpgPassphrase) {
|
||||
const escapedUsername = escapeXml(username);
|
||||
const escapedPassword = escapeXml(password);
|
||||
let escapedGpgPassphrase = gpgPassphrase
|
||||
? escapeXml(gpgPassphrase)
|
||||
: undefined;
|
||||
const xmlObj = {
|
||||
settings: {
|
||||
'@xmlns': 'http://maven.apache.org/SETTINGS/1.0.0',
|
||||
|
@ -122517,8 +122529,8 @@ function generate(id, username, password, gpgPassphrase) {
|
|||
server: [
|
||||
{
|
||||
id: id,
|
||||
username: `\${env.${username}}`,
|
||||
password: `\${env.${password}}`
|
||||
username: escapedUsername,
|
||||
password: escapedPassword
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -122527,7 +122539,7 @@ function generate(id, username, password, gpgPassphrase) {
|
|||
if (gpgPassphrase) {
|
||||
const gpgServer = {
|
||||
id: 'gpg.passphrase',
|
||||
passphrase: `\${env.${gpgPassphrase}}`
|
||||
passphrase: escapedGpgPassphrase
|
||||
};
|
||||
xmlObj.settings.servers.server.push(gpgServer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue