Skip to content
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

Be more strict with access resource titles / ACL syntax #324

Merged
merged 4 commits into from
Jan 25, 2022
Merged

Conversation

smortex
Copy link
Member

@smortex smortex commented Sep 16, 2021

The openldap_access resource allows a lot of variations in the title for
declaring a resource, making it possible to skip passing parameters such
as what and suffix. This flexibility however can confuse Puppet
when it is prefetching resources, leading to catalog compilation
failures.

Impose a more strict format for resource titles, and validate it with
tighter custom types to raise a hopefully meaningful error instead of a
Ruby error because something borked bad.

Fixes #294

@smortex smortex linked an issue Sep 16, 2021 that may be closed by this pull request
@smortex smortex changed the title Add unit test for openldap_access olc provider Be more strict with resource titles Oct 7, 2021
@smortex smortex force-pushed the 294 branch 3 times, most recently from 0c68141 to b2c1130 Compare October 7, 2021 22:23
@smortex smortex changed the title Be more strict with resource titles Be more strict with access resource titles Oct 7, 2021
@smortex smortex marked this pull request as ready for review October 7, 2021 22:45
Copy link
Member

@ghoneycutt ghoneycutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that the type aliases need some simple tests.

types/access_hash.pp Outdated Show resolved Hide resolved
@smortex smortex force-pushed the 294 branch 3 times, most recently from 3dc0735 to 7bd61bb Compare December 9, 2021 00:50
types/access_title.pp Outdated Show resolved Hide resolved
types/access_rule.pp Outdated Show resolved Hide resolved
The openldap_access resource allows a lot of variations in the title for
declaring a resource, making it possible to skip passing parameters such
as `what` and `suffix`.  This flexibility however can confuse Puppet
when it is prefetching resources, leading to catalog compilation
failures.

Impose a more strict format for resource titles, and validate it with
tighter custom types to raise a hopefully meaningful error instead of a
Ruby error because something borked bad.
@smortex
Copy link
Member Author

smortex commented Jan 24, 2022

I rebased these changes on top of master, squashed the minor fixes that where added part of previous reviews, and added a new commit to address the final issue that worried me with this change.

Can I have a review please?

@smortex smortex changed the title Be more strict with access resource titles Be more strict with access resource titles / ACL syntax Jan 24, 2022
The role of these rumbers was to allow multiple ACL with the same `to`
to not overwrite each other when placed into the same hash.  They have
no further purpose and do not really avoid the issue since one can reuse
the number.

Rework the expected data structure to allow constructs that do not allow
such misconfiguration.
@@ -10,35 +10,64 @@
#
# [*acl*]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also update this to puppet-strings soonish

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this yesterday and bravely decided to go look away 😆

@bastelfreak bastelfreak merged commit b8aa3ab into master Jan 25, 2022
@bastelfreak bastelfreak deleted the 294 branch January 25, 2022 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined method 'flatten' for nil:NilClass in openldap_access provider
4 participants