Skip to content

Commit 1c8688f

Browse files
authored
Merge pull request #61 from ryanbas21/fix/par-inline-params-rule
fix(diagnosis): stop flagging client_id as prohibited inline PAR param
2 parents 7a1ce55 + bc42519 commit 1c8688f

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@wolfcola/devtools-core': patch
3+
---
4+
5+
Fix PAR inline-params rule falsely flagging client_id alongside request_uri
6+
7+
The `par:inline-params-with-request-uri` diagnosis rule incorrectly treated `client_id` as a prohibited inline parameter. Per RFC 9126, `client_id` is required alongside `request_uri` in the authorization request after a PAR. Only truly prohibited params (`redirect_uri`, `scope`, etc.) now trigger the warning.

packages/devtools-core/src/diagnosis/diagnosis-engine.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,30 @@ describe('PAR rules', () => {
935935
const result = runFlowRules(events);
936936
expect(result.some((i) => i.id === 'par:inline-params-with-request-uri')).toBe(true);
937937
});
938+
939+
it('does not flag request_uri with only client_id', () => {
940+
const events = [
941+
makeNetworkEvent({
942+
id: 'par-valid',
943+
data: {
944+
_tag: 'network',
945+
url: 'https://auth.example.com/authorize?request_uri=urn:x&client_id=app1',
946+
method: 'GET',
947+
status: 302,
948+
requestHeaders: {},
949+
responseHeaders: {},
950+
duration: 50,
951+
},
952+
oidcSemantics: {
953+
_tag: 'oidc-semantics',
954+
oidcPhase: 'authorize',
955+
par: { requestUri: 'urn:x' },
956+
},
957+
}),
958+
];
959+
const result = runFlowRules(events);
960+
expect(result.some((i) => i.id === 'par:inline-params-with-request-uri')).toBe(false);
961+
});
938962
});
939963

940964
// ─── Expired JWT via runEventRules ────────────────────────────────────────────

packages/devtools-core/src/diagnosis/diagnosis-engine.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,7 @@ function collectParIssues(events: readonly AuthEvent[]): IssueCandidate[] {
700700
// Authorize with both request_uri AND inline params
701701
if (sem.oidcPhase === 'authorize' && sem.par?.requestUri && event.data._tag === 'network') {
702702
const url = event.data.url;
703-
const hasInlineParams =
704-
url.includes('client_id=') || url.includes('redirect_uri=') || url.includes('scope=');
703+
const hasInlineParams = url.includes('redirect_uri=') || url.includes('scope=');
705704
if (hasInlineParams) {
706705
candidates.push({
707706
dedupKey: `par:inline-params-with-request-uri:${event.id}`,

0 commit comments

Comments
 (0)