Search interop runner compares results as JSON strings, so member order decides PASS/FAIL

Open Beginner friendly
#693 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #736 by @nikhilred2619 — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
api, testing

Research direction

Start in interop/authzen-search-demo/test-harness/src/runner.ts and inspect how the sorted results are serialized and compared. Preserve the null-stripping behavior while comparing parsed values rather than JSON strings, then run the interop search cases and confirm that equivalent member orders pass, including the Subject and Resource Search cases.

Written by the indexing model from the issue text.

Description

interop/authzen-search-demo/test-harness/src/runner.ts sorts the actual and expected results arrays, then compares them as strings:

const actualJson = JSON.stringify(sortedActualResults, (_, value) => value === null ? undefined : value);
const expectedjson = JSON.stringify(sortedExpectedResults, (_, value) => value === null ? undefined : value);

return actualJson === expectedjson ? "PASS" : "FAIL"

JSON.stringify keeps the member order of the parsed response, so a PDP that returns {"id": "alice", "type": "user"} fails a case that expects {"type": "user", "id": "alice"}. RFC 8259 Section 4 defines an object as an unordered collection, and Section 8 of the Authorization API does not constrain member order in results.

This fails all 78 Subject and Resource Search cases (of 198) for a PDP whose encoder sorts keys, which is the default for Go maps. Action Search is not affected since its entities only have name.

Comparing the parsed values instead, for example with util.isDeepStrictEqual from Node, removes the dependency on member order. The null-stripping replacer can still be applied first.

Dominant language
TypeScript
Stars
170
Forks
46
Avg merge
18h 5m
Merged PRs (30d)
43

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openid/authzen

All issues in openid/authzen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.