Skip to content

fix(appconfig): prevent panic when YAML config has non-string map keys (fixes #5258) - #5304

Open
siddiqueirshad wants to merge 1 commit into
superfly:masterfrom
siddiqueirshad:fix/issue-5258-yaml-non-string-keys
Open

siddiqueirshad wants to merge 1 commit into
superfly:masterfrom
siddiqueirshad:fix/issue-5258-yaml-non-string-keys

Conversation

@siddiqueirshad

Copy link
Copy Markdown

Summary

Fixes #5258.

When loading an application configuration from YAML (such as via fly config validate -c fly.yaml or fly deploy), stringifyYAMLMapKeys previously performed a direct type-assertion (k.(string)) when converting map[any]any keys to string. If a YAML configuration contains non-string keys (e.g. integer or boolean keys in an env: section like 1: one or true: yes), this caused flyctl to crash with:

panic: interface conversion: interface {} is int, not string

Changes

  • internal/appconfig/serde.go: Use fmt.Sprint(k) instead of k.(string) when building newmap from map[any]any so that all YAML keys are consistently stringified without panic.
  • internal/appconfig/serde_test.go: Added TestLoadYAMLAppConfigWithNonStringKeys to verify that YAML configurations with non-string map keys load cleanly without panic and parse into both *Config and map[string]any.

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.

Loading a YAML app config with a non-string map key panics

1 participant