Skip to content

Release/sdk/ruby/v17.2.0#869

Open
stas-schaller wants to merge 45 commits intomasterfrom
release/sdk/ruby/v17.2.0
Open

Release/sdk/ruby/v17.2.0#869
stas-schaller wants to merge 45 commits intomasterfrom
release/sdk/ruby/v17.2.0

Conversation

@stas-schaller
Copy link
Contributor

@stas-schaller stas-schaller commented Nov 17, 2025

Summary

Ruby SDK v17.2.0 - Bug Fixes, Gov Cloud Support, and Enterprise Features

This release focuses on critical bug fixes, Gov Cloud Dev support, disaster recovery caching, and HTTP proxy support for enterprise environments.

Note: PAM features and comprehensive test coverage moved to v17.3.0 for easier QA and faster release cycle.


Changes

Fixed

  • KSM-685: CreateOptions.subfolder_uid parameter is now correctly sent to API when creating records
  • KSM-686: Implemented disaster recovery caching with CachingPostFunction to match other SDKs
    • API response caching now works for both get_secret and get_folders endpoints
    • Added Cache class for file-based encrypted cache storage
    • Removed unused @cache and @cache_expiry instance variables from SecretsManager
  • KSM-696: Secure file permissions for config files (0600 on Unix systems)
  • KSM-734: Fixed notation lookup to handle duplicate UIDs from record shortcuts
    • When a KSM application has access to both an original record and its shortcut, the same UID appears multiple times
    • Added deduplication logic using uniq { |r| r.uid } before ambiguity check
    • Preserves genuine ambiguity detection for different records with the same title
    • Added unit test for duplicate UID handling

Added

  • KSM-743: Added transmission public key renamed module to keepercommandersm and published it to pypi #18 for Gov Cloud Dev environment support
  • KSM-686: Disaster recovery caching features
    • KeeperSecretsManager::CachingPostFunction - Built-in disaster recovery caching
    • KeeperSecretsManager::Cache - File-based cache management (save, load, clear)
    • Cache file location configurable via KSM_CACHE_DIR environment variable
    • Unit tests for caching functionality
    • Integration tests for caching workflows
  • KSM-692: HTTP proxy support for enterprise environments
    • proxy_url initialization parameter for explicit proxy configuration
    • HTTPS_PROXY environment variable support (automatic detection)
    • https_proxy (lowercase) environment variable support
    • Authenticated proxy support (username:password in URL)
    • Proxy applies to all HTTP operations (API calls, file downloads, file uploads)
    • Unit tests for proxy configuration
    • Integration tests for proxy workflows
  • KeeperSecretsManager.from_config(config_base64, options = {}) - Convenience method for initializing from base64 config string
  • Development console script (bin/console) for interactive SDK exploration using Pry REPL

Changed

  • Test Coverage: Added feature-specific tests for caching and proxy support (~100-150 examples)
    • Added test/integration/test_caching.rb - Integration tests for disaster recovery caching
    • Added test/integration/test_proxy.rb - Integration tests for HTTP proxy support
    • Added spec/keeper_secrets_manager/unit/cache_spec.rb - Unit tests for Cache class
    • Added spec/keeper_secrets_manager/unit/proxy_spec.rb - Unit tests for proxy configuration
  • Mock Infrastructure: Implemented proper AES-256-GCM encryption in mock_helper.rb
    • Records now use proper AES-GCM encryption (was Base64 only)
    • Folders use correct AES-CBC encryption for data
    • Added transmission key encryption/decryption
  • Example Files:
    • Added 10_custom_caching.rb - Disaster recovery caching examples
    • Added 12_proxy_usage.rb - HTTP proxy configuration examples
    • Fixed example files to use correct SDK APIs
  • Documentation: Updated for v17.2.0 features

Testing

Unit Tests

cd sdk/ruby
bundle exec rake spec

Test coverage:

  • cache_spec.rb: Cache hit/miss, expiration, encryption
  • proxy_spec.rb: Proxy configuration (env vars, explicit, authenticated)
  • notation_spec.rb: Duplicate UID handling with shortcuts
  • Basic integration tests pass

Manual QA Checklist

  • Test subfolder creation with CreateOptions (KSM-685)
  • Verify config file permissions are 0600 on Unix (KSM-696)
  • Test Gov Cloud Dev token parsing (KSM-743)
  • Test notation with shortcuts - no ambiguity errors (KSM-734)
  • Test disaster recovery caching workflow (KSM-686):
    • Cache hit scenario
    • Cache miss scenario
    • Cache expiration
    • Offline operation with cache
  • Test HTTP proxy with real proxy server (KSM-692):
    • Proxy via environment variables (HTTPS_PROXY)
    • Proxy via explicit configuration
    • Authenticated proxy (user:pass@host:port)
    • Verify all operations use proxy (API, files, uploads)
  • Test Ruby 3.1, 3.2, 3.3 compatibility

Breaking Changes

None. This release is fully backward compatible with v17.1.0.


Release Notes

Ruby SDK 17.2.0 provides critical bug fixes and enterprise-ready features:

Bug Fixes:

  • Fixed subfolder creation parameter transmission (KSM-685)
  • Fixed notation lookup with record shortcuts (KSM-734)
  • Secure file permissions for config files (KSM-696)

Enterprise Features:

  • Disaster recovery caching for offline operation (KSM-686)
  • HTTP proxy support for corporate environments (KSM-692)
  • Gov Cloud Dev infrastructure support (KSM-743)

Test Coverage: Feature-specific tests for all new functionality (~100-150 examples)

… languages

  Added 8 missing DTO fields to achieve complete parity with Python, JavaScript,
  .NET, and Java SDKs:

  - KeeperRecord.links - Array of linked record references
  - KeeperRecord.is_editable - Boolean indicating edit permissions (defaults to true)
  - KeeperRecord.inner_folder_uid - Actual folder UID where record is located
  - KeeperFile.thumbnail_url - Thumbnail image URL
  - KeeperFile.last_modified - File modification timestamp
  - QueryOptions.request_links - Flag to request linked records in query
  - UpdatePayload.links2_remove - Array of link UIDs to remove during updates
  - SecretsManagerResponse.expires_on - Token expiration timestamp

  Added UpdateOptions class with transaction_type and links_to_remove support.

  Added/updated methods:
  - update_secret_with_options(record, update_options) - New method for advanced updates
  - update_secret(record, transaction_type:) - Refactored to use update_secret_with_options
  - prepare_update_payload - Now accepts UpdateOptions, filters fileRef fields
  - prepare_get_payload - Now supports request_links parameter
  - download_thumbnail(file_data) - New method for downloading file thumbnails
…hierarchy tests

    Added 3 new RSpec integration test files (79 new examples):
    - totp_spec.rb (35 examples) - TOTP generation/validation for all algorithms and periods
    - file_operations_spec.rb (19 examples) - File metadata, MIME types, multiple files
    - folder_hierarchy_spec.rb (25 examples) - Tree operations, path resolution, queries

    Fixed mock infrastructure (test/integration/mock_helper.rb):
    - Implemented proper AES-256-GCM encryption for records (was Base64 only)
    - Implemented AES-CBC encryption for folder data
    - Added transmission key encryption/decryption
    - Enabled complete offline testing without config.base64

    Fixed manual integration test scripts:
    - test_totp.rb - Enabled SHA256/SHA512 algorithm and custom period tests
    - test_file_operations.rb - Enabled multiple file upload, metadata, and deletion tests
    - test_offline_mock.rb - Updated to work completely offline with proper encryption

    Updated GitHub Actions workflow:
    - Renamed 'Run unit tests' step to 'Run RSpec tests (unit + integration)'
    - Removed error suppression from offline mock test
…ectory with dev dependencies"

This reverts commit 56754eb.
…res and consistent from_file() initialization
…issions

Fix file permissions for Ruby SDK config files
@stas-schaller stas-schaller marked this pull request as ready for review November 20, 2025 17:15
The mock token key was 30 bytes instead of required 32 bytes for AES-256-GCM.
Changed 'test_token_key_32_bytes_long!!' to 'test_token_key_32_bytes_long!!!!'
to make it exactly 32 bytes.

This fixes the ArgumentError: key must be 32 bytes error in CI.

Test results:
- All 660 tests pass (0 failures, 13 pending)
- Coverage: 63.28% → 67.97% (+4.69 percentage points)
- Offline mock test passes
The decrypt_aes_gcm function expects encrypted data in the format:
  [IV (12 bytes)][Ciphertext (variable)][Tag (16 bytes)]

The previous implementation was only including [Ciphertext][Tag], missing
the IV at the beginning. This caused decryption to fail with CipherError.

Fixed by:
- Storing the IV in a variable before setting it on the cipher
- Prepending the IV to the final encrypted data: iv + ciphertext + tag

Why it passed locally but failed in CI:
- The previous commit (aa7b9a3) fixed the key length issue, allowing the
  test to run further into the decryption logic
- Different OpenSSL versions or Ruby configurations between local and CI
  may have caused different error manifestations
- The missing IV would consistently cause decryption failure, but the
  specific error might vary by environment

Test results:
- All 660 tests pass (0 failures, 13 pending)
- Offline mock test passes
Deduplicate records by UID before checking for ambiguity. When a KSM
application has access to both an original record and its shortcut,
the same UID appears multiple times but should not be treated as
ambiguous.

- Add deduplication logic using uniq { |r| r.uid }
- Preserve genuine ambiguity check for different records with same title
- Add test case for duplicate UID handling
…18-ruby

KSM-743: add transmission public key #18 for Gov Cloud Dev support
…d-ruby

KSM-734: Fix notation lookup with record shortcuts (Ruby)
Removed PAM features (moved to v17.3.0):
- KSM-687 PAM DTO fields and methods
- KSM-694 convenience methods (upload_file_from_path, try_get_notation)
- complete_transaction method for PAM rotation workflows
- PAM linked records example (11_pam_linked_records.rb)

Removed comprehensive tests (moved to v17.3.0 for KSM-697):
- errors_spec.rb (343 lines - error handling coverage)
- field_types_spec.rb (733 lines - field types coverage)
- totp_spec.rb (479 lines - TOTP coverage)
- core_spec.rb (387 lines - core initialization coverage)
- test_pam_linked_records.rb (PAM integration tests)
- test_pam_rotation.rb (PAM integration tests)

Kept feature-specific tests for v17.2.0:
- cache_spec.rb (tests KSM-686 caching)
- proxy_spec.rb (tests KSM-692 proxy)
- notation_spec.rb (tests KSM-734 duplicate UID fix)
- test_caching.rb (integration tests)
- test_proxy.rb (integration tests)

Updated CHANGELOG:
- Removed PAM features from v17.2.0 section
- Added note about PAM features moving to v17.3.0
- Updated test count from 569 to ~100-150 (feature-specific only)
- Added QA scope note (1 week vs 2 weeks)

v17.2.0 now focuses on: bug fixes, Gov Cloud support, caching, proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant