serviceability: validate device mgmt_vrf field#3881
Merged
Conversation
Constrain mgmt_vrf to the account-code charset and a 32-byte cap in Device::validate, matching how the device code is bounded. The controller skips rendering device config when a string field contains characters that would not survive as a single config token. Move setup_device_prerequisites into test_helpers for reuse.
martinsander00
approved these changes
Jun 12, 2026
ben-malbeclabs
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mgmt_vrffield inDevice::validate: restrict it to the account-code charset ([A-Za-z0-9:_-]) and cap it at 32 bytes, matching how the devicecodeis already bounded. Empty is still accepted (the default VRF).setup_device_prerequisitesfromdevice_onchain_allocation_test.rsintotest_helpers.rsso the new test reuses it.Testing Verification
mgmt_vrfacross all existing devices on mainnet-beta, testnet, and devnet — every value ("",default,MGMT,mgmt,management) passes the new rule, so theDevice::validatecheck applies cleanly to deployed accounts.Custom(19)) and over-length (Custom(34)) values, a failed update leaves the stored value unchanged, and empty/valid values round-trip.