Skip to content

Skip dropping request on code request parameter #529

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricristian
Copy link

@ricristian ricristian commented Nov 5, 2024

By default if someone makes a GET request with parameter &code=... after authentication against IdP
classic error request to the redirect_uri path but there's no session state found will be raised.

I believe that it's related to

local function openidc_get_path(uri)
  local without_query = uri:match("(.-)%?") or uri
  return without_query:match(".-//[^/]+(/.*)") or without_query
end

Where basically &code matches the regex which triggers authorization response from OP.

&code= alone without extra request parameter should be treated as authorization response ?

Eventough I don't believe that this is a viable solution but the issue seems to be present

By default if someone makes a GET /?code= as request parameter `&code=...` error `request to the redirect_uri path but there's no session state found` will be raised. 

I believe that it's related to 

```
local function openidc_get_path(uri)
  local without_query = uri:match("(.-)%?") or uri
  return without_query:match(".-//[^/]+(/.*)") or without_query
end
```

Where basically &code matches the regex which triggers authorization response from OP. 

`&code=` alone without extra request parameter  should be treated as authorization response ? 

Eventough I don't believe that this is a viable solution
@oldium
Copy link
Collaborator

oldium commented May 1, 2025

That is not how it works. openidc_get_path just strips the ?query_parameters part from the URI. The code which switches to the response handling part is this:

  local path = openidc_get_path(target_url)
  if path == openidc_get_redirect_uri_path(opts) then
    log(DEBUG, "Redirect URI path (" .. path .. ") is currently navigated -> Processing authorization response coming from OP")
    ...

Maybe your redirect_uri simply conflicts with regular client requests?

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.

2 participants