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
Filter everything when whitelist is empty #781
Conversation
|
As long as we are okay with the log message: then I think this is good |
|
@shawn-hurley is that log actually all one line? Because it's totally unreadable in that form. I do think we should continue to |
| @@ -192,7 +192,11 @@ func applyMatchSets( | |||
| filteredVals := []string{} | |||
| totalSet := toMatchSetT(totalList) | |||
|
|
|||
| if len(whiteMatchSet) != 0 && len(blackMatchSet) != 0 { | |||
| if len(whiteMatchSet) == 0 { | |||
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.
I am concerned with this change. There is an intended use-case for specifying only a blacklist. You are saying you want to accept everything except those that don't pass my blacklist filter.
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.
What I could do is default the white_list to ".*" if only black_list exists.
|
My understanding was that we filtered NOTHING, and that you can use the white and black lists to filter things as you choose. my registry contents
========================= whitelist EMPTY
========================= whitelist EMPTY
========================= whitelist -apb
========================= whitelist -apb
========================= whitelist EMPTY EVERYTHING FILTERED |
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.
NACK I don't want to do this. We should not require you to enter a whitelist entry.
This is not the case. We default to closed and no apb's show up. apbs are opt in. This was an ask of the security team. |
|
@jmrodri My view was the opposite. I thought for security purposes we wanted to allow nothing. |
This is the case I'm concerned with. It's a legitimate use-case to want to blacklist X, but accept everything else. We should be smart enough to ignore |
|
@eriknelson if we saying APBs are opt in, which was the ask, then I think it follows that you can't just add a blacklist and that defaults to letting everything in. I could be wrong on this one but I do think this is the case. Also re: the log yes that is all one line for me. |
Not ideal to add an extra config option, but this would do the trick. black_list:
- ".*-apb$"
white_list:
- ".*"
We check for the APB label, but that is outside the whitelist/blacklist filter |
There was no original ask or requirement. I personally implemented the filters in the way that I felt appropriate. If you only specify a |
So is there currently a security risk that we need to fix? I didn't think there was, I believe this all stems from the removal of the hard-coded I still think that leaving them empty shows everything. From an ease of use and configuration. I only want to learn enough regex to lock things down, not to open everything up. If I want to extra paranoid in my corporate deployment, I can come up with a naming strategy that I approve. Then whitelist those. And blacklist everything else. If I'm in a development shop, I just leave them empty and see everything. If the user wants to block everything for some reason, we have given them a mechanism to do that. |
|
|
|
@eriknelson I think that is correct that you initially implemented in the way described. When we were discussing security changes with security team, they asked that we make the APBs default to empty if no whitelist and blacklist. Here is the PR for that change #411 |
|
So, if you guys are willing to change the current behavior (and possibly break some users), I would go with the With the Using |
|
Given the feedback on the issue, we going with opt-in. This PR will enable opt-in so I'll change the docs to reflect this behavior. |
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.
I'll approve once the doc comments are updated to match the opt-in workflow
|
@eriknelson @shawn-hurley docs were updated, please re-review. |
|
@shawn-hurley @jmrodri @eriknelson Do you think we should backport this? |
* Filter everything when whitelist is empty * update docs
Describe what this PR does and why we need it:
We currently filter nothing when blacklist is empty and whitelist is empty.
Another way of saying this is if I have this whitelist config:
In my registry I have nothing that ends in
*-apb. The result is that everything goes unfiltered.Changes proposed in this pull request
Which issue this PR fixes (This will close that issue when PR gets merged)
fixes: #745
fixes: ansibleplaybookbundle/ansible-playbook-bundle#215