Skip to content

feat(cli)!: Add "certificate generate" command - #1560

Merged
matz3 merged 8 commits into
mainfrom
generate-certificate-command
Sep 1, 2026
Merged

feat(cli)!: Add "certificate generate" command#1560
matz3 merged 8 commits into
mainfrom
generate-certificate-command

Conversation

@matz3

@matz3 matz3 commented Aug 31, 2026

Copy link
Copy Markdown
Member

Add "ui5 certificate generate" to create and install the self-signed server certificate before running the dev server. The command honors UI5_DATA_DIR and the configured UI5 data dir, skips existing certificates unless --force is used, and prints the written paths.

Change the common name of the certificate from "UI5Tooling" to "UI5CLI".

Split @ui5/server/internal/sslUtil into read-only certificate loading and explicit certificate generation. The root-password prompt now belongs to the CLI command.

BREAKING CHANGE: "ui5 serve --https" no longer generates or installs a self-signed certificate when none exists. Run "ui5 certificate generate" first, or pass --key and --cert.

JIRA: CPOUI5FOUNDATION-1347

See: #1532 (comment)

@matz3
matz3 requested a review from a team August 31, 2026 14:50
Add "ui5 certificate generate" to create and install the self-signed server certificate before running the dev server. The command honors
UI5_DATA_DIR and the configured UI5 data dir, skips existing certificates unless --force is used, and prints the written paths.

Split @ui5/server/internal/sslUtil into read-only certificate loading and explicit certificate generation. The root-password prompt now
belongs to the CLI command.

BREAKING CHANGE: "ui5 serve --https" no longer generates or installs a self-signed certificate when none exists. Run
"ui5 certificate generate" first, or pass --key and --cert.

JIRA: CPOUI5FOUNDATION-1347
@matz3
matz3 force-pushed the generate-certificate-command branch from fab2d32 to 3d6b1ce Compare August 31, 2026 14:54
Comment thread packages/cli/lib/cli/commands/serve.js Outdated
Comment thread packages/cli/lib/cli/commands/serve.js Outdated
Comment thread packages/cli/test/lib/cli/commands/certificate.js Outdated
d3xter666
d3xter666 previously approved these changes Sep 1, 2026

@d3xter666 d3xter666 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@RandomByte

Copy link
Copy Markdown
Member

ui5 certificate generate asked me to close Firefox and press enter once done. I did that but now the command just hangs after the certificates have been generated. Firefox does not open. However it does trust the generated certificate (note that the issuer still reads as UI5Tooling)

@RandomByte RandomByte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just some wording feedback/proposals. See my earlier comment regarding Firefox for an actual issue.

Comment thread internal/documentation/docs/updates/migrate-v5.md Outdated
Comment thread packages/cli/lib/cli/commands/serve.js Outdated
Comment thread packages/cli/lib/cli/commands/serve.js Outdated
@matz3
matz3 force-pushed the generate-certificate-command branch from 7d58b3d to 40c3e1e Compare September 1, 2026 09:47
@matz3

matz3 commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

ui5 certificate generate asked me to close Firefox and press enter once done. I did that but now the command just hangs after the certificates have been generated. Firefox does not open. However it does trust the generated certificate (note that the issuer still reads as UI5Tooling)

Fixed now. This issue was not visible before, because the server was running after creating the certificate.

I've also adjusted the certificate name to "UI5 CLI".

Co-authored-by: Merlin Beutlberger <merlin.lab@me.com>
@matz3
matz3 requested a review from RandomByte September 1, 2026 09:51
This reverts commit a8dccc2256487f20e0a57308f7dd2ab2c382d700.
devcert-sanscache leaves event-loop handles open after generating and
installing the certificate: it resumes stdin to wait for the user to
confirm the browser import without pausing it again, and its Firefox
flow starts an HTTP server that is never closed. On Windows that Firefox
flow runs unconditionally, so the process would hang on every run; on
macOS/Linux it hangs whenever certutil is unavailable or Firefox is
open.

Exit the process explicitly with code 0 once generation has completed
and the result has been reported, tearing down any leaked handles
regardless of platform.
@flovogt

flovogt commented Sep 1, 2026

Copy link
Copy Markdown
Member

LGTM

@matz3

matz3 commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

I have also tested on Windows and noticed a different issue, which should be resolved now. For me it worked as expected to generate a certificate and use it with --https. I will test again with Firefox installed on Windows, but I assume that the process.exit(0) solution will work even if there is something else hanging.

@matz3

matz3 commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

I did not get any confirmation or dialog for Firefox on Windows, but the certificate worked and was trusted.

@matz3
matz3 merged commit af98631 into main Sep 1, 2026
78 checks passed
@matz3
matz3 deleted the generate-certificate-command branch September 1, 2026 12:29
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.

4 participants