Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fixes during conformance testing #150

Closed
wants to merge 2 commits into from

Conversation

sanderPostma
Copy link
Contributor

No description provided.

//fixme: Create correlationId if not provided. Might need to be deferred to registry though
this._correlationId = args.correlationId
this._timestamp = Date.now()
this._subject = args.subject
this._redirectUri = args.redirectUri
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, we have a generic subject. Why are we creating something very specific (a redirectUri) on every event type. That should not happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's optional and it's not every event type, just AuthorizationEvent types.

await this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_SUCCESS, { correlationId, subject: response, redirectUri: redirectUri })

Alternatively I can create a new type wrapping response & redirectUri. That would be a breaking change, but I do not think we are using that event anywhere else in our codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw there is a simpler solution without using the event. Will revert

@@ -96,10 +96,10 @@ export const getRequestObjectJwtVerifier = async (
if (jwt.payload.redirect_uri && jwt.payload.redirect_uri !== clientId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably should be a else if here, that does the exact same check but then for jwt.payload,response_uri (the new name) instead of redirect_uri

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is client_id_scheme still redirect_uri in case jwt.payload,response_uri is used?
I don't see redirect_uri as valid value for client_id_scheme

Copy link
Contributor Author

@sanderPostma sanderPostma Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably should be a else if here, that does the exact same check but then for jwt.payload,response_uri (the new name) instead of redirect_uri

This was resolved BTW

@@ -96,10 +96,10 @@ export const getRequestObjectJwtVerifier = async (
if (jwt.payload.redirect_uri && jwt.payload.redirect_uri !== clientId) {
throw new Error(SIOPErrors.INVALID_CLIENT_ID_MUST_MATCH_REDIRECT_URI)
}
const parts = options.raw.split('.')
/*const parts = options.raw.split('.') this can be signed and execution shouldn't even be here when alg = none
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing this, instead of not checking it when alg === none ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution never gets here if alg is none
line 83

  if (!clientIdScheme || jwt.header.alg === 'none') {
    return getJwtVerifierWithContext(jwt, { type })
  }

@sanderPostma sanderPostma changed the base branch from develop to develop-20240918 September 26, 2024 07:38
@sanderPostma sanderPostma changed the base branch from develop-20240918 to develop September 26, 2024 07:39
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.11%. Comparing base (86f6d4a) to head (00c49e4).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #150   +/-   ##
========================================
  Coverage    49.11%   49.11%           
========================================
  Files           74       74           
  Lines         4976     4976           
  Branches      1769     1769           
========================================
  Hits          2444     2444           
  Misses        2529     2529           
  Partials         3        3           
Flag Coverage Δ
unittest 49.11% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jcmelati jcmelati closed this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants