Skip to content

Allow protected passwords in ACL operations - #337

Open
dprzybyl wants to merge 1 commit into
wttech:mainfrom
dprzybyl:feature/issue-335-protected-password
Open

dprzybyl wants to merge 1 commit into
wttech:mainfrom
dprzybyl:feature/issue-335-protected-password

Conversation

@dprzybyl

@dprzybyl dprzybyl commented Oct 26, 2026 •

Copy link
Copy Markdown

Summary

Closes #335.

Users can now pass CryptoSupport-protected passwords ({...} form) directly to acl.createUser, acl.setPassword and acl.check.password without unprotecting them from the script. Previously the encrypted string was stored verbatim, so the alternative was decrypting ahead of time and hardcoding the plaintext.

Changes

  • CodeContext resolves CryptoSupport through osgi.getService(...) (same pattern as NotificationManager) and passes it into Acl → AclContext → AuthorizableManager.
  • New CryptoDecryptor wraps the service and is applied on every password that flows through createUser, changePassword and testPassword; blank or unprotected values pass through unchanged, CryptoException is surfaced as AclException.
  • The granite-crypto API is already on the classpath transitively via cq-replication, so no new dependency is needed.
  • set_password and create_user snippets explain in their tooltip that only the password argument is auto-decrypted and point to the new osgi_crypto_protect snippet, which generates the {...} value via cryptoSupport.protect(text) — works on any AEM (including AEMaaCS where /system/console/crypto is not reachable).

Test plan

  • Unit tests for CryptoDecryptor (null service, blank input, plain text, encrypted, CryptoException wrapping) — 5 tests
  • Full core test suite — 43/43 pass
  • Spotless check — pass
  • Codegen (api.json / api.md) — 0 diffs (new class is a private collaborator, not reachable from the script binding)
  • Local deploy on AEM 4502 — verified acl.createUser(id: ..., password: "{...}") end-to-end
  • Local deploy on AEM 4502 — verified acl.setPassword(user, "{...}") end-to-end

@dprzybyl dprzybyl changed the title Allow protected passwords in ACL operations (#335) Allow protected passwords in ACL operations Oct 26, 2026
Users can now pass CryptoSupport-protected passwords (`{...}` form) directly
to acl.createUser, acl.setPassword and acl.check.password without
unprotecting them from the script. Previously the encrypted string was
stored verbatim, so the alternative was decrypting ahead of time and
hardcoding the plaintext.

CodeContext resolves CryptoSupport through osgiContext.getService (same
pattern as NotificationManager) and passes it into Acl -> AclContext ->
AuthorizableManager. A small CryptoDecryptor wraps the service and is
applied on every password that flows through createUser, changePassword
and testPassword; blank or unprotected values pass through unchanged,
and CryptoException is surfaced as AclException. The granite-crypto API
is already on the classpath transitively via cq-replication, so no new
dependency is needed.

The set_password and create_user snippets explain in their tooltip that
only the password argument is auto-decrypted. A new osgi_crypto_protect
snippet shows how to generate a {...} value via cryptoSupport.protect(),
which works on any AEM including AEMaaCS where /system/console/crypto is
not reachable.

Closes wttech#335
@dprzybyl
dprzybyl force-pushed the feature/issue-335-protected-password branch from 0b72f57 to 2e47e26 Compare October 26, 2026 12:16
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.

Possibility to set protected password

1 participant