Skip to content

fix(editor): Hide client secret field in resolver when user info endpoint is selected#26340

Merged
cstuncsik merged 4 commits intomasterfrom
iam-142-do-not-display-client-secret-field-in-resolver-when-user-v2
Feb 27, 2026
Merged

fix(editor): Hide client secret field in resolver when user info endpoint is selected#26340
cstuncsik merged 4 commits intomasterfrom
iam-142-do-not-display-client-secret-field-in-resolver-when-user-v2

Conversation

@cstuncsik
Copy link
Contributor

Summary

When configuring an OAuth2 credential resolver with the "UserInfo Endpoint" validation method, the clientId and clientSecret fields are now correctly hidden. The backend already defined displayOptions on these fields, but the frontend modal was not evaluating them. This adds NodeHelpers.displayParameterPath filtering to resolverProperties in CredentialResolverEditModal.vue.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/IAM-142

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

…endpoint is selected

Add NodeHelpers.displayParameterPath filtering to CredentialResolverEditModal to respect displayOptions constraints. When the OAuth2 resolver validation method is set to "oauth2-userinfo", clientId and clientSecret fields are now hidden as they are not needed for that flow.

Resolves IAM-142

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
return selectedType.value.options.map(toNodeProperty).filter((property) => {
if (property.type === 'hidden') return false;
if (!property.displayOptions) return true;
return NodeHelpers.displayParameterPath(

Choose a reason for hiding this comment

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

resolverProperties uses resolverData.value inside its computed getter, but resolverData is declared later; if the computed runs immediately, this can throw due to temporal dead zone.

Details

✨ AI Reasoning
​​1) The new filtering logic in the computed getter reads resolverData to evaluate displayOptions.
2) resolverProperties is defined before resolverData in the script.
3) If the computed getter runs during computed creation (common to establish reactive dependencies), it will access resolverData while it is still in the temporal dead zone.
4) That makes the control flow impossible to satisfy without error: evaluating resolverProperties can crash before resolverData exists.

🔧 How do I fix it?
Trace execution paths carefully. Ensure precondition checks happen before using values, validate ranges before checking impossible conditions, and don't check for states that the code has already ruled out.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

Copy link
Contributor Author

Choose a reason for hiding this comment

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

computed() creates a lazy getter — the callback is not executed at declaration time, only when .value is first accessed. By the time any code reads resolverProperties.value, resolverData is already declared and initialized. There’s no TDZ risk here.

This is standard Vue 3 Composition API — computed properties commonly reference each other regardless of declaration order. The bot is applying a raw JS TDZ rule that doesn’t apply to lazy evaluations.

@cstuncsik cstuncsik changed the title feat(editor-ui): Hide client secret field in resolver when user info endpoint is selected fix(editor): Hide client secret field in resolver when user info endpoint is selected Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Bundle Report

