conjur-api 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/close-stale.yml +23 -0
- data/CHANGELOG.md +9 -1
- data/CONTRIBUTING.md +1 -1
- data/Dockerfile +1 -1
- data/Gemfile +1 -1
- data/Jenkinsfile +28 -16
- data/README.md +13 -19
- data/Rakefile +1 -1
- data/SECURITY.md +2 -38
- data/VERSION +1 -1
- data/ci/configure.sh +2 -0
- data/conjur-api.gemspec +2 -2
- data/dev/Dockerfile.dev +1 -1
- data/dev/docker-compose.yml +0 -1
- data/dev/start +1 -1
- data/docker-compose.yml +2 -3
- data/example/demo.rb +1 -0
- data/features/members.feature +7 -0
- data/features/support/env.rb +1 -1
- data/kics.config +19 -0
- data/lib/conjur/acts_as_role.rb +1 -1
- data/lib/conjur/configuration.rb +58 -2
- data/spec/api_spec.rb +1 -0
- data/spec/configuration_spec.rb +4 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/policy_load_result_spec.rb +102 -0
- data/test.sh +7 -4
- metadata +16 -18
- /data/{.gitleaks.toml → .oldgitleaks.toml} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: edd37d8f4fed6b48c464041843e3c1a3a3e9e0789f35de47acff48923719fdac
|
|
4
|
+
data.tar.gz: c9c22c87a9837a41b9c0e5d8195fa7c93933146f6e5ec53c9d6b0272ec982a8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1eec52c956fa30a3017d439998805576e320ae428544bfb1ac336a32b81996a397eb829d78557c42cb45d25c22c924b1e53c5560a136541379f0e9492fffff17
|
|
7
|
+
data.tar.gz: e10a616c7977f0aa5f9b1412b4160fa1152763e380db161295fbc7aa09fff0aec6d1277b1a17c4c1c70299232c31df68a56bc99e0b08228771c544e95202e9ff
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Close inactive issues
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: "30 1 * * *"
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
close-issues:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
actions: write # For the Actions cache
|
|
11
|
+
issues: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/stale@v9
|
|
15
|
+
with:
|
|
16
|
+
days-before-issue-stale: 30
|
|
17
|
+
days-before-issue-close: 14
|
|
18
|
+
stale-issue-label: "stale"
|
|
19
|
+
stale-issue-message: "This issue is stale because it has been inactive for 30 days. Please comment to keep it open. Otherwise, it will be automatically closed in 14 days."
|
|
20
|
+
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale. Please feel free to reopen it or create a new issue if you think it should still be addressed."
|
|
21
|
+
days-before-pr-stale: -1
|
|
22
|
+
days-before-pr-close: -1
|
|
23
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
9
9
|
- Nothing should go in this section, please add to the latest unreleased version
|
|
10
10
|
(and update the corresponding date), or add a new version.
|
|
11
11
|
|
|
12
|
+
## [6.0.1] - 2025-09-05
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Updated README.md, CONTRIBUTING.md, and SECURITY.md to align with Conjur Enterprise name change to Secrets Manager. (CNJR-10968)
|
|
16
|
+
- Pass valid field in #memberships to fix listing roles (CNJR-2109)
|
|
17
|
+
- Pull keycloak image from internal repository
|
|
18
|
+
|
|
12
19
|
## [6.0.0] - 2023-12-28
|
|
13
20
|
|
|
14
21
|
### Removed
|
|
@@ -389,7 +396,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
389
396
|
|
|
390
397
|
## [2.0.0] - 2013-13-12
|
|
391
398
|
|
|
392
|
-
[Unreleased]: https://github.com/cyberark/conjur-api-ruby/compare/v6.0.
|
|
399
|
+
[Unreleased]: https://github.com/cyberark/conjur-api-ruby/compare/v6.0.1...HEAD
|
|
400
|
+
[6.0.1]: https://github.com/cyberark/conjur-api-ruby/compare/v6.0.0...v6.0.1
|
|
393
401
|
[6.0.0]: https://github.com/cyberark/conjur-api-ruby/compare/v5.4.1...v6.0.0
|
|
394
402
|
[5.4.1]: https://github.com/cyberark/conjur-api-ruby/compare/v5.4.0...v5.4.1
|
|
395
403
|
[5.4.0]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.7...v5.4.0
|
data/CONTRIBUTING.md
CHANGED
|
@@ -17,7 +17,7 @@ contributor!
|
|
|
17
17
|
|
|
18
18
|
## Development
|
|
19
19
|
|
|
20
|
-
To develop and run tests against Conjur, use the `start` and `stop` scripts in the `dev` folder. The start script brings up
|
|
20
|
+
To develop and run tests against Conjur OSS, use the `start` and `stop` scripts in the `dev` folder. The start script brings up a Conjur OSS (and Postgres database), CLI container, and a "work" container, with the gem code mounted into the working directory.
|
|
21
21
|
|
|
22
22
|
### Starting a Shell
|
|
23
23
|
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/Jenkinsfile
CHANGED
|
@@ -25,14 +25,15 @@ pipeline {
|
|
|
25
25
|
buildDiscarder(logRotator(numToKeepStr: '30'))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
triggers {
|
|
29
|
-
cron(getDailyCronString())
|
|
30
|
-
}
|
|
31
|
-
|
|
32
28
|
environment {
|
|
33
29
|
MODE = release.canonicalizeMode()
|
|
34
30
|
}
|
|
35
31
|
|
|
32
|
+
triggers {
|
|
33
|
+
cron(getDailyCronString())
|
|
34
|
+
parameterizedCron(getWeeklyCronString("H(1-5)","%MODE=RELEASE"))
|
|
35
|
+
}
|
|
36
|
+
|
|
36
37
|
stages {
|
|
37
38
|
stage ("Skip build if triggering job didn't create a release") {
|
|
38
39
|
when {
|
|
@@ -48,6 +49,14 @@ pipeline {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
stage('Scan for internal URLs') {
|
|
53
|
+
steps {
|
|
54
|
+
script {
|
|
55
|
+
detectInternalUrls()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
stage('Get InfraPool Agent') {
|
|
52
61
|
steps {
|
|
53
62
|
script {
|
|
@@ -71,53 +80,56 @@ pipeline {
|
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
stage('Test Ruby 3.
|
|
83
|
+
stage('Test Ruby 3.2') {
|
|
75
84
|
environment {
|
|
76
|
-
|
|
85
|
+
INFRAPOOL_RUBY_VERSION = '3.2'
|
|
86
|
+
INFRAPOOL_REGISTRY_URL = "registry.tld"
|
|
77
87
|
}
|
|
78
88
|
steps {
|
|
79
89
|
script {
|
|
80
90
|
infrapool.agentSh "./test.sh"
|
|
81
|
-
infrapool.agentStash name: 'reports3.
|
|
91
|
+
infrapool.agentStash name: 'reports3.2', includes: '**/reports/*.xml'
|
|
82
92
|
}
|
|
83
93
|
}
|
|
84
94
|
post {
|
|
85
95
|
always {
|
|
86
|
-
unstash 'reports3.
|
|
96
|
+
unstash 'reports3.2'
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
|
|
91
|
-
stage('Test Ruby 3.
|
|
101
|
+
stage('Test Ruby 3.3') {
|
|
92
102
|
environment {
|
|
93
|
-
|
|
103
|
+
INFRAPOOL_RUBY_VERSION = '3.3'
|
|
104
|
+
INFRAPOOL_REGISTRY_URL = "registry.tld"
|
|
94
105
|
}
|
|
95
106
|
steps {
|
|
96
107
|
script {
|
|
97
108
|
infrapool.agentSh "./test.sh"
|
|
98
|
-
infrapool.agentStash name: 'reports3.
|
|
109
|
+
infrapool.agentStash name: 'reports3.3', includes: '**/reports/*.xml'
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
112
|
post {
|
|
102
113
|
always {
|
|
103
|
-
unstash 'reports3.
|
|
114
|
+
unstash 'reports3.3'
|
|
104
115
|
}
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
stage('Test Ruby 3.
|
|
119
|
+
stage('Test Ruby 3.4') {
|
|
109
120
|
environment {
|
|
110
|
-
|
|
121
|
+
INFRAPOOL_RUBY_VERSION = '3.4'
|
|
122
|
+
INFRAPOOL_REGISTRY_URL = "registry.tld"
|
|
111
123
|
}
|
|
112
124
|
steps {
|
|
113
125
|
script {
|
|
114
126
|
infrapool.agentSh "./test.sh"
|
|
115
|
-
infrapool.agentStash name: 'reports3.
|
|
127
|
+
infrapool.agentStash name: 'reports3.4', includes: '**/reports/*.xml'
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
130
|
post {
|
|
119
131
|
always {
|
|
120
|
-
unstash 'reports3.
|
|
132
|
+
unstash 'reports3.4'
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
135
|
}
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CyberArk Secrets Manager API for Ruby
|
|
2
2
|
|
|
3
|
-
Programmatic Ruby access to the
|
|
3
|
+
Programmatic Ruby access to the Secrets Manager API.
|
|
4
4
|
|
|
5
5
|
RDocs are available from the through the [Ruby Gem details page](https://rubygems.org/gems/conjur-api)
|
|
6
6
|
|
|
@@ -31,23 +31,20 @@ Or install it yourself as:
|
|
|
31
31
|
|
|
32
32
|
# Usage
|
|
33
33
|
|
|
34
|
-
Connecting to
|
|
34
|
+
Connecting to Secrets Manager is a two-step process:
|
|
35
35
|
|
|
36
|
-
* **Configuration** Instruct the API where to find the
|
|
36
|
+
* **Configuration** Instruct the API where to find the Secrets Manager endpoint and how to secure the connection.
|
|
37
37
|
* **Authentication** Provide the API with credentials that it can use to authenticate.
|
|
38
38
|
|
|
39
39
|
## Configuration
|
|
40
40
|
|
|
41
|
-
The simplest way to configure the
|
|
42
|
-
If you have configured the machine with [
|
|
41
|
+
The simplest way to configure the Secrets Manager API is to use the configuration file stored on the machine.
|
|
42
|
+
If you have configured the machine with [Secrets Manager CLI](https://github.com/cyberark/conjur-cli-go),
|
|
43
43
|
its default location is `~/.conjurrc`.
|
|
44
44
|
|
|
45
|
-
The Conjur configuration process also checks `/etc/conjur.conf` for global settings. This is typically used
|
|
46
|
-
in server environments.
|
|
47
|
-
|
|
48
45
|
For custom scenarios, the location of the file can be overridden using the `CONJURRC` environment variable.
|
|
49
46
|
|
|
50
|
-
You can load the
|
|
47
|
+
You can load the Secrets Manager configuration file using the following Ruby code:
|
|
51
48
|
|
|
52
49
|
```ruby
|
|
53
50
|
require 'conjur/cli'
|
|
@@ -55,18 +52,15 @@ Conjur::Config.load
|
|
|
55
52
|
Conjur::Config.apply
|
|
56
53
|
```
|
|
57
54
|
|
|
58
|
-
**Note** this code requires the [conjur-cli](https://github.com/conjurinc/cli-ruby) gem, which should also be in your
|
|
59
|
-
gemset or bundle.
|
|
60
|
-
|
|
61
55
|
## Authentication
|
|
62
56
|
|
|
63
|
-
Once
|
|
57
|
+
Once Secrets Manager is configured, the connection can be established like this:
|
|
64
58
|
|
|
65
59
|
```
|
|
66
60
|
conjur = Conjur::Authn.connect nil, noask: true
|
|
67
61
|
```
|
|
68
62
|
|
|
69
|
-
To
|
|
63
|
+
To authenticate, the API client must
|
|
70
64
|
provide a `login` name and `api_key`. The `Conjur::Authn.connect` will attempt the following, in order:
|
|
71
65
|
|
|
72
66
|
1. Look for `login` in environment variable `CONJUR_AUTHN_LOGIN`, and `api_key` in `CONJUR_AUTHN_API_KEY`
|
|
@@ -76,7 +70,7 @@ can be overridden using the configuration file `netrc_path` option.
|
|
|
76
70
|
|
|
77
71
|
## Connecting Without Files
|
|
78
72
|
|
|
79
|
-
It's possible to configure and authenticate the
|
|
73
|
+
It's possible to configure and authenticate the Secrets Manager connection without using any files, and without requiring
|
|
80
74
|
the `conjur-cli` gem.
|
|
81
75
|
|
|
82
76
|
To accomplish this, apply the configuration settings directly to the [Conjur::Configuration](https://github.com/conjurinc/api-ruby/blob/master/lib/conjur/configuration.rb)
|
|
@@ -99,20 +93,20 @@ In either case, you will also need to configure certificate trust. For example:
|
|
|
99
93
|
OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE.add_file "/etc/conjur-yourorg.pem"
|
|
100
94
|
```
|
|
101
95
|
|
|
102
|
-
Once
|
|
96
|
+
Once Secrets Manager is configured, you can create a new API client by providing a `login` and `api_key`:
|
|
103
97
|
|
|
104
98
|
```
|
|
105
99
|
Conjur::API.new_from_key login, api_key
|
|
106
100
|
```
|
|
107
101
|
|
|
108
|
-
Note that if you are connecting as a
|
|
102
|
+
Note that if you are connecting as a Host, the login should be
|
|
109
103
|
prefixed with `host/`. For example: `host/myhost.example.com`, not just `myhost.example.com`.
|
|
110
104
|
|
|
111
105
|
## Configuring RestClient
|
|
112
106
|
|
|
113
107
|
[Conjur::Configuration](https://github.com/conjurinc/api-ruby/blob/master/lib/conjur/configuration.rb)
|
|
114
108
|
allows optional configuration of the [RestClient](https://github.com/rest-client/rest-client)
|
|
115
|
-
instance used by
|
|
109
|
+
instance used by Secrets Manager API to communicate with the Secrets Manager server, via the options hash
|
|
116
110
|
`Conjur.configuration.rest_client_options`.
|
|
117
111
|
|
|
118
112
|
The default value for the options hash is:
|
data/Rakefile
CHANGED
|
@@ -24,7 +24,7 @@ begin
|
|
|
24
24
|
require 'cucumber/rake/task'
|
|
25
25
|
|
|
26
26
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
|
27
|
-
t.cucumber_opts = "--tags
|
|
27
|
+
t.cucumber_opts = "--tags 'not @wip' --format pretty --format junit --out features/reports"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
begin
|
data/SECURITY.md
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
# Security Policies and Procedures
|
|
2
2
|
|
|
3
|
-
This document outlines security procedures and general policies for the CyberArk Conjur
|
|
4
|
-
suite of tools and products.
|
|
5
|
-
|
|
6
|
-
* [Reporting a Bug](#reporting-a-bug)
|
|
7
|
-
* [Disclosure Policy](#disclosure-policy)
|
|
8
|
-
* [Comments on this Policy](#comments-on-this-policy)
|
|
9
|
-
|
|
10
3
|
## Reporting a Bug
|
|
4
|
+
CyberArk takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you follow responsible disclosure guidelines and contact product_security@cyberark.com and work with us toward a quick resolution to protect our customers.
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
Thank you for improving the security of the Conjur suite. We appreciate your efforts and
|
|
14
|
-
responsible disclosure and will make every effort to acknowledge your
|
|
15
|
-
contributions.
|
|
16
|
-
|
|
17
|
-
Report security bugs by emailing the lead maintainers at security@conjur.org.
|
|
18
|
-
|
|
19
|
-
The maintainers will acknowledge your email within 2 business days. Subsequently, we will
|
|
20
|
-
send a more detailed response within 2 business days of our acknowledgement indicating
|
|
21
|
-
the next steps in handling your report. After the initial reply to your report, the security
|
|
22
|
-
team will endeavor to keep you informed of the progress towards a fix and full
|
|
23
|
-
announcement, and may ask for additional information or guidance.
|
|
24
|
-
|
|
25
|
-
Report security bugs in third-party modules to the person or team maintaining
|
|
26
|
-
the module.
|
|
27
|
-
|
|
28
|
-
## Disclosure Policy
|
|
29
|
-
|
|
30
|
-
When the security team receives a security bug report, they will assign it to a
|
|
31
|
-
primary handler. This person will coordinate the fix and release process,
|
|
32
|
-
involving the following steps:
|
|
33
|
-
|
|
34
|
-
* Confirm the problem and determine the affected versions.
|
|
35
|
-
* Audit code to find any potential similar problems.
|
|
36
|
-
* Prepare fixes for all releases still under maintenance. These fixes will be
|
|
37
|
-
released as fast as possible.
|
|
38
|
-
|
|
39
|
-
## Comments on this Policy
|
|
40
|
-
|
|
41
|
-
If you have suggestions on how this process could be improved please submit a
|
|
42
|
-
pull request.
|
|
6
|
+
Refer to [CyberArk's Security Vulnerability Policy](https://www.cyberark.com/cyberark-security-vulinerability-policy.pdf) for more details.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.0.
|
|
1
|
+
6.0.1
|
data/ci/configure.sh
CHANGED
data/conjur-api.gemspec
CHANGED
|
@@ -29,9 +29,9 @@ Gem::Specification.new do |gem|
|
|
|
29
29
|
gem.add_development_dependency 'rspec', '~> 3'
|
|
30
30
|
gem.add_development_dependency 'rspec-expectations', '~> 3.4'
|
|
31
31
|
gem.add_development_dependency 'json_spec'
|
|
32
|
-
gem.add_development_dependency 'cucumber'
|
|
32
|
+
gem.add_development_dependency 'cucumber'
|
|
33
33
|
gem.add_development_dependency 'ci_reporter_rspec'
|
|
34
|
-
gem.add_development_dependency 'simplecov'
|
|
34
|
+
gem.add_development_dependency 'simplecov'
|
|
35
35
|
gem.add_development_dependency 'simplecov-cobertura'
|
|
36
36
|
gem.add_development_dependency 'io-grab'
|
|
37
37
|
gem.add_development_dependency 'rdoc'
|
data/dev/Dockerfile.dev
CHANGED
data/dev/docker-compose.yml
CHANGED
data/dev/start
CHANGED
|
@@ -5,7 +5,7 @@ function development() {
|
|
|
5
5
|
|
|
6
6
|
docker compose exec -T conjur conjurctl wait
|
|
7
7
|
|
|
8
|
-
local api_key=$(docker compose exec -T conjur rake 'role:retrieve-key[cucumber:user:admin]')
|
|
8
|
+
local api_key=$(docker compose exec -T conjur bundle exec rake 'role:retrieve-key[cucumber:user:admin]')
|
|
9
9
|
api_key=$(docker compose exec -T conjur conjurctl role retrieve-key cucumber:user:admin | tr -d '\r')
|
|
10
10
|
|
|
11
11
|
docker exec -e CONJUR_AUTHN_API_KEY="$api_key" -it --detach-keys 'ctrl-\' $(docker compose ps -q gem) bash
|
data/docker-compose.yml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
version: '2.1'
|
|
2
1
|
services:
|
|
3
2
|
pg:
|
|
4
3
|
image: postgres:15
|
|
@@ -6,7 +5,7 @@ services:
|
|
|
6
5
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
7
6
|
|
|
8
7
|
conjur:
|
|
9
|
-
image: cyberark/conjur:edge
|
|
8
|
+
image: ${REGISTRY_URL:-docker.io}/cyberark/conjur:edge
|
|
10
9
|
# TODO: Test with a version that supports authn-sut
|
|
11
10
|
command: server -a cucumber
|
|
12
11
|
environment:
|
|
@@ -20,7 +19,7 @@ services:
|
|
|
20
19
|
- keycloak
|
|
21
20
|
|
|
22
21
|
keycloak:
|
|
23
|
-
image: jboss/keycloak:4.3.0.Final
|
|
22
|
+
image: registry.tld/jboss/keycloak:4.3.0.Final
|
|
24
23
|
environment:
|
|
25
24
|
- KEYCLOAK_USER=admin
|
|
26
25
|
- KEYCLOAK_PASSWORD=admin
|
data/example/demo.rb
CHANGED
data/features/members.feature
CHANGED
|
@@ -49,3 +49,10 @@ Feature: Display role members and memberships.
|
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
"""
|
|
52
|
+
|
|
53
|
+
Scenario: Show a role's memberships non-recursive.
|
|
54
|
+
When I run the code:
|
|
55
|
+
"""
|
|
56
|
+
$conjur.role('cucumber:group:developers').memberships(recursive: false).any?
|
|
57
|
+
"""
|
|
58
|
+
Then the result should be "true"
|
data/features/support/env.rb
CHANGED
|
@@ -20,4 +20,4 @@ $username = ENV['CONJUR_AUTHN_LOGIN'] || 'admin'
|
|
|
20
20
|
$password = ENV['CONJUR_AUTHN_API_KEY'] || 'secret'
|
|
21
21
|
|
|
22
22
|
$api_key = Conjur::API.login $username, $password
|
|
23
|
-
$conjur = Conjur::API.new_from_key $username, $api_key
|
|
23
|
+
$conjur = Conjur::API.new_from_key $username, $api_key
|
data/kics.config
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# All of the following issues are not a concern for the infrastructure files in this
|
|
2
|
+
# repository since they're only used in the build process or testing.
|
|
3
|
+
exclude-queries:
|
|
4
|
+
- 965a08d7-ef86-4f14-8792-4a3b2098937e # Apt Get Install Pin Version Not Defined
|
|
5
|
+
- fd54f200-402c-4333-a5a4-36ef6709af2f # Missing User Instruction
|
|
6
|
+
- ce76b7d0-9e77-464d-b86f-c5c48e03e22d # Container Capabilities Unrestricted
|
|
7
|
+
- 8c978947-0ff6-485c-b0c2-0bfca6026466 # Shared Volumes Between Containers
|
|
8
|
+
- 610e266e-6c12-4bca-9925-1ed0cd29742b # Security Opt Not Set
|
|
9
|
+
- b03a748a-542d-44f4-bb86-9199ab4fd2d5 # Healthcheck Instruction Missing
|
|
10
|
+
- 698ed579-b239-4f8f-a388-baa4bcb13ef8 # Healthcheck Not Set
|
|
11
|
+
- 451d79dc-0588-476a-ad03-3c7f0320abb3 # Container Traffic Not Bound To Host Interface
|
|
12
|
+
- df746b39-6564-4fed-bf85-e9c44382303c # Apt Get Install Lists Were Not Deleted
|
|
13
|
+
- 4f31dd9f-2cc3-4751-9b53-67e4af83dac0 # Host Namespace is Shared
|
|
14
|
+
- ce14a68b-1668-41a0-ab7d-facd9f784742 # Networks Not Set
|
|
15
|
+
|
|
16
|
+
# The following files are used for development and testing only.
|
|
17
|
+
exclude-paths:
|
|
18
|
+
- "conjur-api-ruby/docker-compose.yml"
|
|
19
|
+
- "conjur-api-ruby/dev/docker-compose.yml"
|
data/lib/conjur/acts_as_role.rb
CHANGED
data/lib/conjur/configuration.rb
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
require 'openssl'
|
|
23
23
|
require 'set'
|
|
24
24
|
require 'conjur/cert_utils'
|
|
25
|
+
require 'base64'
|
|
25
26
|
|
|
26
27
|
module Conjur
|
|
27
28
|
class << self
|
|
@@ -368,6 +369,19 @@ module Conjur
|
|
|
368
369
|
# @see cert_file
|
|
369
370
|
add_option :ssl_certificate
|
|
370
371
|
|
|
372
|
+
# add custom header to request containing customer detail and sdk version
|
|
373
|
+
add_option :integration_name, default: "SecretsManagerRuby SDK"
|
|
374
|
+
|
|
375
|
+
add_option :integration_type, default: "cybr-secretsmanager"
|
|
376
|
+
|
|
377
|
+
add_option :integration_version, default: Conjur::API::VERSION
|
|
378
|
+
|
|
379
|
+
add_option :vendor_name, default: "CyberArk"
|
|
380
|
+
|
|
381
|
+
add_option :vendor_version, default: nil
|
|
382
|
+
|
|
383
|
+
add_option :final_telemetry_header
|
|
384
|
+
|
|
371
385
|
# @!attribute rest_client_options
|
|
372
386
|
#
|
|
373
387
|
# Custom options for the underlying RestClient Requests. This defaults to:
|
|
@@ -384,7 +398,10 @@ module Conjur
|
|
|
384
398
|
# you must manually set them on the value you provide.
|
|
385
399
|
add_option :rest_client_options do
|
|
386
400
|
{
|
|
387
|
-
ssl_cert_store: OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
|
|
401
|
+
ssl_cert_store: OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE,
|
|
402
|
+
headers: {
|
|
403
|
+
'x-cybr-telemetry': get_telemetry_header
|
|
404
|
+
}
|
|
388
405
|
}
|
|
389
406
|
end
|
|
390
407
|
|
|
@@ -397,7 +414,8 @@ module Conjur
|
|
|
397
414
|
# Create rest_client_options by merging the input with the
|
|
398
415
|
# rest_client_options present on the configuration object.
|
|
399
416
|
def create_rest_client_options options
|
|
400
|
-
|
|
417
|
+
options ||= {}
|
|
418
|
+
rest_client_options.merge(options) { |key, left, right| left.merge(right) }
|
|
401
419
|
end
|
|
402
420
|
|
|
403
421
|
# Add the certificate configured by the {#ssl_certificate} and {#cert_file} options to the certificate
|
|
@@ -436,5 +454,43 @@ module Conjur
|
|
|
436
454
|
# propagate.
|
|
437
455
|
File.open(path) {}
|
|
438
456
|
end
|
|
457
|
+
|
|
458
|
+
# get_telemetry_header constructs and returns a base64-encoded telemetry header string.
|
|
459
|
+
#
|
|
460
|
+
# The method checks the values of various instance variables (`integration_name`,
|
|
461
|
+
# `integration_version`, `integration_type`, `vendor_name`, `vendor_version`) and
|
|
462
|
+
# constructs the header accordingly. If any of these values are not provided (empty or nil),
|
|
463
|
+
# they will be omitted from the final header string.
|
|
464
|
+
#
|
|
465
|
+
# The telemetry header is formatted as a series of key-value pairs separated by "&". Each key-value
|
|
466
|
+
# pair corresponds to one of the following fields:
|
|
467
|
+
# - `in`: Integration Name
|
|
468
|
+
# - `iv`: Integration Version
|
|
469
|
+
# - `it`: Integration Type
|
|
470
|
+
# - `vn`: Vendor Name
|
|
471
|
+
# - `vv`: Vendor Version
|
|
472
|
+
#
|
|
473
|
+
# The final header string is base64-encoded using URL-safe encoding (without padding).
|
|
474
|
+
# If the header has been previously generated and cached in `final_telemetry_header`, it is returned directly.
|
|
475
|
+
#
|
|
476
|
+
# Returns:
|
|
477
|
+
# - String: The base64-encoded telemetry header string.
|
|
478
|
+
def get_telemetry_header
|
|
479
|
+
unless final_telemetry_header.nil?
|
|
480
|
+
return final_telemetry_header
|
|
481
|
+
end
|
|
482
|
+
final_telemetry_header = ""
|
|
483
|
+
if integration_name && !integration_name.strip.empty?
|
|
484
|
+
final_telemetry_header += "in=#{integration_name}"
|
|
485
|
+
final_telemetry_header += "&iv=#{integration_version}" if integration_version && !integration_version.strip.empty?
|
|
486
|
+
final_telemetry_header += "&it=#{integration_type}" if integration_type && !integration_type.strip.empty?
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
if vendor_name && !vendor_name.strip.empty?
|
|
490
|
+
final_telemetry_header += "&vn=#{vendor_name}"
|
|
491
|
+
final_telemetry_header += "&vv=#{vendor_version}" if vendor_version && !vendor_version.strip.empty?
|
|
492
|
+
end
|
|
493
|
+
Base64.urlsafe_encode64(final_telemetry_header, padding: false)
|
|
494
|
+
end
|
|
439
495
|
end
|
|
440
496
|
end
|
data/spec/api_spec.rb
CHANGED
|
@@ -146,6 +146,7 @@ describe Conjur::API do
|
|
|
146
146
|
let(:token_encoded) { Base64.strict_encode64(token.to_json) }
|
|
147
147
|
let(:base_headers) { { authorization: authz_header } }
|
|
148
148
|
let(:headers) { base_headers }
|
|
149
|
+
# deepcode ignore InsecureTransmission: This is test code
|
|
149
150
|
let(:resource) { RestClient::Resource.new("http://example.com", { headers: headers })}
|
|
150
151
|
context 'basic functioning' do
|
|
151
152
|
it_behaves_like 'it can clone itself'
|
data/spec/configuration_spec.rb
CHANGED
|
@@ -31,10 +31,12 @@ describe Conjur::Configuration do
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
it "rest_client_options defaults" do
|
|
34
|
+
encoded_attr = Base64.urlsafe_encode64("in=SecretsManager Ruby SDK&iv=0.0.dev&it=cybr-secretsmanager&vn=CyberArk", padding: false)
|
|
34
35
|
expected = {
|
|
35
|
-
ssl_cert_store: OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
|
|
36
|
+
ssl_cert_store: OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE,
|
|
37
|
+
headers: { 'x-cybr-telemetry': encoded_attr}
|
|
36
38
|
}
|
|
37
|
-
expect(configuration.rest_client_options).to
|
|
39
|
+
expect(configuration.rest_client_options[:headers]).to include(:'x-cybr-telemetry')
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
it "rest_client_options propagate to RestClient::Resource" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'conjur/policy_load_result'
|
|
3
|
+
|
|
4
|
+
# Tests the behavior of the Conjur::PolicyLoadResult class when parsing API responses.
|
|
5
|
+
describe Conjur::PolicyLoadResult do
|
|
6
|
+
let(:data) do
|
|
7
|
+
{
|
|
8
|
+
"created_roles" => {
|
|
9
|
+
"conjur:host:data/host-no-key" => {
|
|
10
|
+
"id" => "conjur:host:data/host-no-key",
|
|
11
|
+
"api_key" => nil
|
|
12
|
+
},
|
|
13
|
+
"conjur:host:data/host-with-key" => {
|
|
14
|
+
"id" => "conjur:host:data/host-with-key",
|
|
15
|
+
"api_key" => "12345"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"version" => 1
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
subject { described_class.new(data) }
|
|
23
|
+
|
|
24
|
+
describe "#created_roles" do
|
|
25
|
+
it "parses created roles with their API keys" do
|
|
26
|
+
created_roles = subject.created_roles
|
|
27
|
+
|
|
28
|
+
expect(created_roles).to include("conjur:host:data/host-no-key")
|
|
29
|
+
expect(created_roles["conjur:host:data/host-no-key"]["api_key"]).to be_nil
|
|
30
|
+
|
|
31
|
+
expect(created_roles).to include("conjur:host:data/host-with-key")
|
|
32
|
+
expect(created_roles["conjur:host:data/host-with-key"]["api_key"]).to eq("12345")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "returns nil if created_roles is missing" do
|
|
36
|
+
data.delete("created_roles")
|
|
37
|
+
expect(subject.created_roles).to be_nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "returns an empty hash if created_roles is empty" do
|
|
41
|
+
data["created_roles"] = {}
|
|
42
|
+
expect(subject.created_roles).to eq({})
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "handles multiple roles with mixed api_key states, including null and missing keys" do
|
|
46
|
+
data["created_roles"] = {
|
|
47
|
+
"conjur:host:data/host-no-key" => {
|
|
48
|
+
"id" => "conjur:host:data/host-no-key",
|
|
49
|
+
"api_key" => nil
|
|
50
|
+
},
|
|
51
|
+
"conjur:host:data/host-with-key" => {
|
|
52
|
+
"id" => "conjur:host:data/host-with-key",
|
|
53
|
+
"api_key" => "valid_api_key"
|
|
54
|
+
},
|
|
55
|
+
"conjur:host:data/host-missing-key" => {
|
|
56
|
+
"id" => "conjur:host:data/host-missing-key"
|
|
57
|
+
},
|
|
58
|
+
"conjur:host:data/host-another-no-key" => {
|
|
59
|
+
"id" => "conjur:host:data/host-another-no-key",
|
|
60
|
+
"api_key" => nil
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
created_roles = subject.created_roles
|
|
65
|
+
|
|
66
|
+
# Check the role with a null API key
|
|
67
|
+
host_no_key = created_roles["conjur:host:data/host-no-key"]
|
|
68
|
+
expect(host_no_key).not_to be_nil
|
|
69
|
+
expect(host_no_key["id"]).to eq("conjur:host:data/host-no-key")
|
|
70
|
+
expect(host_no_key["api_key"]).to be_nil
|
|
71
|
+
|
|
72
|
+
# Check the role with a valid API key
|
|
73
|
+
host_with_key = created_roles["conjur:host:data/host-with-key"]
|
|
74
|
+
expect(host_with_key).not_to be_nil
|
|
75
|
+
expect(host_with_key["id"]).to eq("conjur:host:data/host-with-key")
|
|
76
|
+
expect(host_with_key["api_key"]).to eq("valid_api_key")
|
|
77
|
+
|
|
78
|
+
# Check the role with a missing API key field
|
|
79
|
+
host_missing_key = created_roles["conjur:host:data/host-missing-key"]
|
|
80
|
+
expect(host_missing_key).not_to be_nil
|
|
81
|
+
expect(host_missing_key["id"]).to eq("conjur:host:data/host-missing-key")
|
|
82
|
+
expect(host_missing_key["api_key"]).to be_nil
|
|
83
|
+
|
|
84
|
+
# Check another role with a null API key
|
|
85
|
+
another_no_key = created_roles["conjur:host:data/host-another-no-key"]
|
|
86
|
+
expect(another_no_key).not_to be_nil
|
|
87
|
+
expect(another_no_key["id"]).to eq("conjur:host:data/host-another-no-key")
|
|
88
|
+
expect(another_no_key["api_key"]).to be_nil
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe "#version" do
|
|
93
|
+
it "parses the version of the policy" do
|
|
94
|
+
expect(subject.version).to eq(1)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "returns nil if version is missing" do
|
|
98
|
+
data.delete("version")
|
|
99
|
+
expect(subject.version).to be_nil
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
data/test.sh
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/bin/bash -e
|
|
2
2
|
|
|
3
|
-
: "${RUBY_VERSION=3.
|
|
3
|
+
: "${RUBY_VERSION=3.2}"
|
|
4
4
|
# My local RUBY_VERSION is set to ruby-#.#.# so this allows running locally.
|
|
5
5
|
RUBY_VERSION="$(cut -d '-' -f 2 <<< "$RUBY_VERSION")"
|
|
6
6
|
|
|
7
|
+
export REGISTRY_URL=${INFRAPOOL_REGISTRY_URL:-"docker.io"}
|
|
8
|
+
export RUBY_VERSION="${INFRAPOOL_RUBY_VERSION:-$RUBY_VERSION}"
|
|
9
|
+
|
|
7
10
|
source ./ci/oauth/keycloak/keycloak_functions.sh
|
|
8
11
|
TOP_LEVEL=$(git rev-parse --show-toplevel)
|
|
9
12
|
|
|
@@ -49,7 +52,7 @@ function runTests() {
|
|
|
49
52
|
echo 'Waiting for Conjur to come up, and configuring it...'
|
|
50
53
|
./ci/configure.sh
|
|
51
54
|
|
|
52
|
-
local api_key=$(docker compose exec -T conjur rake 'role:retrieve-key[cucumber:user:admin]')
|
|
55
|
+
local api_key=$(docker compose exec -T conjur bundle exec rake 'role:retrieve-key[cucumber:user:admin]')
|
|
53
56
|
|
|
54
57
|
echo 'Running tests'
|
|
55
58
|
echo '-----'
|
|
@@ -57,7 +60,7 @@ function runTests() {
|
|
|
57
60
|
-e CONJUR_AUTHN_API_KEY="$api_key" \
|
|
58
61
|
-e SSL_CERT_FILE=/etc/ssl/certs/keycloak.pem \
|
|
59
62
|
tester \
|
|
60
|
-
"/scripts/fetch_certificate && rake jenkins_init jenkins_spec jenkins_cucumber"
|
|
63
|
+
"/scripts/fetch_certificate && bundle exec rake jenkins_init jenkins_spec jenkins_cucumber"
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
main
|
|
66
|
+
main
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: conjur-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- CyberArk Maintainers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-10-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|
|
@@ -112,16 +112,16 @@ dependencies:
|
|
|
112
112
|
name: cucumber
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - ">="
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
117
|
+
version: '0'
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- - "
|
|
122
|
+
- - ">="
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
124
|
+
version: '0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: ci_reporter_rspec
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,22 +140,16 @@ dependencies:
|
|
|
140
140
|
name: simplecov
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
|
-
- - "
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: '0.17'
|
|
146
|
-
- - "<"
|
|
143
|
+
- - ">="
|
|
147
144
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: '0
|
|
145
|
+
version: '0'
|
|
149
146
|
type: :development
|
|
150
147
|
prerelease: false
|
|
151
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
152
149
|
requirements:
|
|
153
|
-
- - "
|
|
154
|
-
- !ruby/object:Gem::Version
|
|
155
|
-
version: '0.17'
|
|
156
|
-
- - "<"
|
|
150
|
+
- - ">="
|
|
157
151
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0
|
|
152
|
+
version: '0'
|
|
159
153
|
- !ruby/object:Gem::Dependency
|
|
160
154
|
name: simplecov-cobertura
|
|
161
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -278,8 +272,9 @@ files:
|
|
|
278
272
|
- ".codeclimate.yml"
|
|
279
273
|
- ".dockerignore"
|
|
280
274
|
- ".github/CODEOWNERS"
|
|
275
|
+
- ".github/workflows/close-stale.yml"
|
|
281
276
|
- ".gitignore"
|
|
282
|
-
- ".
|
|
277
|
+
- ".oldgitleaks.toml"
|
|
283
278
|
- ".overcommit.yml"
|
|
284
279
|
- ".project"
|
|
285
280
|
- ".rubocop.yml"
|
|
@@ -339,6 +334,7 @@ files:
|
|
|
339
334
|
- features/user.feature
|
|
340
335
|
- features/variable_fields.feature
|
|
341
336
|
- features/variable_value.feature
|
|
337
|
+
- kics.config
|
|
342
338
|
- lib/conjur-api.rb
|
|
343
339
|
- lib/conjur-api/version.rb
|
|
344
340
|
- lib/conjur/acts_as_resource.rb
|
|
@@ -401,6 +397,7 @@ files:
|
|
|
401
397
|
- spec/roles_spec.rb
|
|
402
398
|
- spec/spec_helper.rb
|
|
403
399
|
- spec/ssl_spec.rb
|
|
400
|
+
- spec/unit/policy_load_result_spec.rb
|
|
404
401
|
- spec/uri_escape_spec.rb
|
|
405
402
|
- test.sh
|
|
406
403
|
- tmp/.keep
|
|
@@ -423,7 +420,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
423
420
|
- !ruby/object:Gem::Version
|
|
424
421
|
version: '0'
|
|
425
422
|
requirements: []
|
|
426
|
-
rubygems_version: 3.4.
|
|
423
|
+
rubygems_version: 3.4.19
|
|
427
424
|
signing_key:
|
|
428
425
|
specification_version: 4
|
|
429
426
|
summary: Conjur API
|
|
@@ -472,4 +469,5 @@ test_files:
|
|
|
472
469
|
- spec/roles_spec.rb
|
|
473
470
|
- spec/spec_helper.rb
|
|
474
471
|
- spec/ssl_spec.rb
|
|
472
|
+
- spec/unit/policy_load_result_spec.rb
|
|
475
473
|
- spec/uri_escape_spec.rb
|
|
File without changes
|