Skip to content

build-system: Restrict allowed version_override#27687

Merged
kristoferbaxter merged 1 commit intoampproject:masterfrom
mdmower:pr-versionstr
Apr 10, 2020
Merged

build-system: Restrict allowed version_override#27687
kristoferbaxter merged 1 commit intoampproject:masterfrom
mdmower:pr-versionstr

Conversation

@mdmower
Copy link
Copy Markdown
Contributor

@mdmower mdmower commented Apr 10, 2020

Version must be 13 digits. Combined with a 2-digit config code, this
implies RTVs must be 15 digits.

Fixes #27579

Version must be 13 digits. Combined with a 2-digit config code, this
implies RTVs must be 15 digits.

Fixes ampproject#27579
@mdmower
Copy link
Copy Markdown
Contributor Author

mdmower commented Apr 10, 2020

@ampproject/wg-infra


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unnecessary. minimist should parse --version_override whatever as version_override: 'whatever' by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary. I only added it after testing.

return String(argv.version_override);
const version = String(argv.version_override);
// #27579: What are allowed version strings...?
if (!/^\d{13}$/.test(version)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Pull the version regex out into a constant for easier updating

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree here, but lets get this in and follow up with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion: What are allowed version strings when self-hosting the runtime?

7 participants