-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rein in message passing to Object
in collection config
#134
Comments
Traceback of the case where this makes the API output a lot of stuff on any /api access:
(that |
ping @jntullo, the outstanding issue we have with the normalizer where the recursion is not calling normalize_hash with the type might be the reason why these exceptions are happening in collection config [] in the first place. Can you take a look ? in which case with your fix we could actually remove the above rescue. Thanks. |
@abellotti I did investigate this, and for the cases that I saw, the type is being passed in, because it is the name of the attribute. |
remove that rescue and run the automate_specs rspecs, you'll see that exception in action. |
@chrisarcand @himdel I think the discussion in #83 (comment) is relevant in here. My proposal is if we merge ManageIQ/manageiq#16138 we can go ahead and remove the calling code that is causing us to send all these messages to |
IMO the problem is a bit further away: By using That sounds like a recipe for disaster for any use :). (Unless I'm missing something?) |
As I mentioned in the blacklist PR, replacing that gem is very likely not trivial unless @Fryguy can give some other insight. A solution such as the blacklist or what @imtayadeway is describing seems appropriate for now (and perhaps permanently) |
Yeah, it's non-trivial to replace that gem. config gem has an internal blacklist, and they are pretty good about accepting PRs to update it. I could also see having our own blacklist in Vmdb::Settings, which is easier to update in a pinch, and then we can add some kind of spec that ensures that people don't add keys to the config that are blacklisted. I don't think this is the API's concern to be doing the blacklisting. |
I thought I had an open issue for this, but one of my "future plans" with settings.yml is to have some kind of validation on it, so that people touching Advanced Settings can't break the system. So, we would have a way to walk the entire settings, validate against a whitelist of acceptable keys and perhaps values, or value types, as well. Closest I could find was this comment I made a while ago in a BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1358433#c3 . |
@Fryguy the issue isn't that those keys are added to the config, it's that we may be checking to see if |
If you are just checking for the presence of a key, then perhaps The method to_h just returns a Hash of the keys, which you can then use as a lookup table. |
manageiq-api/lib/api/collection_config.rb
Lines 7 to 13 in c5cc04a
As brought up on Gitter by @himdel, we should rein in how we handle the issue fixed by this rescue. We're currently still sending the message (calling the method) unrestricted on the config object, so you can send things like
display
(which writes to stdout), etc. That's less than ideal.At the very least, if this is indeed the best solution, I wonder what error is being rescued here.
The text was updated successfully, but these errors were encountered: