conjur-api 6.0.1.pre.392 → 6.0.1.pre.397

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f07a58c83c43f077c6c0681c4eb7d9a3eb68e5670fce35b7a8de14af94138ef
4
- data.tar.gz: df1f3ebe59388cb6fd4481d6e325e8ac8cf8c8e547ea1f228c27f6d562285526
3
+ metadata.gz: dfad32924a3946437d68dec74e837d60b7b86c12a83c82c0b76f94c9d1e038ac
4
+ data.tar.gz: 82cc3d6b12d3d08a49d002fb6dfd7ca6998d0b097fc83e4313140fa968c94d74
5
5
  SHA512:
6
- metadata.gz: 8a348b59ccca310f949e2a05ea1fb306daff9bea27acb94b9ae7c3c78a02fd8afb9a57f7f4fa269226c235c91f20647bd4743ead700a7f95de367e9a7e7dc502
7
- data.tar.gz: '05009cbe0759b29083320189bf18a46dab12573be4e531ec08b22781bbbcf504cefb8e0ae8f5cb5db9fe853d6cc883a784aa17a5a9aec6b4c8dd7edea762bcee'
6
+ metadata.gz: d19e588938870c7b500a40e66d63680ff4a08a1e66ae644b5c392f2d8dff5ceac77c19f16d92fba4af8b9ff5ac032eac5e2ee09a96e1943b142e50bf0227fe33
7
+ data.tar.gz: 6ed03dfacb53665f4eccdbb2f69691db04207b69751aabfa04492fe96411ce5c9fbf3e34ce19cc0b53cd24cc0122a217149af10b0c1fac6ca1371699052f2e26
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  ARG RUBY_VERSION
2
2
  FROM ruby:$RUBY_VERSION
3
3
 
4
- RUN apt-get update && apt-get install -y --no-install-recommends vim curl
4
+ RUN apt-get update && apt-get install -y --no-install-recommends vim curl libyaml-dev
5
5
 
6
6
  WORKDIR /src/conjur-api
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.1-392
1
+ 6.0.1-397
data/dev/Dockerfile.dev CHANGED
@@ -1,6 +1,6 @@
1
1
  FROM ruby:3-slim
2
2
 
3
- RUN apt-get update && apt-get install -y --no-install-recommends vim curl git build-essential
3
+ RUN apt-get update && apt-get install -y --no-install-recommends vim curl git build-essential libyaml-dev
4
4
 
5
5
  WORKDIR /src/conjur-api
6
6
 
@@ -1,4 +1,3 @@
1
- version: '3'
2
1
  services:
3
2
  pg:
4
3
  image: postgres:15
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
@@ -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
- rest_client_options.merge(options || {})
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
@@ -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 eq(expected)
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/test.sh CHANGED
@@ -60,7 +60,7 @@ function runTests() {
60
60
  -e CONJUR_AUTHN_API_KEY="$api_key" \
61
61
  -e SSL_CERT_FILE=/etc/ssl/certs/keycloak.pem \
62
62
  tester \
63
- "/scripts/fetch_certificate && rake jenkins_init jenkins_spec jenkins_cucumber"
63
+ "/scripts/fetch_certificate && bundle exec rake jenkins_init jenkins_spec jenkins_cucumber"
64
64
  }
65
65
 
66
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.1.pre.392
4
+ version: 6.0.1.pre.397
5
5
  platform: ruby
6
6
  authors:
7
7
  - CyberArk Maintainers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client