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

Fix server error for admin user password change #2440

Merged
merged 2 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Check to stop hosts from setting passwords fixed for admin user
[#2440](https://github.com/cyberark/conjur/pull/2440)

## [1.14.2] - 2021-12-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CredentialsController < ApplicationController
# This method requires a PUT request. The new password is in the request body.
def update_password
password = request.body.read
raise Exceptions::Forbidden if @role.resource.kind == "host"
raise Exceptions::Forbidden if @role.login.start_with?("host/")

Commands::Credentials::ChangePassword.new.call(
role: @role,
Expand Down
16 changes: 16 additions & 0 deletions cucumber/api/features/change_password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ Feature: Change the password of a role
cucumber:user:alice successfully changed their password
"""

Scenario: With basic authentication, user admin update their own password using the current password.

Given I set the password for "admin" to "My-Password1"
And I save my place in the audit log file for remote
When I successfully PUT "/authn/cucumber/password" with username "admin" and password "My-Password1" and plain text body "New-Password1"
Then I can GET "/authn/cucumber/login" with username "admin" and password "New-Password1"
And there is an audit record matching:
"""
<86>1 * * conjur * password
[auth@43868 user="cucumber:user:admin"]
[subject@43868 role="cucumber:user:admin"]
[client@43868 ip="\d+\.\d+\.\d+\.\d+"]
[action@43868 result="success" operation="change"]
cucumber:user:admin successfully changed their password
"""

Scenario: With basic authentication, users can update their own password using the current API key.

When I successfully PUT "/authn/cucumber/password" with username "alice" and password ":cucumber:user:alice_api_key" and plain text body "New-Password1"
Expand Down