Skip to content

Roq Editor: use SSH agent for git sync and remove passphrase from JSON-RPC - #933

Merged
ia3andy merged 2 commits into
quarkiverse:mainfrom
omatheusmesmo:feat/editor-ssh-agent-git-sync
May 23, 2026
Merged

ia3andy merged 2 commits into
quarkiverse:mainfrom
omatheusmesmo:feat/editor-ssh-agent-git-sync

Conversation

@omatheusmesmo

Copy link
Copy Markdown
Contributor

Describe your changes

The git sync feature previously prompted for the SSH passphrase via a dialog in
the Dev UI and sent it over JSON-RPC to the server. This exposes credentials
through the browser unnecessarily.

This PR removes the passphrase from the client-server interface entirely and
replaces it with two server-side mechanisms, in priority order:

  1. SSH agent - JGit now connects to the system SSH agent (ssh-agent, macOS Keychain, Pageant) via ConnectorFactory. The factory is loaded using the deployment classloader explicitly, which fixes a ServiceLoader visibility issue in Quarkus that caused ConnectorFactory.getDefault() to silently return null and fall back to direct key loading.

  2. EDITOR_SYNC_SSH_PASSPHRASE env var - a server-side-only fallback for passphrase-protected keys when no SSH agent is running. The property is annotated @JsonIgnore so it is never serialized to the browser via addBuildTimeData.

Other changes included:

  • Passphrase dialog and all related frontend code removed
  • lastAuthFailed volatile field preserves auth-failed status across skipFetch polls (previously, auth failure reverted to "up to date" on next poll without a real fetch)
  • filePaths in publish are now filtered through GitContentFilter before staging, preventing accidental commits of files outside the content directory

@omatheusmesmo
omatheusmesmo requested a review from a team as a code owner May 22, 2026 17:47
@github-actions

github-actions Bot commented May 22, 2026 •

Copy link
Copy Markdown

🙈 The PR is closed and the preview is expired.

@omatheusmesmo

This comment was marked as outdated.

@omatheusmesmo
omatheusmesmo force-pushed the feat/editor-ssh-agent-git-sync branch from 5433049 to a95d2d6 Compare May 22, 2026 18:24
@omatheusmesmo
omatheusmesmo marked this pull request as draft May 22, 2026 18:39
@omatheusmesmo
omatheusmesmo force-pushed the feat/editor-ssh-agent-git-sync branch from a95d2d6 to c93332a Compare May 22, 2026 22:16
@omatheusmesmo omatheusmesmo changed the title Feat/editor ssh agent git sync Roq Editor: use SSH agent for git sync and remove passphrase from JSON-RPC May 22, 2026
@omatheusmesmo
omatheusmesmo marked this pull request as ready for review May 22, 2026 23:57

@ia3andy ia3andy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome it works like a charm!

@ia3andy

ia3andy commented May 23, 2026 •

Copy link
Copy Markdown
Collaborator

@omatheusmesmo could you fetch and rebase ? i will release today

@ia3andy

ia3andy commented May 23, 2026

Copy link
Copy Markdown
Collaborator

I think it's just a moved file AFAIK

@omatheusmesmo

Copy link
Copy Markdown
Contributor Author

Awesome it works like a charm!

Thanks!

@omatheusmesmo could you fetch and rebase ? i will release today

Sure, give me a few minutes.

@ia3andy

ia3andy commented May 23, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

omatheusmesmo and others added 2 commits May 23, 2026 12:07
…-RPC

The editor git sync no longer sends SSH passphrases from the browser over
JSON-RPC. JGit now uses the system SSH agent (macOS Keychain, ssh-agent,
Pageant) via ConnectorFactory, with an optional server-side
EDITOR_SYNC_SSH_PASSPHRASE fallback for passphrase-protected keys without
an agent.

- Enable SSH agent support in GitTransportHelper
- Add editor.sync.ssh-passphrase config (JsonIgnore, never sent to the browser)
- Remove the passphrase parameter from GitSyncService, the JSON-RPC actions
  and the Dev UI; drop the passphrase dialog and point auth failures to config
- Validate publish filePaths through GitContentFilter so only content-directory
  files can be staged via the editor

* Fix quarkiverse#925

Signed-off-by: Matheus Oliveira <[email protected]>
…ng and test

- Remove configuredPassphrase parameter from private methods, read field directly
- Add LOG.debug when SSH agent ConnectorFactory is not found via ServiceLoader
- Add test for lastAuthFailed recovery (successful fetch clears the flag)
- Fix stale @PARAM javadoc entries


Signed-off-by: Matheus Oliveira <[email protected]>
@omatheusmesmo
omatheusmesmo force-pushed the feat/editor-ssh-agent-git-sync branch from 451a27d to 44d90c8 Compare May 23, 2026 15:14
@ia3andy
ia3andy merged commit 10445c1 into quarkiverse:main May 23, 2026
4 checks passed
mathecruz pushed a commit to mathecruz/quarkus-roq that referenced this pull request Jun 25, 2026
…N-RPC (quarkiverse#933)

* feat: Use SSH agent for editor git sync and drop passphrase from JSON-RPC

The editor git sync no longer sends SSH passphrases from the browser over
JSON-RPC. JGit now uses the system SSH agent (macOS Keychain, ssh-agent,
Pageant) via ConnectorFactory, with an optional server-side
EDITOR_SYNC_SSH_PASSPHRASE fallback for passphrase-protected keys without
an agent.

- Enable SSH agent support in GitTransportHelper
- Add editor.sync.ssh-passphrase config (JsonIgnore, never sent to the browser)
- Remove the passphrase parameter from GitSyncService, the JSON-RPC actions
  and the Dev UI; drop the passphrase dialog and point auth failures to config
- Validate publish filePaths through GitContentFilter so only content-directory
  files can be staged via the editor

* Fix quarkiverse#925

Signed-off-by: Matheus Oliveira <[email protected]>

* Review improvements: remove passphrase parameter threading, add logging and test

- Remove configuredPassphrase parameter from private methods, read field directly
- Add LOG.debug when SSH agent ConnectorFactory is not found via ServiceLoader
- Add test for lastAuthFailed recovery (successful fetch clears the flag)
- Fix stale @PARAM javadoc entries


Signed-off-by: Matheus Oliveira <[email protected]>

---------

Signed-off-by: Matheus Oliveira <[email protected]>
Co-authored-by: Andy Damevin <[email protected]>
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.

Roq Editor: use SSH agent for git sync and remove passphrase from JSON-RPC

2 participants