mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
bugfix(auth): Update authentication logic in settings.xml, unit tests, and documentation examples
To address this issue, we've implemented substantial enhancements to the logic within settings.xml to improve the management of authentication data. Furthermore, we've updated the unit tests to align with these modifications, guaranteeing thorough validation. The documentation and examples have been meticulously revised to offer more straightforward instructions on how to effectively configure and employ this updated methodology.
This commit is contained in:
parent
9704b39bf2
commit
0185e0f794
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