-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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 SSH key generation #6006
Conversation
Great PR! Please pay attention to the following items before merging: Files matching
Files matching
Make sure to check off this list before asking for review. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6006 +/- ##
==========================================
+ Coverage 18.49% 18.67% +0.17%
==========================================
Files 2563 2582 +19
Lines 116018 116479 +461
Branches 18118 18178 +60
==========================================
+ Hits 21458 21751 +293
- Misses 93930 94090 +160
- Partials 630 638 +8
... and 31 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
packages/cli/src/Server.ts
Outdated
// set up the initial environment | ||
if (isVersionControlLicensed()) { | ||
try { | ||
await Container.get(VersionControlService).init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but you want o have the service being initialised in 2 different situations:
- When it's already set up, you just load or
- When setting up the feature (i.e. connecting a repo) then you init the service
I'm asking because conditional init could lead to issues like requiring a user restart after enabling a license for the feature to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. Same for saml, which I will change as well.
✅ All Cypress E2E specs passed |
where: { key: VERSION_CONTROL_PREFERENCES_DB_KEY }, | ||
}); | ||
if (loadedPrefs) { | ||
const prefs = jsonParse<VersionControlPreferences>(loadedPrefs.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be 100% safe, you can add this in a try...catch
block
loadedPrefs.value = settingsValue; | ||
result = await Db.collections.Settings.save(loadedPrefs); | ||
} else { | ||
result = await Db.collections.Settings.save({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but considering the key
is the primary key, I guess typeorm can correctly insert or update by simply calling save
|
||
export function isVersionControlLicensed() { | ||
const license = Container.get(License); | ||
return license.isVersionControlEnabled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got a bit confusing, we're using licensed
and enabled
to clarify this. Maybe rename the License
class method to isVersionControlLicensed
and we use this naming convention, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I used Enabled because it seems like that was the convention so far within the license class. Will rename it.
✅ All Cypress E2E specs passed |
2 similar comments
✅ All Cypress E2E specs passed |
✅ All Cypress E2E specs passed |
}; | ||
} | ||
|
||
async generateAndSaveKeyPair(keyType: 'ed25519' | 'rsa' = 'ed25519') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this function could check if a key already exists and throw an error in case it does - or at least in the future, check if there is a connected repo.
If a repo is connected, we want to prevent generating new keys at random WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really just a temporary helper function for now - once it is used in the context of the actual saving of settings, it will be adjusted to check. Right now there is just nothing to check yet and I wanted to keeps this PR small and just contain the SSH key related functions.
✅ All Cypress E2E specs passed |
1 similar comment
✅ All Cypress E2E specs passed |
✅ All Cypress E2E specs passed |
* master: (199 commits) feat(editor): Add disable template experiment (#5963) feat(core): Upgrade google-timezones-json to use the correct timezone for Sao Paulo (#6042) fix(Code Node): Update vm2 to address CVE-2023-30547 (#6039) docs: Add proprietary license text (no-changelog) (#6038) test(n8n Node): Unit tests (no-changelog) refactor: Accumulate `loadOptions` from all node versions to validate (no-changelog) (#6014) Update CHANGELOG.md feat: Add variables e2e tests (no-changelog) (#6027) fix(editor): Fix typo in SSO upgrade link (#6031) fix(editor): Add correct add variable button message when no variables created (no-changelog) (#6028) docs: Add api notice to credentials for google sheets nodes (no-changelog) (#6024) fix(Notion Node): Update credential test to not require user permissions (#6022) fix(editor): Clean up demo and template callouts from workflows page (#6023) fix(editor): Fix memory leak in Node Detail View by correctly unsubscribing from event buses (#6021) fix(editor): SettingsSidebar should disconnect from push when navigating away (#6025) fix(editor): Use fake timers in useDebounce.test.ts to make the test less flaky (no-changelog) (#6029) docs: Update the info URL for updating n8n (no-changelog) (#6018) fix(core): Improve domain and url matching for extractDomain and extractUrl (#6010) feat(core): Add SSH key generation (#6006) fix(editor): Update SSO upgrade link (#6016) ... # Conflicts: # packages/editor-ui/src/components/WorkflowShareModal.ee.vue # packages/editor-ui/src/stores/workflows.ts # packages/editor-ui/src/views/NodeView.vue
* basic prefs and ssh key generation * review change * cleanup save * lint fix
Got released with |
No description provided.