Weakness/49238 keycloak 27 remove deprecated client key generation endpoints - #51679
Conversation
There was a problem hiding this comment.
Pull request overview
Removes deprecated client key-generation/download endpoints and prevents Keycloak from storing client private keys.
Changes:
- Removes private-key endpoints and representation fields.
- Converts Admin UI workflows to certificate import.
- Adds database cleanup, tests, and migration documentation.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
testsuite/.../AbstractClientAuthSignedJWTTest.java |
Generates test keys locally. |
testsuite/.../KeystoreUtils.java |
Removes private-key representations and unused helpers. |
tests/.../ClientAuthSecretSignedJWTTest.java |
Sets test certificates locally. |
tests/.../PermissionsTest.java |
Removes endpoint permission checks. |
tests/.../CredentialsTest.java |
Replaces generation tests with upload tests. |
test-framework/.../CryptoKeyStore.java |
Stops exposing generated private keys. |
services/.../CertificateInfoHelper.java |
Stops reading and storing client private keys. |
services/.../ClientAttributeCertificateResource.java |
Removes deprecated REST endpoints. |
services/.../TypedClientAttribute.java |
Removes typed private-key attributes. |
services/.../SamlProtocolFactory.java |
Stops persisting generated SAML private keys. |
services/.../SamlConfigAttributes.java |
Removes SAML private-key constants. |
services/.../SamlClient.java |
Removes private-key accessors and unused setters. |
services/.../ModAuthMellonClientInstallation.java |
Excludes private keys from installation ZIPs. |
services/.../KeycloakSamlSubsystemCliInstallation.java |
Emits private-key placeholders. |
services/.../KeycloakSamlClientInstallation.java |
Emits private-key placeholders in XML. |
server-spi-private/.../KeycloakModelUtils.java |
Stops returning generated private keys. |
model/jpa/.../jpa-changelog-master.xml |
Registers the 27.0 migration. |
model/jpa/.../jpa-changelog-27.0.0.xml |
Deletes stored client private-key attributes. |
js/libs/keycloak-admin-client/test/clients.spec.ts |
Tests certificate upload and retrieval. |
js/libs/keycloak-admin-client/src/resources/clients.ts |
Removes deprecated client methods. |
js/libs/keycloak-admin-client/src/defs/certificateRepresentation.ts |
Removes the private-key field. |
js/apps/admin-ui/test/utils/files/cert.pem |
Adds an upload test certificate. |
js/apps/admin-ui/test/clients/saml.ts |
Adds certificate-import test support. |
js/apps/admin-ui/test/clients/saml.spec.ts |
Tests import-only SAML configuration. |
js/apps/admin-ui/src/index.ts |
Removes obsolete dialog exports. |
js/apps/admin-ui/.../SamlKeysDialog.tsx |
Makes SAML setup import-only. |
js/apps/admin-ui/.../SamlKeys.tsx |
Removes generation and export actions. |
js/apps/admin-ui/.../Keys.tsx |
Removes OIDC key generation. |
js/apps/admin-ui/.../GenerateKeyDialog.tsx |
Retains only the shared import form. |
js/apps/admin-ui/.../ExportSamlKeyDialog.tsx |
Deletes SAML key export UI. |
integration/admin-client-core/.../ClientAttributeCertificateResource.java |
Removes deprecated Java client methods. |
docs/.../changes/changes.adoc |
Registers 27.0 migration notes. |
docs/.../changes/changes-27_0_0.adoc |
Documents the breaking API change. |
core/.../CertificateRepresentation.java |
Removes private-key API serialization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
074232d to
3bec486
Compare
Remove the generate, generateAndDownload, and download endpoints from ClientAttributeCertificateResource. These endpoints stored private keys in client attributes, which is a security concern. Clients must now generate keys locally and upload only the certificate/public key.
Changes:
- Remove REST endpoints and admin client methods (Java +
TypeScript)
- Remove privateKey field from CertificateRepresentation
(Java + TS)
- Remove SAML private key storage (SamlClient,
SamlConfigAttributes, TypedClientAttribute,
SamlProtocolFactory, CertificateInfoHelper)
- Update SAML installation providers to use placeholder
for private keys
- Delete ExportSamlKeyDialog, make SamlKeysDialog
import-only
- Remove GenerateKeyDialog component, keep KeyForm for
import flows
- Add Liquibase migration to drop private key columns
from client attrs
- Update all tests to generate keys locally instead of
via server API
- Add upgrade documentation in changes-27_0_0.adoc
Closes keycloak#49238
Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
5714ae3 to
9d25dfd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated no new comments.
Suppressed comments (4)
model/jpa/src/main/resources/META-INF/jpa-changelog-27.0.0.xml:22
- The removed endpoint accepted any
{attr}value and stored the key as<attr>.private.key, so this allowlist leaves private keys generated under custom prefixes in the database. Delete every attribute whose name ends in.private.keyto satisfy the migration's security goal.
<where>NAME IN ('saml.signing.private.key', 'saml.encryption.private.key', 'jwt.credential.private.key')</where>
services/src/main/java/org/keycloak/services/clienttype/client/TypedClientAttribute.java:71
- Removing these typed attributes without removing
saml.encryption.private.keyandsaml.signing.private.keyfromservices/src/main/resources/keycloak-default-client-types.json:182,218leaves the global SAML client type API advertising options that the delegate no longer recognizes. Remove both JSON properties as part of this change.
SAML_ENCRYPTION_CERTIFICATE("saml.encryption.certificate", null),
integration/admin-client-core/src/main/java/org/keycloak/admin/client/resource/ClientAttributeCertificateResource.java:46
- This admin-client Javadoc still says
/uploadcan upload a private key, although the server now extracts only the certificate. Update it so consumers are not told that removed behavior remains supported.
* Upload certificate and eventually private key
js/libs/keycloak-admin-client/src/resources/clients.ts:998
- The admin-client README still lists all three removed methods/endpoints at
js/libs/keycloak-admin-client/README.md:285-287. Update that API documentation together with this removal so users are not directed to nonexistent operations.
public uploadKey = this.makeUpdateRequest<
9d25dfd to
2229fdd
Compare
These exports reference a deleted file and a removed component. Closes keycloak#49238 Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
2229fdd to
bb1a53f
Compare
These exports reference a deleted file and a removed component. Closes keycloak#49238 Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.federation.ldap.LDAPSearchForUsersPaginationTest#testPagination |
These exports reference a deleted file and a removed component. Closes keycloak#49238 Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
These exports reference a deleted file and a removed component. Closes keycloak#49238 Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
Remove deprecated client key generation REST endpoints
Remove the generate, generateAndDownload, and download endpoints from ClientAttributeCertificateResource. These endpoints stored private keys in client attributes, which is a security concern. Clients must now generate keys locally and upload only the certificate/public key.
Changes:
- Remove REST endpoints and admin client methods (Java +
TypeScript)
- Remove privateKey field from CertificateRepresentation
(Java + TS)
- Remove SAML private key storage (SamlClient,
SamlConfigAttributes, TypedClientAttribute,
SamlProtocolFactory, CertificateInfoHelper)
- Update SAML installation providers to use placeholder
for private keys
- Delete ExportSamlKeyDialog, make SamlKeysDialog
import-only
- Remove GenerateKeyDialog component, keep KeyForm for
import flows
- Add Liquibase migration to drop private key columns
from client attrs
- Update all tests to generate keys locally instead of
via server API
- Add upgrade documentation in changes-27_0_0.adoc
Closes #49238