Skip to content

db: widen vm_template.url to 2048 to match registerTemplate and registerIso - #14723

Open
stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-vm-template-url-length
Open

stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-vm-template-url-length

Conversation

@stag7824

Copy link
Copy Markdown
Contributor

Description

Fixes #14715

registerTemplate and registerIso declare url with length = 2048, and VMTemplateVO maps the column with length = 2048, but vm_template.url itself is VARCHAR(1024): #8675 widened it from 255 to 1024 in schema-41900to41910.sql, and nothing changed it since. A URL of 1025 to 2048 characters therefore passes the API's length check and then fails when the template row is written. S3 presigned URLs signed with temporary credentials are usually in that range because of the X-Amz-Security-Token.

This widens the column to 2048 in schema-42210to42220.sql, with the same statement shape and column comment as the 4.19.1 change, so the column matches the API parameter and the VO, and the sibling URL columns that were widened to 2048 before (for example template_store_ref.download_url in schema-42200to42210.sql).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • Minor

How Has This Been Tested?

On MySQL 8.0.46 (default sql_mode, including STRICT_TRANS_TABLES), with vm_template.url as it is after 4.19.1 and a 1701-character presigned-style URL:

before:  ERROR 1406 (22001) at line 1: Data too long for column 'url' at row 1
after:   inserted, LENGTH(url) = 1701, column is varchar(2048) with its comment kept

The statement was applied twice to check that rerunning it is harmless, and a view selecting url kept working.

To check the change can't hit MySQL's row size limit during upgrade, I also applied it to the full vm_template definition: the create-schema.sql table in utf8 plus every column added to it by later upgrade scripts (40 columns). The ALTER succeeded.

I haven't run a full management server upgrade with it.

…terIso

The url parameter of registerTemplate and registerIso and VMTemplateVO allow
2048 characters, but the column was widened only to 1024 in 4.19.1, so a URL
of 1025 to 2048 characters (for example an S3 presigned URL signed with
temporary credentials) passed validation and failed on insert.

Fixes apache#14715

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant