Skip to content

Conversation

@stas-schaller
Copy link
Collaborator

@stas-schaller stas-schaller commented Dec 1, 2025

Release v1.1.8: Security Fixes, Bug Fixes, and PAM Support

Release Date: 2025-12-08
Type: Minor version (1.1.7 → 1.1.8)
Compatibility: Backward compatible, no breaking changes


Summary

Release v1.1.8 of the Terraform Provider for Keeper Secrets Manager addresses critical security vulnerabilities in Go, fixes the long-standing shortcuts/linked records issue, adds comprehensive support for Privileged Access Management (PAM) record types with complete CRUD operations, testing, and documentation, and introduces regex pattern matching for flexible record filtering.


Security

Upgrade Go to Address Critical Vulnerabilities (KSM-707)

  • Upgrade Go from 1.24.0 to 1.24.8 (f8d8fb4)
  • Address critical security vulnerabilities:
    • CVE-2025-22871: net/http chunked encoding request smuggling vulnerability
    • CVE-2025-58185: DER payload parsing memory exhaustion vulnerability
  • Update GitHub Actions workflows to use Go 1.24.8 for builds and SBOM generation
  • Address customer-reported security findings from Wiz scan

Impact: Closes #61


Fixed

Fix Shortcuts/Linked Records Error (KSM-522)

  • Resolve duplicate UID handling across multiple shared folders
  • Fix "changes to folder_uid not allowed" errors during Terraform apply operations
  • Provider now correctly handles shortcuts (linked records) across shared folders

Impact: Closes #52, resolves long-standing issue affecting multi-folder setups


Added

Add Comprehensive PAM Record Type Support (KSM-527)

Complete implementation of Keeper Privileged Access Management (PAM) record types with CRUD operations, field validation, testing, and documentation.

New Resources

  • secretsmanager_pam_machine: Manage SSH, RDP, and other remote machine credentials

    • Fields: pam_hostname, pam_settings, login, password, rotation_scripts, operating_system, instance_name, instance_id, provider_group, provider_region, file_ref, totp
    • Commit: 8f74d9f
  • secretsmanager_pam_database: Manage PostgreSQL, MySQL, MongoDB, and other database credentials

    • Fields: pam_hostname, pam_settings, use_ssl, login, password, rotation_scripts, database_id, database_type, provider_group, provider_region, file_ref, totp
    • Commit: 8f74d9f
  • secretsmanager_pam_directory: Manage Active Directory and LDAP directory credentials (5371c78)

    • Fields: pam_hostname, pam_settings, use_ssl, login, password, rotation_scripts, distinguished_name, domain_name, directory_id, directory_type, user_match, provider_group, provider_region, alternative_ips, file_ref, totp
    • Includes 6 additional fields beyond initial implementation

Enhanced Data Sources

  • secretsmanager_pam_machine: Read existing machine credentials with full field support
  • secretsmanager_pam_database: Read existing database credentials with full field support
  • secretsmanager_pam_directory: Read existing directory credentials with full field support
  • secretsmanager_pam_user: Enhanced schema with private_pem_key field (61d716d)

Core PAM Features

  • pamSettings field: Protocol-specific connection configuration as JSON

    • Support for SSH, RDP, PostgreSQL, MySQL, MongoDB, SQL Server, and more
    • JSON string approach preserves all protocol-specific fields
    • Forward-compatible with new protocols and connection parameters
    • Prevents data loss on round-trip operations (create → read → update)
  • Schema functions in record_fields_pam.go:

    • schemaPamSettingsField(): Unified pamSettings schema
    • schemaPamHostnameField(): Hostname + port complex field
    • schemaScriptField(): Rotation scripts with command/fileRef/recordRef
    • Integration with existing field types (login, password, checkbox, text)

Comprehensive Test Coverage

  • Add 16 new acceptance tests validating complete CRUD lifecycle
  • resource_pam_machine_test.go: 4 tests (create, update, delete, import) with pamSettings validation
  • resource_pam_database_test.go: 4 tests (create, update, delete, import) with use_ssl validation
  • resource_pam_directory_test.go: 4 tests (create, update, delete, import) with directory_type validation
  • resource_pam_user_test.go: 4 tests including private_pem_key coverage (0ea4ada)
  • All tests validate pamSettings JSON serialization/deserialization
  • Tests follow established patterns with proper cleanup and error handling

Examples & Documentation

  • Add 6 comprehensive example files:

    • examples/resources/pam_machine.tf: SSH servers, Windows RDP, AWS EC2 instances
    • examples/resources/pam_database.tf: PostgreSQL, MySQL, MongoDB, AWS RDS configurations
    • examples/resources/pam_directory.tf: Active Directory, OpenLDAP configurations
    • examples/data-sources/pam_machine.tf: Reading machine credentials, parsing pamSettings
    • examples/data-sources/pam_database.tf: Building database connection strings
    • examples/data-sources/pam_directory.tf: Extracting directory configuration
  • Update version references across all 44 existing example files (3b4fc53)

Code Quality

  • Apply Go formatting standards (8d4b8f0)
  • Follow established provider patterns for CRUD operations
  • Implement proper error handling with diag.Diagnostics
  • Include throttling/retry logic for all write operations
  • Validate field labels match backend schema (camelCase conventions)

