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: Add external secrets #6477

Merged
merged 119 commits into from
Aug 25, 2023
Merged

Conversation

alexgrozav
Copy link
Contributor

Github issue / Community forum post (link here to close automatically):

romainminaud and others added 26 commits May 17, 2023 15:40
* feat: add secrets page with dummy data

* chore: update api

* feat: add secrets provider modal

* feat: replace external-secrets dummy api call with actual REST api

* fix: fix externalSecrets store name

* feat: add bindings for secrets in code editor and expressions
…ub.com:n8n-io/n8n into pay-442-add-secrets-to-credentials-expressions
…ub.com:n8n-io/n8n into pay-442-add-secrets-to-credentials-expressions
…ub.com:n8n-io/n8n into pay-442-add-secrets-to-credentials-expressions
@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.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Jun 19, 2023
@alexgrozav alexgrozav marked this pull request as ready for review August 17, 2023 11:38
@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Patch coverage: 46.20% and project coverage change: +6.90% 🎉

Comparison is base (72f65dc) 25.22% compared to head (c177788) 32.12%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6477      +/-   ##
==========================================
+ Coverage   25.22%   32.12%   +6.90%     
==========================================
  Files        3160     3183      +23     
  Lines      193299   195615    +2316     
  Branches    21236    21337     +101     
==========================================
+ Hits        48754    62842   +14088     
+ Misses     143565   131784   -11781     
- Partials      980      989       +9     
Files Changed Coverage Δ
packages/cli/src/CredentialsHelper.ts 23.78% <0.00%> (-1.57%) ⬇️
packages/cli/src/InternalHooks.ts 5.70% <0.00%> (-0.06%) ⬇️
packages/cli/src/License.ts 54.25% <0.00%> (-1.18%) ⬇️
packages/cli/src/Server.ts 0.00% <0.00%> (ø)
packages/cli/src/commands/start.ts 0.00% <0.00%> (ø)
packages/cli/src/commands/webhook.ts 0.00% <0.00%> (ø)
packages/cli/src/commands/worker.ts 0.00% <0.00%> (ø)
packages/cli/src/constants.ts 100.00% <ø> (ø)
packages/cli/src/controllers/e2e.controller.ts 0.00% <ø> (ø)
...ackages/cli/src/credentials/credentials.service.ts 75.19% <0.00%> (ø)
... and 66 more

... and 92 files with indirect coverage changes

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

Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

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

I've reviewed BE only but I've also found something that affects FE so might be worth checking with @alexgrozav how to address this.

packages/cli/src/CredentialsHelper.ts Outdated Show resolved Hide resolved
packages/cli/src/CredentialsHelper.ts Outdated Show resolved Hide resolved
});

