Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add rsa option to ssh key generation #7154

Merged

Conversation

flipswitchingmonkey
Copy link
Contributor

PR adds a new field to the SourceControlPreferences as well as to the POST parameters for the source-control/preferences and source-control/generate-key-pair endpoints. Both now accept an optional string parameter keyGeneratorType of 'ed25519' | 'rsa'

Calling the source-control/generate-key-pair endpoint with the parameter set, it will also update the stored preferences accordingly (so that in the future new keys will use the same method)

By default ed25519 is being used. The default may be changed using a new environment parameter:

N8N_SOURCECONTROL_DEFAULT_SSH_KEY_TYPE which can be rsa or ed25519

RSA keys are generated with a length of 4096 bytes.

@github-actions
Copy link
Contributor

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Make sure to check off this list before asking for review.

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Patch coverage: 57.14% and project coverage change: +0.01% 🎉

Comparison is base (0c6169e) 32.40% compared to head (148e881) 32.41%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7154      +/-   ##
==========================================
+ Coverage   32.40%   32.41%   +0.01%     
==========================================
  Files        3278     3279       +1     
  Lines      198018   198031      +13     
  Branches    21647    21642       -5     
==========================================
+ Hits        64174    64200      +26     
+ Misses     132783   132771      -12     
+ Partials     1061     1060       -1     
Files Changed Coverage Δ
packages/cli/src/config/schema.ts 37.50% <ø> (ø)
...ourceControl/types/sourceControlGenerateKeyPair.ts 0.00% <0.00%> (ø)
...ts/sourceControl/types/sourceControlPreferences.ts 82.35% <50.00%> (+9.01%) ⬆️
...urceControl/sourceControlPreferences.service.ee.ts 65.16% <70.00%> (+25.40%) ⬆️
...ments/sourceControl/sourceControl.controller.ee.ts 31.18% <75.00%> (+5.09%) ⬆️
...vironments/sourceControl/sourceControlHelper.ee.ts 92.30% <100.00%> (+3.84%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Sep 12, 2023
@flipswitchingmonkey flipswitchingmonkey marked this pull request as ready for review September 13, 2023 08:26
@@ -118,7 +118,7 @@ export class SourceControlController {
) {
await this.sourceControlService.setBranch(sanitizedPreferences.branchName);
}
if (sanitizedPreferences.branchColor || sanitizedPreferences.branchReadOnly !== undefined) {
if (sanitizedPreferences.branchColor ?? sanitizedPreferences.branchReadOnly !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this assign the value of sanitizedPreferences.branchReadOnly !== undefined (which should be a boolean) to sanitizedPreferences.branchColor if the latter is nullish? Is this the intended behavior?

@flipswitchingmonkey flipswitchingmonkey changed the title fix(core): Add rsa option to ssh key generation feat(core): Add rsa option to ssh key generation Sep 13, 2023
@cypress
Copy link

cypress bot commented Sep 14, 2023

1 flaky test on run #2172 ↗︎

0 239 0 0 Flakiness 1

Details:

🌳 pay-814-add-rsa-option-to-ssh-key-generation 🖥️ browsers:node18.12.0-chrome1...
Project: n8n Commit: 148e881fd1
Status: Passed Duration: 07:26 💡
Started: Sep 14, 2023 9:11 AM Ended: Sep 14, 2023 9:18 AM
Flakiness  cypress/e2e/5-ndv.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > should show validation errors only after blur or re-opening of NDV Output Screenshots Video

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@flipswitchingmonkey flipswitchingmonkey merged commit fdac2c8 into master Sep 14, 2023
@flipswitchingmonkey flipswitchingmonkey deleted the pay-814-add-rsa-option-to-ssh-key-generation branch September 14, 2023 09:34
@github-actions github-actions bot mentioned this pull request Sep 20, 2023
krynble added a commit that referenced this pull request Sep 20, 2023
# [1.8.0](https://github.com/n8n-io/n8n/compare/n8n@1.7.0...n8n@1.8.0)
(2023-09-20)


### Bug Fixes

* **core:** Make parsing of content-type and content-disposition headers
more flexible ([#7217](#7217))
([d41546b](d41546b)),
closes [#7149](#7149)
* **core:** Resolve domains to IPv4 first
([#7206](#7206))
([e9ce531](e9ce531))
* **editor:** Add ssh key type selection to source control settings when
regenerating key ([#7172](#7172))
([54bf66d](54bf66d))
* **editor:** No need to add click emitting click events, VUE delegates
the handler to the root element of the component
([#7182](#7182))
([3c055e4](3c055e4))
* **editor:** Prevent duplicate creation of credential for OAuth2
([#7163](#7163))
([07a6417](07a6417))
* **editor:** Testing flaky resource mapper feature in e2e tests
([#7165](#7165))
([aaf87c3](aaf87c3))
* **HTML Node:** Add pairedItem support for 'Convert to HTML Table'
operation ([#7196](#7196))
([6bc477b](6bc477b))
* **HTTP Request Node:** Decrease default timeout to 5min
([#7177](#7177))
([321780d](321780d))
* **seven Node:** Rename sms77 to seven, fix credentials test
([#7180](#7180))
([cf776b8](cf776b8))
* **X (Formerly Twitter) Node:** Rename Twitter to X (keep Twitter
alias) ([#7179](#7179))
([d317e09](d317e09))


### Features

* **core:** Add command to trigger license refresh on workers
([#7184](#7184))
([9f797b9](9f797b9))
* **core:** Add rsa option to ssh key generation
([#7154](#7154))
([fdac2c8](fdac2c8))
* **Linear Node:** Add support for OAuth2
([#7201](#7201))
([12a3168](12a3168))
* **Microsoft Outlook Node:** Node overhaul
([#4449](#4449))
([556a613](556a613))
* **Set Node:** Overhaul
([#6348](#6348))
([3a47455](3a47455))

Co-authored-by: krynble <krynble@users.noreply.github.com>
@janober
Copy link
Member

janober commented Sep 21, 2023

Got released with n8n@1.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants