Skip to content

Release KSM Ansible v1.5.0 - #982

Draft
stas-schaller wants to merge 6 commits into
masterfrom
release/integration/ansible/v1.5.0
Draft

stas-schaller wants to merge 6 commits into
masterfrom
release/integration/ansible/v1.5.0

Conversation

@stas-schaller

@stas-schaller stas-schaller commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Release branch for Keeper Secrets Manager Ansible v1.5.0, adding subfolder record creation, idempotent folder creation, replacing the unsafe cache serialization format, and fixing a crash in keeper_create on empty complex fields.

Changes

New Features

  • Subfolder targeting (KSM-845): keeper_create now accepts an optional folder_uid parameter to place new records in a subfolder within a shared folder, rather than always creating at the shared folder root.
  • Idempotent folder creation (KSM-1445): Adds a new keeper_create_folder module to create a folder directly in a shared folder or nested inside an existing subfolder. Returns the existing folder's UID instead of creating a duplicate when a folder with the given name already exists under the target parent.

Bug Fixes

  • Cache serialization (KSM-1103 / VM-1452): Replaced pickle with JSON for the record cache encrypt/decrypt path. pickle.loads() on attacker-influenced data (e.g. via AWX extra vars) is a known RCE vector; JSON is safe regardless of input source.
    • A cache from an older plugin version (still pickle-format) or an otherwise invalid cache is now detected and ignored with a warning, falling back to fetching records from the vault, rather than raising an unhandled exception.
  • keeper_create crashes on empty complex field: keeper_create crashed with "Could not create record: list index out of range" when a playbook supplied a dict-typed complex field (address, name, host, etc.) with value: []. Playbook values are now converted from [] to unpopulated before being passed to the helper, so the record is created with the field empty rather than crashing. Root cause in the helper library is tracked as KSM-1119.

Maintenance

  • Bumped minimum SDK dependencies: keeper-secrets-manager-core>=17.3.0, keeper-secrets-manager-helper>=1.1.2
  • Added paths filter to test.ansible.yml CI workflow including sdk/python/core dependency

Breaking Changes

None.

Related Issues

@stas-schaller
stas-schaller force-pushed the release/integration/ansible/v1.5.0 branch from 3764ddf to a44f0da Compare April 9, 2026 19:38
- feat: add folder_uid parameter to keeper_create for subfolder record targeting (KSM-845)
- fix: replace pickle with JSON cache serialization to eliminate unsafe deserialization path (KSM-1103)
- ci: add paths filter to test.ansible.yml including sdk/python/core dependency
@stas-schaller
stas-schaller force-pushed the release/integration/ansible/v1.5.0 branch from 78e254e to 06df0d6 Compare July 16, 2026 18:24
@stas-schaller
stas-schaller marked this pull request as ready for review July 16, 2026 18:27
idimov-keeper and others added 4 commits July 27, 2026 14:40
* VM-1452: replace pickle cache serialization with JSON

Remove insecure pickle.loads from the Ansible record cache path (CWE-502) and round-trip Record state via Fernet-encrypted JSON.

* VM-1452: invalidate legacy cache and fall back to vault

Ignore unusable pickle/invalid record caches without deserializing them, warn, and fetch from the vault so plays continue until keeper_cache_records rebuilds JSON.

* VM-1452: avoid AnsibleError str() in cache fallback test

Newer ansible-core can recurse in AnsibleError.__str__; assert on exception args instead so CI stays green.

* docs(ansible): correct changelog version 1.4.1 -> 1.5.0
- Add KSM-845 changelog entry to both READMEs' 1.5.0 section, which
  only documented the VM-1452 cache fix
- Add playbook-level test for keeper_create_subfolder.yml, exercising
  the actual YAML via AnsibleTestFramework rather than only the Python
  create_record() unit test, matching every other example playbook's
  coverage in this suite
helper FieldType.__init__ crashes with IndexError when a dict-typed
field (address, name, host, passkey, etc.) has value: [] -- the
server's normal representation of an unpopulated complex field.

keeper_create passed field values from playbook args directly to
Field(), so any playbook with an explicitly empty complex field
crashed with AnsibleError("Could not create record: list index out
of range"), giving no signal about which field caused the failure.

Fix: convert value: [] to None with "or None" before passing to
Field(). FieldType.__init__ treats None as "no value" and skips the
dict-field index that crashes on empty lists, so the field is created
as unpopulated rather than crashing. Applies to both standard fields
and custom_fields.

Root cause in the helper is tracked as KSM-1119. Cleanup comments
added at both Field() sites to flag the workaround for removal once
the helper ships the "if self.value:" guard in FieldType.__init__.
…creation (KSM-1445)

Adds keeper_create_folder action/module plugin: creates a folder
directly in a shared folder, or nested inside an existing subfolder
of that shared folder. Idempotent - if a folder with the given name
already exists directly under the target parent, its UID is returned
instead of creating a duplicate.

Ported from PR #1171 (external contribution). Resolved one conflict
against KSM-845: the PR independently added a subfolder_uid parameter
to create_record() that duplicated KSM-845's already-shipped folder_uid
under a different, unused name; dropped in favor of the shipped name.
version_added corrected from the PR's "1.4.1" to "1.5.0" to match the
release this actually ships in.
@mgallego-keeper
mgallego-keeper marked this pull request as draft September 17, 2026 17:21
…lder_uid (KSM-1454) (#1182)

KSM-845 added the ability to create a keeper_create record inside a subfolder
and named the parameter folder_uid. KSM-1445 then added the sibling module
keeper_create_folder, which names the same concept subfolder_uid, and the
Python SDK's CreateOptions has always used subfolder_uid for the same thing.
This aligns keeper_create with both.

Collection version 1.5.0 is unpublished (PyPI and Ansible Galaxy both top out
at 1.4.0, and release PR 982 into master is still open), so folder_uid is not
a public interface yet and this rename breaks no released user.

Also fixes two defects found while making this change:
- create_record() now normalizes an empty subfolder_uid to None. The SDK sets
  payload.subFolderUid unconditionally and serializes the whole payload, so a
  playbook passing subfolder_uid: "" would otherwise send an empty value to
  the server.
- keeper_create now raises an explicit error if a playbook still sets the old
  folder_uid key. No plugin in this integration declares an argument_spec, so
  Ansible would otherwise silently drop the unknown key and create the record
  at the shared folder root instead of the intended subfolder.

Adds version_added: "1.5.0" to the option, matching the point release it
actually ships in; the option previously had none.

This surfaced while porting external contribution PR #1170 (Geoffroy
RABOUIN), which adds this same subfolder capability under the name
subfolder_uid. The capability already existed under a different name, so
there was nothing new to port; this commit adopts the contributor's
parameter name instead.

Co-authored-by: RABOUIN Geoffroy <grabouin@sigma.fr>

This branch has not been deployed

No deployments
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.

unable work with subfolders in Ansible code?

3 participants