puppetlabs / puppetlabs/puppetlabs-stdlib

pw_hash is not working with bcrypt-y

Open
#1,453 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
349
Forks
573
Avg merge
3d 3h
Merged PRs (30d)
1

Description

Describe the Bug

Using the pw_hash() function with the 'bcrypt-y' algorithm inside an ini_setting resource causes a catalog compilation failure with an "Invalid argument" error when using Puppet stdlib version 9.7.0.

In stdlib 9.7.0, when I try to do this :

  ini_setting { 'my_thing.PASSWORD_HASH':
    ensure  => present,
    setting => 'my_thing.PASSWORD_HASH',
    value   => pw_hash($password, 'bcrypt-y','10$abcdefghijklmnopqrstuv),
    path    => $my_path,
  }

I get the following error :

Info: Loading facts
Notice: Requesting catalog from X
Notice: Catalog compiled by X
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Invalid argument - Invalid argument (file: /etc/puppetlabs/code/environments/X/site/profiles/manifests/my_thing.pp, line: 229, column: 16) on node X
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Environment

  • stdlib version : 9.7.0
  • puppet agent version : 7.34.0
  • puppet server version : 7.17.3
  • OS : Debian 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the pw_hash function entry point and reproduce the catalog compilation failure using the manifest, stdlib 9.7.0, and the listed Puppet versions. Trace how the bcrypt-y arguments are validated and add or update coverage for this invocation; done means the catalog compiles without the Invalid argument error.

Written by the indexing model from the issue text.

Assessment

Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.