Skip to content

fix: parsing vApp properties while converting from OVF envelope to VM ConfigSpec#3964

Merged
tenthirtyam merged 1 commit into
vmware:mainfrom
hpannem:issue-3963
Feb 24, 2026
Merged

fix: parsing vApp properties while converting from OVF envelope to VM ConfigSpec#3964
tenthirtyam merged 1 commit into
vmware:mainfrom
hpannem:issue-3963

Conversation

@hpannem

@hpannem hpannem commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

When building a VmConfigSpec from an OVF envelope (Envelope.toVAppConfig), vApp property default values were assigned verbatim from the parsed OVF without any type-aware processing. This caused a correctness bug for boolean properties: the OVF envelope uses lowercase "true" / "false", but the vSphere API requires the canonical forms "True" / "False".

This change introduces ovf/vappconfig_parser.go, which implements type-aware parsing and validation of vApp property values for all OVF property types defined in DSP0004/DSP0243:

Type Behaviour
boolean Normalises to "True" / "False"
int Validates as signed int32; rejects non-numeric or out-of-range values
real Validates as float64; rejects non-numeric values
ip Validates as a valid IPv4 or IPv6 address
string / password Enforces the 64k maximum length
string(N..M) / password(N..M) Enforces minimum and/or maximum character length constraints
int(N..M) Enforces numeric range constraints (signed and unsigned)
real(N..M) Enforces floating-point range constraints
ip:network, expression, unknown Passed through unchanged (pending future work)

Password-typed properties are handled with care: error messages never include the property value to avoid leaking secrets in logs.

Envelope.toVAppConfig now returns an error if any property value fails validation, surfacing problems at config-spec construction time rather than silently passing bad values to vSphere.

Closes: #3963

How Has This Been Tested?

Unit tests added in ovf/vappconfig_parser_test.go covering:

  • All basic types (string, password, boolean, int, real, ip, ip:network, expression, unknown)
  • All constrained type variants (string(..N), string(N..), string(M..N), int(M..N), real(M..N), password(..N), password(N..), password(M..N))
  • Boundary values (min, max, exact) for all range-constrained types
  • Invalid values, out-of-range values, and malformed inputs for all types
  • Explicit verification that no password value appears in any error message

go test ./ovf/...
ok github.com/vmware/govmomi/ovf 0.403s
ok github.com/vmware/govmomi/ovf/importer 0.198s

@hpannem hpannem force-pushed the issue-3963 branch 3 times, most recently from fa75724 to 5cf5513 Compare February 22, 2026 05:41
Comment thread ovf/vappconfig_parser_test.go Outdated

@tenthirtyam tenthirtyam left a comment

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.

Commit sign-off should use your broadcom.com email.

@hpannem

hpannem commented Feb 23, 2026

Copy link
Copy Markdown
Contributor Author

Commit sign-off should use your broadcom.com email.

Done.

@hpannem hpannem requested review from akutz and tenthirtyam February 23, 2026 22:11
@tenthirtyam

Copy link
Copy Markdown
Contributor

I'll fix the issue blocking the CI in another PR in the morning.

…pe to VM ConfigSpec

Signed-off-by: Hemanth kumar Pannem <hemanth-kumar.pannem@broadcom.com>
@tenthirtyam tenthirtyam changed the title fix: Fix for parsing vApp properties while converting from OVF envelope to VM ConfigSpec fix: parsing vApp properties while converting from OVF envelope to VM ConfigSpec Feb 24, 2026
@tenthirtyam tenthirtyam merged commit a8ff1b1 into vmware:main Feb 24, 2026
11 of 15 checks passed
@hpannem hpannem deleted the issue-3963 branch February 24, 2026 05:51
aruneshpa pushed a commit to aruneshpa/govmomi that referenced this pull request Mar 17, 2026
… ConfigSpec(vmware#3964)

Signed-off-by: Hemanth kumar Pannem <hemanth-kumar.pannem@broadcom.com>
aruneshpa pushed a commit to aruneshpa/govmomi that referenced this pull request Mar 17, 2026
… ConfigSpec(vmware#3964)

Signed-off-by: Hemanth kumar Pannem <hemanth-kumar.pannem@broadcom.com>
aruneshpa pushed a commit to aruneshpa/govmomi that referenced this pull request Mar 17, 2026
… ConfigSpec(vmware#3964)

Signed-off-by: Hemanth kumar Pannem <hemanth-kumar.pannem@broadcom.com>
aruneshpa pushed a commit to aruneshpa/govmomi that referenced this pull request Mar 17, 2026
… ConfigSpec(vmware#3964)

Signed-off-by: Hemanth kumar Pannem <hemanth-kumar.pannem@broadcom.com>
Signed-off-by: Arunesh Pandey <arunesh-kumar.pandey@broadcom.com>
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.

[BUG] Creating a VirtualMachineConfigSpec from an OVF envelope (Envelope.ToConfigSpec) results in incorrect ConfigSpec

3 participants