async function fetchAllSecrets() {
state.secrets = await externalSecretsApi.getExternalSecrets(rootStore.getRestApiContext);
Copy link
Contributor

Choose a reason for hiding this comment

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

Running n8n as non-owner is causing this endpoint to return 403, causing the UI to break when browsing /credentials

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we discussed opening up the endpoint. Did you guys decide against that? Should I handle this on the front end instead?

Copy link
Contributor

@mutdmour mutdmour left a comment

Choose a reason for hiding this comment

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

nice. love it

const image = computed(
() =>
({
doppler,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will add doppler support sometime soon. It'll allow back end to add the integration without any front end intervention.

Copy link
Contributor

Choose a reason for hiding this comment

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

seems like tech debt until we do it..

packages/editor-ui/src/assets/images/doppler.webp Outdated Show resolved Hide resolved
(accu: boolean, value: CredentialInformation) =>
accu || (typeof value === 'string' && value.startsWith('=')),
accu ||
(typeof value === 'string' && isExpression(value) && !isTestableExpression(value)),
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm should this be or instead? if expression, then fail.. if has secret, then test..
anyways, neither seem to work now, when I test like this
Bildschirmfoto 2023-08-23 um 14 24 43

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@valya I think you worked on this part. Can you check and answer please?

Copy link
Contributor

Choose a reason for hiding this comment

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

It needs to be an and since the true case causes it to not be tested. Either way, it should be working now. There was a backend issue but I've sorted it now

@@ -37,12 +39,18 @@ export function datatypeCompletions(context: CompletionContext): CompletionResul

let options: Completion[] = [];

const isCredential = isCredentialsModalOpen();
Copy link
Contributor

Choose a reason for hiding this comment

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

can we update the completion tests? and add some e2e tests for this?

Comment on lines +27 to +29
infisical: {
siteURL: 'https://app.infisical.com',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we setting the default here if we are getting the providers from the BE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Requested by product. I didn't like it either, but it is what it is...

Copy link
Contributor

Choose a reason for hiding this comment

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

Product requested that this be implemented on the FE? why cannot the backend return this?

Copy link
Contributor Author

@alexgrozav alexgrozav Aug 24, 2023

Choose a reason for hiding this comment

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

Because the default config is blank, and we're using the blank state of the config to determine the provider connection state. I suggested using it as a fallback and making the field optional, but there was push back for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm okay

@cypress
Copy link

cypress bot commented Aug 25, 2023

1 flaky tests on run #1999 ↗︎

0 232 0 0 Flakiness 1

Details:

🌳 pay-442-add-secrets-to-credentials-expressions 🖥️ browsers:node18.12.0-chrom...
Project: n8n Commit: c177788a6b
Status: Passed Duration: 07:56 💡
Started: Aug 25, 2023 8:19 AM Ended: Aug 25, 2023 8:27 AM
Flakiness  cypress/e2e/24-ndv-paired-item.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > resolves expression with default item when input node is not parent, while still pairing items 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

@krynble krynble merged commit ed927d3 into master Aug 25, 2023
18 checks passed
@krynble krynble deleted the pay-442-add-secrets-to-credentials-expressions branch August 25, 2023 08:33
@github-actions github-actions bot mentioned this pull request Aug 31, 2023
netroy added a commit that referenced this pull request Aug 31, 2023
# [1.5.0](https://github.com/n8n-io/n8n/compare/n8n@1.4.0...n8n@1.5.0)
(2023-08-31)


### Bug Fixes

* **Agile CRM Node:** Fix issue with company address not working
([#6997](#6997))
([2f81652](2f81652))
* **Code Node:** Switch over to vm2 fork
([#7018](#7018))
([dfe0fa6](dfe0fa6))
* **core:** Invalid NODES_INCLUDE should not crash the app
([#7038](#7038))
([04e3178](04e3178)),
closes [#6683](#6683)
* **core:** Setup websocket keep-live messages
([#6866](#6866))
([8bdb07d](8bdb07d)),
closes [#6757](#6757)
* **core:** Throw `NodeSSLError` only for nodes that allow ignoring SSL
issues ([#6928](#6928))
([a01c3fb](a01c3fb))
* **Date & Time Node:** Dont parse date if it's not set (null or
undefined) ([#7050](#7050))
([d72f79f](d72f79f))
* **editor:** Fix sending of Ask AI tracking events
([#7002](#7002))
([fb05afa](fb05afa))
* **Microsoft Excel 365 Node:** Support for more extensions in workbook
rlc ([#7020](#7020))
([d6e1cf2](d6e1cf2))
* **MongoDB Node:** Stringify response ObjectIDs
([#6990](#6990))
([9ca990b](9ca990b))
* **MongoDB Node:** Upgrade mongodb package to address CVE-2021-32050
([#7054](#7054))
([d3f6356](d3f6356))
* **Postgres Node:** Empty return data fix for Postgres and MySQL
([#7016](#7016))
([176ccd6](176ccd6))
* **Webhook Node:** Fix URL params for webhooks
([#6986](#6986))
([596b569](596b569))


### Features

* **core:** External Secrets storage for credentials
([#6477](#6477))
([ed927d3](ed927d3))
* **core:** Add MFA ([#4767](#4767))
([2b7ba6f](2b7ba6f))
* **core:** Add filtering, selection and pagination to users
([#6994](#6994))
([b716241](b716241))
* **editor:** Debug executions in the editor
([#6834](#6834))
([c833078](c833078))
* **RSS Read Node:** Add support for self signed certificates
([#7039](#7039))
([3b9f0fe](3b9f0fe))

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

janober commented Aug 31, 2023

Got released with n8n@1.5.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 ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants