Skip to content

feat(users): add /user/ssh_keys CRUD API - #1444

Merged
olevski merged 2 commits into
salimkayal/feat/ssh-keysfrom
salimkayal/feat/ssh-keys_user-api
Sep 30, 2026
Merged

olevski merged 2 commits into
salimkayal/feat/ssh-keysfrom
salimkayal/feat/ssh-keys_user-api

Conversation

@SalimKayal

@SalimKayal SalimKayal commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Exposes the SSH public key store over the data-services API: GET/POST /user/ssh_keys and GET/DELETE /user/ssh_keys/{key_id}. Users can register, list, and revoke their own keys. Second PR of the three-PR SSH stack; the internal proxy endpoints follow in #1446 .

Motivation and context

#1442 added the storage foundation but nothing could reach it. This PR is the user-facing surface that lets a user manage the keys the SSH gateway will authenticate them with. Keys belong to the authenticated user, so every route is owner-scoped at the SQL level.

Behavior

  • GET /user/ssh_keys lists the caller's keys; POST /user/ssh_keys registers one (201).
  • GET /user/ssh_keys/{key_id} returns one key; DELETE /user/ssh_keys/{key_id} removes it (204, idempotent).
  • Registering a malformed/unsupported key is 422; an already-registered fingerprint is 409; a key that isn't the caller's is indistinguishable from one that doesn't exist (404).
  • public_key is canonicalized (comment stripped) and fingerprinted as ssh-keygen -l reports, so the stored fingerprint is display-ready.

Changes

  • components/renku_data_services/users/api.spec.yaml: new /user/ssh_keys and /user/ssh_keys/{key_id} paths; SSHKey, SSHKeyPost (with maxLength: 256 on name), SSHKeysList schemas.
  • components/renku_data_services/users/apispec.py: regenerated with the pinned datamodel-code-generator 0.57.0 (see Notes).
  • components/renku_data_services/users/blueprints.py: SSHKeysBP, modeled on UserSecretsBP, delegating to SSHKeyRepository and validate_unsaved_ssh_key.
  • bases/renku_data_services/data_api/{app.py,dependencies.py}: construct and wire SSHKeyRepository; register the blueprint.
  • test/utils.py: TestDependencyManager passes the new ssh_key_repo field.
  • test/bases/renku_data_services/data_api/test_ssh_keys.py: CRUD, 409 duplicate, 404/204 missing id, 422 malformed and overlong name, 401 unauthenticated, cross-user scoping.

Notes

  • No PATCH/replace endpoint: replace is delete + create.

PR Stack

@SalimKayal
SalimKayal added this pull request to stack #1445 September 14, 2026 12:33
@coveralls

coveralls commented Sep 14, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 36726908623

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit e04664f on salimkayal/feat/ssh-keys.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 85.296%

Details

  • Patch coverage: 91 of 91 lines across 4 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 34658
Covered Lines: 29562
Line Coverage: 85.3%
Coverage Strength: 1.48 hits per line

💛 - Coveralls

eikek
eikek previously approved these changes Sep 25, 2026
olevski
olevski previously approved these changes Sep 25, 2026
@SalimKayal
SalimKayal force-pushed the salimkayal/feat/ssh-keys_user-api branch from a083c50 to f78aa4b Compare September 29, 2026 13:20
@SalimKayal
SalimKayal force-pushed the salimkayal/feat/ssh-keys_store branch from 6f6f529 to 5250199 Compare September 29, 2026 13:20
@SalimKayal
SalimKayal removed this pull request from stack #1445 September 29, 2026 14:59
@SalimKayal
SalimKayal added this pull request to stack #1465 September 29, 2026 15:05
@SalimKayal
SalimKayal dismissed stale reviews from olevski and eikek via 9379d90 September 29, 2026 16:49
@SalimKayal
SalimKayal force-pushed the salimkayal/feat/ssh-keys_user-api branch from f78aa4b to 9379d90 Compare September 29, 2026 16:49
@SalimKayal
SalimKayal force-pushed the salimkayal/feat/ssh-keys_store branch from 2475761 to 5fa4a5d Compare September 29, 2026 17:46
@SalimKayal
SalimKayal force-pushed the salimkayal/feat/ssh-keys_user-api branch from 9379d90 to 02d9e65 Compare September 29, 2026 17:46
@olevski
olevski force-pushed the salimkayal/feat/ssh-keys_store branch 2 times, most recently from ef09457 to de66e6c Compare September 30, 2026 13:17
@olevski
olevski removed this pull request from stack #1465 September 30, 2026 13:50
Base automatically changed from salimkayal/feat/ssh-keys_store to salimkayal/feat/ssh-keys September 30, 2026 13:52
@olevski
olevski force-pushed the salimkayal/feat/ssh-keys branch from 92eca04 to e04664f Compare September 30, 2026 13:57
@olevski
olevski force-pushed the salimkayal/feat/ssh-keys_user-api branch from 02d9e65 to 66291c1 Compare September 30, 2026 14:01
@olevski
olevski force-pushed the salimkayal/feat/ssh-keys_user-api branch from 66291c1 to e8e2a0b Compare September 30, 2026 14:02
@olevski
olevski marked this pull request as ready for review September 30, 2026 14:03
@olevski
olevski requested review from a team and sgaist as code owners September 30, 2026 14:03
@olevski
olevski requested review from eikek and olevski September 30, 2026 14:09
@olevski
olevski merged commit 25f221a into salimkayal/feat/ssh-keys Sep 30, 2026
6 checks passed
@olevski
olevski deleted the salimkayal/feat/ssh-keys_user-api branch September 30, 2026 14:10
olevski added a commit that referenced this pull request Oct 13, 2026
* feat(users): store ssh keys (#1442)

* feat(users): add /user/ssh_keys CRUD API (#1444)

* feat: proxy api for ssh keys (#1446)

* feat(notebooks): configure proxy-to-session key secret names (#1452)

* feat: Add frontend variant as session label (#1455)

* feat(notebooks): mount proxy-to-session keys only for ssh frontends (#1458)

* feat: return ssh url for sessions with ssh frontend (#1467)

Co-authored-by: Tasko Olevski <16360283+olevski@users.noreply.github.com>
Co-authored-by: boucherjeanphi <49230173+boucherjeanphi@users.noreply.github.com>
Co-authored-by: eikek <701128+eikek@users.noreply.github.com>
Co-authored-by: Eike Kettner <eike.kettner@sdsc.ethz.ch>
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.

4 participants