-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Mask rule #2433
Mask rule #2433
Conversation
This implementation does indeed require the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a really nice improvement!
@dkiser thanks for adding the upsert support! I tried it out this morning and it works nicely. We should adjust some of the error handling though IMO.
Re: (2), I could imagine some users wanting OPA to fail if the path is undefined. I think we can add support for this later if necesarry, either via config or by extending the instructions. |
@dkiser let us know if you can work on those remaining comments around error handling in the next week or so. If not, we can take on those changes so that this lands in the next release. |
@tsandall I'll find some time over the next couple of days and see about addressing those last two comments. Thanks! |
@tsandall Re: (2), Do we mean that an upsert to an undefined path for an undefined object type to fail silently? I think we want to keep the ability to upsert to an undefined path for a defined upsert object type, which right now it just a Do you have an existing unit test case to point to that behavior should be changed on? |
@dkiser you're right. The term undefined is not accurate here. I'm referring to this line: https://github.com/open-policy-agent/opa/pull/2433/files#diff-dee023b2dcf1c8c236bac28d4d4fd7b8R189. In the upsert implementation, if the path refers to a non-object intermediate value, it will result in an error being logged. OTOH, in the remove implementation, if the path refers to a non-object intermediate value, it's treated as undefined and ignored. The behaviour should be consistent. I suggest we remove that error and simply treat the upsert as undefined in this case. |
@tsandall Can you take a gander at the last commit. I agree with the configurable option for undefined object path handling (silent or some kind of decision log error) and added low level error handling for this in the mask rule that can be used in a later PR at the Let me know if this new commit addresses your concerns. Thanks! |
@dkiser this looks good! Can you please squash your commits and format the message according to these guidelines. Once that's done we can merge this. |
…erase masking feature. This feature adds the ability to mutate decision logs in addition to the default behavior of erasing object paths. A new upsert command was added to a structured way to define mask rules in a backwards compatible manner. Fixes: open-policy-agent#2379 Signed-off-by: Domingo Kiser <domingo.kiser@gmail.com>
@tsandall Done. Thanks for all the help thus far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #2379
This is an initial attempt at enhancing decision log masks by providing a new structured format for mask rules that allow either erasing or modifying input objects. Backwards compatibility is maintained with the original mask rule format.