Skip to content

Commit

Permalink
build-system: Restrict allowed version_override (#27687)
Browse files Browse the repository at this point in the history
Version must be 13 digits. Combined with a 2-digit config code, this
implies RTVs must be 15 digits.

Fixes #27579
mdmower authored Apr 10, 2020
1 parent d227019 commit bcd3da4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions build-system/compile/internal-version.js
Original file line number Diff line number Diff line change
@@ -15,12 +15,22 @@
*/
'use strict';

const argv = require('minimist')(process.argv.slice(2));
const minimist = require('minimist');
const {gitCommitFormattedTime} = require('../common/git');

// Allow leading zeros in --version_override, e.g. 0000000000001
const argv = minimist(process.argv.slice(2), {
string: ['version_override'],
});

function getVersion() {
if (argv.version_override) {
return String(argv.version_override);
const version = String(argv.version_override);
// #27579: What are allowed version strings...?
if (!/^\d{13}$/.test(version)) {
throw new Error('--version_override only accepts a 13-digit version');
}
return version;
} else {
// Generate a consistent version number by using the commit* time of the
// latest commit on the active branch as the twelve digits. The last,

0 comments on commit bcd3da4

Please sign in to comment.