Skip to content

Commit 1dc8916

Browse files
committed
Prevent status webservices from being returned on the providers endpoint
1 parent a05ea04 commit 1dc8916

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
### Changed
1515
- Reduces debug log verbosity.
1616
[cyberark/conjur#2639](https://github.com/cyberark/conjur/pull/2639)
17+
- Remove status webservices from providers endpoints
18+
[cyberark/conjur#2640](https://github.com/cyberark/conjur/pull/2640)
1719

1820
## [1.18.1] - 2022-08-01
1921

app/db/repository/authenticator_repository.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ def initialize(data_object:, resource_repository: ::Resource, logger: Rails.logg
88
end
99

1010
def find_all(type:, account:)
11+
identifier = Sequel.function(:identifier, :resource_id)
12+
1113
@resource_repository.where(
1214
Sequel.like(
1315
:resource_id,
1416
"#{account}:webservice:conjur/#{type}/%"
1517
)
18+
).where(
19+
Sequel.like(
20+
identifier,
21+
%r{conjur/(authn(?:-[^/]+)?(?:/[^/]+)?)$}
22+
)
1623
).all.map do |webservice|
1724
load_authenticator(account: account, id: webservice.id.split(':').last, type: type)
1825
end.compact

spec/app/db/repository/authenticator_repository_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@
8989
::Role['rspec:policy:conjur/authn-oidc/baz-abc123'].destroy
9090
end
9191
end
92+
93+
context 'when webservices status are presents' do
94+
before(:each) do
95+
::Resource.create(
96+
resource_id: "rspec:webservice:conjur/authn-oidc/foo-abc123/status",
97+
owner_id: "rspec:policy:conjur/authn-oidc/foo-abc123"
98+
)
99+
end
100+
101+
it { expect(repo.find_all(type: 'authn-oidc', account: 'rspec').length).to eq(2) }
102+
103+
after(:each) do
104+
::Resource['rspec:webservice:conjur/authn-oidc/foo-abc123/status'].destroy
105+
end
106+
end
92107
end
93108

94109
after(:each) do

0 commit comments

Comments
 (0)