Changes will increase total bundle size by 1.71kB (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
editor-ui-esm 42.52MB 1.71kB (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: editor-ui-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/worker-*.js 2.91MB 2.92MB 21725.55% ⚠️
assets/worker-*.js -2.91MB 13.37kB -99.54%
assets/index-*.js 233 bytes 1.13MB 0.02%
assets/users.store-*.js 44 bytes 1.06MB 0.0%
assets/index-*.css 20 bytes 768.6kB 0.0%
assets/useCanvasMapping-*.js 85 bytes 442.64kB 0.02%
assets/useCanvasMapping-*.css 70 bytes 113.16kB 0.06%
assets/DataTableView-*.js 934 bytes 13.03kB 7.72% ⚠️
assets/ProjectCardBadge-*.js 57 bytes 9.13kB 0.63%
assets/ResourceFiltersDropdown-*.js -52 bytes 7.05kB -0.73%
assets/DataTableActions-*.js 64 bytes 6.84kB 0.95%
assets/DataTableView-*.css 308 bytes 3.65kB 9.22% ⚠️
assets/ResourceFiltersDropdown-*.css -49 bytes 3.26kB -1.48%

Files in assets/index-*.js:

  • ./src/app/components/CredentialResolverEditModal.vue → Total Size: 386 bytes

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...src/app/components/CredentialResolverEditModal.vue 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

No issues found across 2 files

Linked issue analysis

Linked issue: IAM-142: Do not display client secret field in resolver when user info endpoint is selected

Status Acceptance criteria Notes
GIVEN a user is using dynamic creds, WHEN they configure an oauth resolver and select user info endpoint, THEN the client secret field is hidden Filtering hides clientSecret when validation is oauth2-userinfo
Optionally hide client secret field Implement displayOptions-based hiding for clientSecret
Frontend evaluates displayOptions for resolver fields so UI can hide/show fields based on resolverData Added NodeHelpers.displayParameterPath usage to resolverProperties filter
UI should clearly indicate what data we need from the user (hide irrelevant inputs) Resolver modal now filters out irrelevant fields via displayOptions
Add estimations in T-Shirt sizes to the issue as requested No T-Shirt estimation added in diffs or PR description
Architecture diagram
sequenceDiagram
    participant User as User Interface
    participant Modal as CredentialResolverEditModal
    participant API as Backend API
    participant Helpers as n8n-workflow (NodeHelpers)
    participant Inputs as CredentialInputs Component

    User->>Modal: Open Edit Resolver
    
    par Fetching Definitions and Data
        Modal->>API: getCredentialResolverTypes()
        API-->>Modal: Resolver Definitions (with displayOptions)
        Modal->>API: getCredentialResolver(id)
        API-->>Modal: Current Resolver Config (e.g. validation method)
    end

    Note over Modal,Helpers: NEW: Compute visible fields dynamically

    loop For each property in definition
        Modal->>Helpers: NEW: displayParameterPath(resolverData, property)
        
        alt Property "displayOptions" matches current data
            Helpers-->>Modal: Return true (Visible)
        else Property "displayOptions" does not match
            Note right of Helpers: e.g. "oauth2-userinfo" selected,<br/>hiding "clientSecret"
            Helpers-->>Modal: Return false (Hidden)
        end
    end

    Modal->>Inputs: CHANGED: Pass filtered "credentialProperties"
    
    Note over Inputs: Renders only properties that<br/>passed displayOptions check

    Inputs-->>User: Display fields (Client ID/Secret hidden if applicable)
Loading

Verifies fields dynamically hide when user switches validation method
from oauth2-introspection to oauth2-userinfo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Feb 27, 2026
@cstuncsik cstuncsik requested review from a team, BGZStephen, afitzek, guillaumejacquart and phyllis-noester and removed request for a team February 27, 2026 13:59
- Extract createCredentialInputsSpy() to deduplicate test setup
- Replace Options API updated() with Composition API watch() for prop capture
- Add create-mode test verifying CredentialInputs doesn't render without type selection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/frontend/editor-ui/src/app/components/CredentialResolverEditModal.test.ts">

<violation number="1" location="packages/frontend/editor-ui/src/app/components/CredentialResolverEditModal.test.ts:395">
P3: This test doesn't exercise or assert any displayOptions filtering in create mode, so it's effectively a placeholder and risks masking missing coverage. Either remove it or simulate selecting the OAuth type and assert the filtered fields.

(Based on your team's feedback about avoiding vacuous tests.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@guillaumejacquart guillaumejacquart left a comment

Choose a reason for hiding this comment

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

Looks good to me !

The test didn't exercise any filtering logic — it only verified
CredentialInputs doesn't render without a type selected, which is
unrelated to displayOptions. The filtering code path is identical
for create and edit mode and is already covered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cstuncsik cstuncsik enabled auto-merge February 27, 2026 14:59
@cstuncsik cstuncsik added this pull request to the merge queue Feb 27, 2026
Merged via the queue into master with commit c320383 Feb 27, 2026
45 checks passed
@cstuncsik cstuncsik deleted the iam-142-do-not-display-client-secret-field-in-resolver-when-user-v2 branch February 27, 2026 15:32
@n8n-assistant n8n-assistant bot mentioned this pull request Mar 2, 2026
Tuukkaa pushed a commit that referenced this pull request Mar 2, 2026
…oint is selected (#26340)

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This was referenced Mar 3, 2026
@n8n-assistant
Copy link
Contributor

n8n-assistant bot commented Mar 3, 2026

Got released with n8n@2.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants