- Maniphest Tasks
- T175186: Blubber config input validation
thcipriani hashar Jrbranaa Joe mobrovac
- Group Reviewers
- rGBLBR1d8f07a35c5a: Validate configuration after unmarshalling
- Patch without arc
- git checkout -b D868 && curl -L https://phabricator.wikimedia.org/D868?download=true | git apply
Run the unit tests and try running blubber against some bad config.
Everything seems to work as intended, I have a few thoughts/questions inline about your intentions, but overall works well!
It's also kind of confusing to me why you don't have to include gopkg.in/go-playground/validator.v9 to use things like dive in structs(?), but it seems to work without it...
May consider some validation for UID/GID for the sake of prettier messages:
Unclear if you're testing to ensure the path isn't the root path, or if you're testing to ensure the path doesn't include any relative elements. FWIW, path.IsAbs("/foo/bar/..") == true, so relative elements are fine (which I think is fine, just want to clarify with you that this is a test about / not about ..)
hrm, this prevents installing specific versions of a package, e.g., scap=3.7.0-1. Not sure if that's a problem.
very nice :)
I would have except that handling of unmarshalling errors preempt the validator. By the time the validations run, the input for those fields should be jolly good.
Right, I was more concerned with testing that the validator can't be fooled with relative path components.
Ooooh, true dat. I'll integrate versions into the pattern.
Nothing like nerding out on some IEEE docs. :)