Impact: Enable Terraform management of privileged access credentials, merge PR #63


Add Regex Pattern Support to Records Data Source (KSM-389)

Enable flexible record filtering with regex pattern matching in the secretsmanager_records data source (8b0b49a).

New Features

  • title_patterns parameter: Filter records using Go regular expressions

    • Supports multiple patterns in a single query
    • Combines with existing UIDs and exact title filters
    • Example: "^Production.*Database$", "^Prod.*DB.*"
  • Pattern validation: Runtime regex compilation with clear error messages

  • Optimized fetching: Fetches all records once when patterns are used (efficient bulk operations)

Test Coverage

  • Add 4 new acceptance tests:
    • TestAccDataSourceRecords_WithTitlePatterns: Basic pattern matching functionality
    • TestAccDataSourceRecords_InvalidPattern: Invalid regex error handling
    • TestAccDataSourceRecords_CombinedWithPatterns: Mixed UIDs, titles, and patterns
    • TestAccDataSourceRecords_MultiplePatterns: Multiple pattern support

Documentation & Examples

  • Updated docs/data-sources/records.md with regex pattern examples
  • Added practical examples to examples/data-sources/records.tf
  • Documented performance considerations for pattern matching

Example Usage:

data "secretsmanager_records" "production_dbs" {
  title_patterns = [
    "^Production.*Database$",
    "^Prod.*DB.*"
  ]
}

Impact: Closes #14, merges PR #64


Testing

Running Tests Locally

PAM acceptance tests:

export TF_ACC=1
export KEEPER_CREDENTIAL=<base64-encoded-credential>

# Test individual PAM types
go test ./secretsmanager -v -run "TestAccResourcePamMachine"
go test ./secretsmanager -v -run "TestAccResourcePamDatabase"
go test ./secretsmanager -v -run "TestAccResourcePamDirectory"
go test ./secretsmanager -v -run "TestAccResourcePamUser"

# Test all PAM types
go test ./secretsmanager -v -run "TestAccResourcePam"

Records data source tests:

export TF_ACC=1
export KEEPER_CREDENTIAL=<base64-encoded-credential>

# Test regex pattern support
go test ./secretsmanager -v -run "TestAccDataSourceRecords"

All acceptance tests:

export TF_ACC=1
export KEEPER_CREDENTIAL=<base64-encoded-credential>
go test ./secretsmanager -v -timeout=30m

Test Results: ✅ All 108 tests passing


Files Changed

102 files changed: 7,457 additions, 1,872 deletions

Modified Core Files

  • go.mod - Go version 1.24.0 → 1.24.8
  • .github/workflows/terraform-provider-release-process.yml - Go version updates
  • README.md, docs/index.md - Version references 1.1.7 → 1.1.8
  • secretsmanager/provider.go - PAM data sources/resources registration + shortcuts fix
  • secretsmanager/record_fields_pam.go - PAM field schema functions (pamSettings, pamHostname, rotation_scripts)
  • secretsmanager/data_source_records.go - Regex pattern matching support
  • secretsmanager/data_source_pam_user.go - Enhanced schema with private_pem_key support
  • Multiple PAM resource/data source files

Created PAM Files

  • secretsmanager/resource_pam_directory.go - PAM directory resource (Active Directory, LDAP)
  • secretsmanager/data_source_pam_directory.go - PAM directory data source
  • secretsmanager/resource_pam_machine_test.go - 4 acceptance tests
  • secretsmanager/resource_pam_database_test.go - 4 acceptance tests
  • secretsmanager/resource_pam_directory_test.go - 4 acceptance tests
  • secretsmanager/resource_pam_user_test.go - 4 acceptance tests
  • examples/resources/pam_machine.tf - Machine resource examples
  • examples/resources/pam_database.tf - Database resource examples
  • examples/resources/pam_directory.tf - Directory resource examples
  • examples/data-sources/pam_machine.tf - Machine data source examples
  • examples/data-sources/pam_database.tf - Database data source examples
  • examples/data-sources/pam_directory.tf - Directory data source examples

Updated Files

  • secretsmanager/data_source_records_test.go - Added 4 regex pattern tests
  • docs/data-sources/records.md - Regex pattern documentation
  • examples/data-sources/records.tf - Regex pattern examples
  • All example files: Version references 1.1.7 → 1.1.8 (44 files)

Related Issues

  • Closes #61 - Go security vulnerabilities (CVE-2025-22871, CVE-2025-58185)
  • Closes #52 - Shortcuts/linked records causing apply errors
  • Closes #14 - Regex pattern support for records data source
  • Merges #63 - PAM record types implementation
  • Merges #64 - Regex pattern implementation
  • Jira: KSM-707 (Go security upgrade)
  • Jira: KSM-527 (PAM record type support)
  • Jira: KSM-522 (Shortcuts fix)
  • Jira: KSM-389 (Regex pattern support)

