puppetlabs / puppetlabs/puppet-resource_api
missing validation of attribute names containing upper case characters
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 27
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
Describe the Bug
register_type accepts attribute names containing upper case characters. Puppet will happily downcase those for internal processing, without RSAPI noticing. this in turn leads to random-looking failures later in processing.
Expected Behavior
RSAPI register_type and register_transport refuse to accept attribute/connection_info keys that do not conform to all-lower-case snake casing rules (all lowercase, numbers, underscores, starts with letter).
Steps to Reproduce
Steps to reproduce the behavior:
- Create a new type called
somewith a mandatory attribute calledsomeThing - Run
puppet apply -e 'some { foo: }
Will fail with:
david@davids:~/tmp/foo$ pdk bundle exec puppet apply -e 'some { test: }' --verbose --trace --modulepath spec/fixtures/modules
pdk (INFO): Using Ruby 2.5.7
pdk (INFO): Using Puppet 6.10.1
Notice: Compiled catalog for localhost in environment production in 0.11 seconds
Info: Applying configuration version '1573033174'
Error: /Stage[main]/Some[test]: Could not evaluate: The following mandatory attributes were not provided:
* SomeThing
/opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/puppet-resource_api-1.8.7/lib/puppet/resource_api.rb:342:in `raise_missing_attrs'
/opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/puppet-resource_api-1.8.7/lib/puppet/resource_api.rb:289:in `retrieve'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet-6.10.1/lib/puppet/type.rb:1133:in `retrieve_resource'
[...]
Additional Context
This problem was originally reported and diagnosed by Brian Dinga on the community slack.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search for the register_type and register_transport entry points and reproduce the reported mixed-case attribute failure. Verify the existing registration behavior for attribute and connection_info keys, then confirm that invalid names are refused according to the stated lowercase snake-case rules. No specific files or tests are named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100