feat: add perform device-code, make update oauth2-client non-destructive, report key set in get jwk - #448
Merged
Merged
Conversation
Bumps github.com/ory/hydra/v2 to 20260727152228-962ddb5de40a. hydra's go.mod carries `replace github.com/ory/x => ./oryx` plus a placeholder x version, so MVS does not pull ory/x forward on its own and the build breaks on `undefined: prometheusx.Handler`. ory/x is therefore bumped in lockstep to its matching monorepo commit. Two user-visible changes come along with this: - `ory update oauth2-client` now PATCHes only the flags that were actually set instead of PUTing the whole client, so fields you did not pass are no longer reset to their defaults. Passing --file keeps the previous replace-everything semantics. - `ory get jwk` now emits a per-key `set` field, and the collection-level `set` is omitted when results span multiple sets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVLKg5HjkMS47rksPeVP7L
Wires hydra's device code flow command into `ory perform`, alongside `authorization-code` and `client-credentials`. No extra plumbing is needed: the command uses the same cliclient hooks as `authorization-code`, both of which client.ContextWithClient already registers, so project resolution works as-is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVLKg5HjkMS47rksPeVP7L
📝 WalkthroughWalkthroughThe cloudx CLI adds a Hydra-backed OAuth2 device-code perform command and registers it alongside existing flows. The module manifest also updates several direct and indirect dependency versions. ChangesDevice-code command support
Dependency version updates
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The Docker Image Scan gates on `severity-cutoff: critical` and started failing on GHSA-r277-6w6q-xmqw, a fail-open authentication bypass in kin-openapi's ValidationHandler.Load() via the NoopAuthenticationFunc default, affecting <= 0.143.0. This repo only uses openapi2/openapi2conv to convert Swagger 2.0 specs to OpenAPI 3.0 in `ory dev openapi migrate`, so the vulnerable validation middleware is never reached, but the scanner gates on the resolved version regardless. Converting a Swagger 2.0 fixture covering path/query/body parameters, $ref'd definitions and an accessCode security definition produces byte-identical output before and after the bump. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVLKg5HjkMS47rksPeVP7L
ory perform device-codeperform device-code, make update oauth2-client non-destructive, report key set in get jwk
shaunnkhan
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #264
Wires hydra's OAuth 2.0 Device Code flow into
ory perform, alongside the existingauthorization-codeandclient-credentialssubcommands, and bumpsgithub.com/ory/hydra/v2to pick it up.The wiring itself is five lines. No extra plumbing was needed:
NewPerformDeviceCodeCmduses the same two cliclient hooks asauthorization-code(NewClientandGetOAuth2URLOverride), andclient.ContextWithClientalready registers both context keys, so project resolution to<slug>.projects.oryapis.comworks as-is.The
-p, --portflag is passed through unmodified, matching how every other wrapped hydra command behaves. It starts a local server serving the device verification page and requires pointingurls.device.verificationathttp://127.0.0.1:<PORT>/device, so it is primarily a self-hosted debugging aid — Ory Network has its own verification UI in Account Experience. There is no shorthand collision:--projecthas no shorthand, andperform authorization-codealready binds-pto its own--port.Dependency bump
github.com/ory/hydra/v2moves to20260727152228-962ddb5de40a. hydra'sgo.modcarriesreplace github.com/ory/x => ./oryxplus a placeholderory/xversion, which MVS ignores — so bumping hydra alone leavesory/xbehind and the build fails withundefined: prometheusx.Handler.ory/xis bumped in lockstep to its matching monorepo commit.Two user-visible behavior changes ride along with the bump:
ory update oauth2-clientno longer resets fields you did not pass. It nowPATCHes only the flags actually set, instead ofPUTing the entire client. Passing--filekeeps the previous replace-everything semantics.ory get jwkoutput shape changed. Each key now carries its ownsetfield, and the collection-levelsetisomitempty, dropped when results span multiple sets. Worth noting for anything parsing that JSON.Critical CVE fix (
kin-openapi)The Docker Image Scan started failing on this branch. It gates on
severity-cutoff: critical, and the only Critical finding is GHSA-r277-6w6q-xmqw — a fail-open authentication bypass in kin-openapi'sValidationHandler.Load()via theNoopAuthenticationFuncdefault, affecting<= 0.143.0. Bumpedgithub.com/getkin/kin-openapiv0.131.0→v0.144.0.This is not a regression from this PR.
masterpins the samev0.131.0and last went green on 2026-07-22; the advisory landed after that, somasterfails the same scan if re-run today. This branch just happens to be the first PR to surface it.We are not actually exposed: the only consumer is
ory dev openapi migrate, which usesopenapi2/openapi2convfor Swagger 2.0 → OpenAPI 3.0 conversion and never touches the vulnerable validation middleware. The scanner gates on the resolved version regardless.Since that is a 13-minor-version jump on a package with no test coverage, I verified it by hand: converting a Swagger 2.0 fixture covering path/query/body parameters,
$ref'd definitions and anaccessCodesecurity definition produces byte-identical output before and after the bump.Remaining scan findings (all below the gate, none actionable here)
stdlibgo1.26.4 (CVE-2026-39822, GO-2026-4970, CVE-2026-42505, GO-2026-5856).docker/Dockerfile-builduses the floatinggolang:1.26-alpine3.22tag, so this clears itself on the next upstream image rebuild — nothing to pin.busybox,busybox-binsh,ssl_client(CVE-2025-60876)alpine:3.22base, same story.golang.org/x/crypto(GO-2026-5932)x/crypto/openpgpis unmaintained, introduced at v0 and never patched. Bumping to v0.54.0 would not clear it.Related Issue or Design Document
n/a — this exposes an already-designed upstream hydra command.
Checklist
Further comments
On the missing tests checkbox: no dedicated test was added, matching the existing pattern — neither
authorization-codenorclient-credentialshas one. Device code cannot be driven headlessly: it blocks on a human approving the user code at the verification URL. A real test would need either a live project plus browser automation or a stubbed device endpoint, which is a larger piece of work than this wiring. Happy to build that harness in a follow-up if wanted.TestUsageTemplatingwalks the full command tree and now covers the new command's help templating. Build, vet, and all non-cloudx tests pass;./cmd/cloudx/oauth2/...also passes against live staging, which covers the commands affected by the dependency bump.🤖 Generated with Claude Code
https://claude.ai/code/session_01TVLKg5HjkMS47rksPeVP7L
Summary by CodeRabbit