feat: add support for OAuth clientCredential and password flows in Respect core#2824
feat: add support for OAuth clientCredential and password flows in Respect core#2824harshit078 wants to merge 17 commits into
Conversation
🦋 Changeset detectedLatest commit: 637545a The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| values, | ||
| ctx, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Exchanged token not persisted
Medium Severity
After OAuth2 token exchange, the new accessToken is assigned only on the local values object built via Object.fromEntries, not on security.values on the step/workflow. Later runtime expressions or steps that read x-security.values.accessToken never see the exchanged token even though the current request gets the Bearer header.
Reviewed by Cursor Bugbot for commit cda6f48. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9ef677b. Configure here.
|
|
||
| if (flows?.password) { | ||
| return ['username', 'password']; | ||
| } |
There was a problem hiding this comment.
Dual-flow OAuth validation mismatch
Medium Severity
getRequiredValuesForOAuth2 always requires clientId and clientSecret when clientCredentials is declared, even if both flows exist and only username/password are provided. That disagrees with the lint rule, which accepts either credential set.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 9ef677b. Configure here.


What/Why/How?
x-securityschemes with thepasswordandclientCredentialsflows.tokenUrland applyAuthorization: Bearerto the request, which allows to manually obtain aaccessTokenReference
#2122
Testing
Screenshots (optional)
Check yourself
Security
Note
High Risk
Adds outbound token requests and handling of client secrets/passwords in Respect; misconfiguration or logging could expose credentials, though secrets are added to
secretsSetfor masking.Overview
Respect now performs OAuth2 token exchange for Arazzo
x-securitywhenclientCredentialsorpasswordflows are declared: it POSTs totokenUrl, caches tokens onTestContext.oauth2TokenCache, and appliesAuthorization: Beareron workflow requests. A pre-setaccessTokenstill skips the exchange.Linting and runtime validation no longer treat every OAuth2 scheme as requiring only
accessToken. Thex-security-scheme-required-valuesrule andvalidateXSecurityParametersrequire flow-specific credentials (clientId/clientSecret,username/password, oraccessTokenfor non-exchangeable flows such as implicit).resolveXSecurityParametersis async end-to-end throughprepare-request.Also adds
exchange-oauth2-token(Basic vs body client auth, scope handling, secret masking) with unit/integration tests, a new AsyncAPI 3security-definedrule module, and minor e2e snapshot updates for config assertion subject types (ActionParameters,ActionParameter).Reviewed by Cursor Bugbot for commit 637545a. Bugbot is set up for automated code reviews on this repo. Configure here.