AbstractScopedSettings validates against unknown settings, and that validation reflects where we read the setting's value from (so the error message says "unknown setting" or "unknown secure setting" depending on context).
However, we only validate whether a setting is "known", we don't validate whether it has been added to the correct file.
This means, for example the following does not produce any errors (but really ought to)
echo maybe | bin/elasticsearch-keystore add node.master
bin/elasticsearch