Skip to content

Feat/credential key suggestions - #317

Open
DivineAvi wants to merge 3 commits into
Infisical:mainfrom
DivineAvi:feat/credential-key-suggestions
Open

Feat/credential key suggestions#317
DivineAvi wants to merge 3 commits into
Infisical:mainfrom
DivineAvi:feat/credential-key-suggestions

Conversation

@DivineAvi

@DivineAvi DivineAvi commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #316

Every credential-reference field in the Add/Edit Service sheet now offers the vault's stored credential keys instead of requiring the key name to be typed from memory:

Summary

  • Wires the bearer/basic/api-key credential fields and the URL-substitution key field in the Add/Edit Service sheet into the existing Combobox, sourced from GET /v1/credentials — shows all vault keys on focus, filters as you type, and still allows free text.
  • Adds a new TemplateInput component for custom header values that opens a credential picker when the caret sits inside an unclosed {{ ... }} placeholder and inserts {{ KEY }} on selection.
  • Both suggestion popovers are position:fixed portals that now track their anchor input on ancestor scroll/resize, so they don't strand when the sheet body scrolls.
  • Suggestions degrade silently to plain inputs if /v1/credentials is unavailable.
  • Fixed Issue of ComboBox getting stranded at on place on scrolling the container.

Screenshots-

image image image

DivineAvi added 2 commits July 6, 2026 11:10
Every credential-reference field in the Add/Edit Service sheet now
offers the vault's stored credential keys instead of requiring the
key name to be typed from memory:

- bearer/basic/api-key credential fields and the URL-substitution
  key use the existing Combobox (all keys on focus, filter as you
  type, free text still allowed)
- custom header values get a new TemplateInput that opens a
  credential picker when the caret is inside an unclosed {{ ... }}
  placeholder and inserts "{{ KEY }}" on selection
- both popovers are position:fixed portals, so they now track their
  input on ancestor scroll/resize instead of staying stranded when
  the sheet body scrolls

Suggestions come from GET /v1/credentials for the vault and degrade
silently to plain inputs when the list is unavailable.
The suggestion popovers only styled their scrollbar via the Firefox-only
scrollbar-width/scrollbar-color properties, so on Chromium/WebKit the
list was scrollable past its max-h-64 cap but showed no visible
scrollbar until dragged. Adds a shared .thin-scrollbar utility with
::-webkit-scrollbar rules and applies it to Combobox, TemplateInput,
and CreatableSelect.

Also caps the URL-substitution key popover at a shorter max-height
since it sits low in the sheet and was overflowing past the bottom
of the screen at the default height.
@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR wires all credential-reference fields in the Add/Edit Service sheet to autocomplete from the vault's stored credential keys (GET /v1/credentials), replacing plain Input elements with a Combobox for direct key fields and a new TemplateInput for header-value templates that activates on {{. Both suggestion popovers are position:fixed portals that reposition on ancestor scroll/resize.

  • Combobox.tsx: Adds scroll/resize tracking to keep the fixed popover aligned, plus two new customisation props used by the inline URL-substitution variant.
  • TemplateInput.tsx: New component that parses the unclosed {{ token at the caret, filters credential keys as you type, and splices {{ KEY }} on selection — correctly closed on blur and dismissable with Escape.
  • ServicesTab.tsx: Fetches credential keys at mount, passes them down to ServiceModal, and replaces five Input fields with Combobox / TemplateInput. The removed onKeyDown Enter handlers on bearer/basic/api-key fields are not replaced with an onEnter prop on Combobox.

Confidence Score: 3/5

The credential-suggestion UX is a welcome improvement, but the Combobox dropdown not closing on keyboard tab-out means it can strand a fixed overlay over the form, which affects every auth field that was converted.

The Combobox input has no onBlur handler, so focusing a field and then tabbing away leaves the position:fixed popover stranded on screen — this is visible on every converted auth field (bearer, basic username/password, api-key). The removed onKeyDown Enter handlers on those same fields are not replaced, so keyboard-only form submission no longer works from those inputs despite being intentional in the prior implementation.

web/src/components/Combobox.tsx needs an onBlur close handler; web/src/pages/vault/ServicesTab.tsx needs onEnter support wired to handleSubmit for the credential key comboboxes.

Important Files Changed

Filename Overview
web/src/components/Combobox.tsx Adds scroll/resize repositioning for the fixed popover and two new props (inputClassName, menuMaxHeightClassName). Missing onBlur means the dropdown stays open when the user tabs away.
web/src/components/TemplateInput.tsx New component for template-string header values; correctly tracks caret position, opens a credential picker on {{, inserts {{ KEY }}, and closes the popover on blur. Logic is sound.
web/src/pages/vault/ServicesTab.tsx Wires credential-key suggestions into all auth fields. fetchCredentialKeys uses a dual-shape response fallback and the removed onKeyDown Enter handlers break keyboard submission from the affected fields.
web/src/components/CreatableSelect.tsx Scrollbar styles migrated from inline style props to the shared thin-scrollbar CSS class — cosmetic only, no functional change.
web/src/styles/theme.css Adds .thin-scrollbar utility class covering both Firefox (scrollbar-width/scrollbar-color) and WebKit (::-webkit-scrollbar-*) — correct and complete.

Comments Outside Diff (1)

  1. web/src/components/Combobox.tsx, line 120-121 (link)

    P1 Dropdown stays open when tabbing away

    The Combobox input has no onBlur handler, so if a user focuses the field (which opens the popover) and then tabs to the next field with the keyboard, the position:fixed dropdown remains visible over the rest of the form. TemplateInput correctly closes its popover in onBlur; the same pattern is needed here. Adding onBlur={() => setOpen(false)} to the <input> element would close the popover when focus leaves the field.

Reviews (1): Last reviewed commit: "fix(web): themed scrollbar for credentia..." | Re-trigger Greptile

Comment thread web/src/pages/vault/ServicesTab.tsx
Comment thread web/src/pages/vault/ServicesTab.tsx
…redential parsing

Addresses Greptile review on Infisical#317: the popover stranded open when
tabbing away, Enter no longer submitted the form from converted auth
fields, and fetchCredentialKeys guessed at two response shapes when
the API only ever returns `keys`.
@DivineAvi

Copy link
Copy Markdown
Author

@jakehulberg
Hi Jake, I have added the Credential key suggestion popover in Service Edit Tab with this pull request.
Could you please help review it ?

@infisical-cla-app

Copy link
Copy Markdown

📝 Contributor License Agreement required

Before this PR can merge, every contributor must sign the Infisical CLA.
Signing is quick: sign in with GitHub, review the CLA, and accept.

👉 Sign the CLA

Still needs to sign:

Once everyone has signed, the check updates automatically — no need to close and reopen the PR.

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.

Suggest stored credential keys in the Add/Edit Service form

1 participant