openid / openid/authzen

Conformance suite: pdp_auth_type=api_key is unusable with discovery, and blocks the invalid-credentials 401 module

Open
#641 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

certification
Dominant language
TypeScript
Stars
160
Forks
40
Avg merge
2d 3h
Merged PRs (30d)
23

Description

Two of the pdp_auth_type=api_key paths in the AuthZEN conformance modules do not work. Both are in the conformance suite rather than the specification; filing here since #640 is also a harness report.

api_key cannot be combined with pdp_server_metadata=discovery.

AddApiKeyAuthenticationParametersToAuthzenApiRequest reads the key from the pdp environment object:

String secret = env.getString("pdp", "api_key");

but GetPDPDynamicServerConfiguration replaces that object wholesale with the fetched metadata document:

JsonObject serverConfig = JsonParser.parseString(jsonString).getAsJsonObject();
env.putObject("pdp", serverConfig);

so the pdp.api_key supplied in the test configuration is gone by the time the first authenticated request is built. GetPDPStaticServerConfiguration puts config.pdp into the environment instead, which keeps it. Every (discovery, api_key) run therefore fails at the first authenticated condition with:

'PDP API Key' field is missing from the 'AuthZEN' section in the test configuration

Observed on all 148 applicable modules across the six AuthZEN plans. The same two variant parameters are advertised as independent, so the combination is selectable in the UI.

authzen-pdp-evaluation-invalid-credentials-returns-401 cannot run under api_key.

The module declares itself applicable to it:

@VariantNotApplicable(parameter = PDPAuthType.class, values = {"none", "mtls"})

but CorruptAuthzenClientCredentials requires a client object:

@PreEnvironment(required = {"client", "pdp"})

and @VariantSetup(parameter = PDPAuthType.class, value = "api_key") never creates one, so the module ends with:

couldn't find required object in environment before evaluation: client

The condition body already handles either credential, corrupting client.client_secret and pdp.api_key independently and erroring only when neither is present, so requiring client up front looks stricter than intended.

Found running the six AuthZEN plans against an OPA-based PDP. With static + api_key the rest of the suite is unaffected: 145 of 149 modules pass, the remainder being this one and #640.

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating AddApiKeyAuthenticationParametersToAuthzenApiRequest, GetPDPDynamicServerConfiguration, GetPDPStaticServerConfiguration, and CorruptAuthzenClientCredentials in the conformance suite. Run the six AuthZEN plans with discovery plus api_key and the invalid-credentials module under api_key. Done means the discovery combination preserves the configured key and the invalid-credentials module reaches its 401 evaluation without requiring an unused client object.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.