Skip to content

Commit

Permalink
Merge pull request #4114 from zendesk/awoo/secret-visible
Browse files Browse the repository at this point in the history
Dont error if secret visible key does not exist
  • Loading branch information
grosser authored Aug 5, 2024
2 parents 08a207c + 44a3ad6 commit bf47fcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/secrets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def failure_response(message)

def find_secret
@secret = Samson::Secrets::Manager.read(id, include_value: true)
@secret[:value] = nil unless @secret.fetch(:visible)
@secret[:value] = nil unless @secret[:visible]
end

def find_writable_project_permalinks
Expand Down
6 changes: 6 additions & 0 deletions test/controllers/secrets_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@ def do_update(extras = {})
assert_template :show
end

it "renders when secret only has value key" do
Samson::Secrets::Manager.stubs(:read).returns({value: 'test'})
get :show, params: {id: secret.id}
assert_template :show
end

it "renders with unknown project" do
secret.update_column(:id, 'oops/bar')
get :show, params: {id: secret.id}
Expand Down

0 comments on commit bf47fcd

Please sign in to comment.