stas-schaller and others added 12 commits October 30, 2025 16:57
  - Implemented pamDirectory resource and data source for Active Directory and OpenLDAP
  - Fixed Schedule field structure to match Go SDK (6 fields)
  - Fixed login/password field reading in all PAM data sources (directory, machine, database, user)
  - Created examples for pamDirectory resources and data sources
  - Documented AllowedSettings investigation in field comments
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/crypto](https://github.com/golang/crypto).


Updates `golang.org/x/crypto` from 0.42.0 to 0.45.0
- [Commits](golang/crypto@v0.42.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <[email protected]>
@stas-schaller stas-schaller marked this pull request as ready for review December 1, 2025 17:17
@stas-schaller stas-schaller changed the title Release v1.1.8: Go upgrade and security fixes Release v1.1.8: Go upgrade and security fixes, PAM Record Type Support Dec 1, 2025
Fixed pre-existing compilation errors:
- Changed ProviderFactories to Providers (testAccProviders)
- Replaced undefined variables with testAcc helpers
- Fixed PreCheck function call syntax

The test now compiles but still requires TF_ACC=1 and test data to run.
Added GitHub Actions workflow to run tests on pull requests:
- Builds provider binary
- Runs go vet and go fmt checks
- Runs unit tests and provider validation
- Based on pattern from secrets-manager-go repository

Acceptance tests require TF_ACC=1 and test credentials,
so they should be run manually or in a separate workflow.
Changed test files to properly skip tests when TF_ACC is not set
instead of failing. This prevents CI from failing when running
unit tests without acceptance test credentials.

Files fixed:
- data_source_folder_test.go: removed nil pointer dereference
- resource_folder_test.go: changed t.Fail() to t.Skip()
- resource_pam_machine_test.go: changed t.Fatal() to t.Skip()
- resource_pam_database_test.go: changed t.Fatal() to t.Skip()
- Add resource_pam_user_test.go with 4 acceptance tests (create, update, delete, import)
- Add resource_pam_directory_test.go with 4 acceptance tests
- Enable PAM Database update test (was disabled due to SDK concerns)
- Add examples for PAM User resources and data sources
- Fix test data formats (checkbox values, database_type lowercase, distinguished_name labels)
- All 16 PAM acceptance tests now pass (Database, Directory, Machine, User)

Note: Update tests only test fields that work with current SDK (v1.6.4).
Fields using ApplyFieldChange() have known SDK limitation where RecordDict changes
don't sync to RawJson. Workaround: tests focus on fields using SetStandardFieldValue().
Updated version constraints in PAM resource and data source examples:
- examples/data-sources/pam_{database,machine,user}.tf
- examples/resources/pam_{database,machine,user}.tf

All PAM examples now consistently require provider version >= 1.1.8
which includes the PAM record type support added in KSM-527.
Ensure go mod tidy runs with -compat=1.24.8 to maintain compatibility
with the Go version specified in go.mod during releases, regardless of
the Go version installed on the release machine.
…modules-dd7da38a6b

Bump golang.org/x/crypto from 0.42.0 to 0.45.0 in the go_modules group across 1 directory
Copy link
Contributor

@idimov-keeper idimov-keeper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read the comments

// simple value - Int64 (converted to float/float64 by JSON)
ftSchema["value"] = int64(num)
} else if boolVal, ok := fiv.(bool); ok {
// simple value - bool (for checkbox fields that expect a list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which checkbox field expects a list i.e. multiple (values)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it with the Go SDK directly and it looks like checkbox values (useSSL, managed) return as single element arrays, ie [true] or [false]. The schema has MaxItems: 1 on the field so I updated the comment to be a little more explicit about what's going on here

Optional: true,
AtLeastOneOf: []string{"folder_uid", "uid"},
Description: "The folder UID where the secret is stored. The parent shared folder must be non empty.",
Description: "The folder UID where the secret is stored. Ensure the folder is shared to your KSM application with 'Can Edit' permissions.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC Recent SDKs support sub-folders so AFAIK this is the direct parent which may or may not be a shared folder (hence "The parent shared folder must ...") consider changing "Ensure the folder is shared..."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, went with "the folder or its parent shared folder must be accessible" instead of "ensure the folder is shared."

* feat(data-source): add regex pattern support to records data source

Implement title_patterns parameter for secretsmanager_records data source,
allowing users to filter records using Go regex patterns. This addresses
GitHub issue #14 and Jira ticket KSM-389.

Features:
- Add title_patterns schema field accepting list of regex patterns
- Compile and validate patterns at runtime
- Match records against any provided pattern
- Support combining UIDs, titles, and patterns in single query
- Fetch all records once when patterns used (optimization)

Tests:
- TestAccDataSourceRecords_WithTitlePatterns: Basic pattern matching
- TestAccDataSourceRecords_InvalidPattern: Invalid regex error handling
- TestAccDataSourceRecords_CombinedWithPatterns: Mixed query types
- TestAccDataSourceRecords_MultiplePatterns: Multiple pattern support

Documentation:
- Updated docs/data-sources/records.md with pattern examples
- Added regex usage examples to examples/data-sources/records.tf
- Documented performance considerations for pattern matching

References: GitHub issue #14, Jira KSM-389

* test(records): fix wildcard UIDs and map checks in acceptance tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants