balena-os / balena-supervisor

Balena Supervisor: balena's agent on devices.
https://balena.io
Other
150 stars 63 forks source link

Supervisor may in certain cases allow applying of invalid config.txt `gpio` configs, such as `17=op,dh:27=op,dl:22=op,dl:24=op,dl` #2384

Open cywang117 opened 2 weeks ago

cywang117 commented 2 weeks ago

Colon-separated configs are not an officially supported format for gpio configuration and are not mentioned anywhere in the official config.txt docs.

It's been observed in certain unclear circumstances, the Supervisor will allow application and writing of an invalid colon-separated config such as 17=op,dh:27=op,dl:22=op,dl:24=op,dl to config.txt. SV version of the observed device was 16.4.6, so there's a potential bug here.

It's unclear why this only happens sometimes and causes an error loop at other times.

pipex commented 1 week ago

I don't think the supervisor validates configuration keys other than forbidding some keys from a list. I imagine if the colon separated key is coming from the API/or via the local endpoint, the supervisor will allow it. I don't see that as a bug. I may be misunderstanding the issue though

cywang117 commented 1 week ago

@pipex The issue I have observed is that setting such a config causes a Apply boot config in progress...Apply boot config success loop, in 2/3 cases observed on devices. This is the bug I was referring to. However there was also a custom splash image set, which may confound the issue and/or may have been related to the loop behavior. I'll try to reproduce and update