hydra icon indicating copy to clipboard operation
hydra copied to clipboard

fix: Update persister_oauth2.go to handle special character | coming in t…

Open Ajayn84 opened this issue 1 year ago • 12 comments

…he scopes as part of consent request

Url encoded and decoded while fetching values from the table, as "|" is a seperator used to store scopes

Related issue(s)

Checklist

  • [x] I have read the contributing guidelines.
  • [ ] I have referenced an issue containing the design document if my change introduces a new feature.
  • [x] I am following the contributing code guidelines.
  • [x] I have read the security policy.
  • [x] I confirm that this pull request does not address a security vulnerability. If this pull request addresses a security vulnerability, I confirm that I got the approval (please contact [email protected]) from the maintainers to push the changes.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added or changed the documentation.

Further Comments

Ajayn84 avatar Sep 25 '24 07:09 Ajayn84

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 25 '24 07:09 CLAassistant

@hperl @aeneasr @alnr request your reviews

Ajayn84 avatar Dec 02 '24 10:12 Ajayn84

Links to https://github.com/ory/hydra/issues/3829

Ajayn84 avatar Dec 02 '24 10:12 Ajayn84

t's probably easier to just adjust the scope charset

@aeneasr can you please elaborate, i did try to encode , but since this logic is more controlled in the Hydra, it just took that param as "%7C" and responded with scopes having "%7C" instead of "|"

We cant replace the | (pipe) char ,as its a requirement from Hl7 Smart App launch https://www.hl7.org/fhir/smart-app-launch/scopes-and-launch-context.html#finer-grained-resource-constraints-using-search-parameters

Were you suggesting some other way to fix this issue? Also, dont think the current scopes with "|" will be working anyways, so dont think this should have backward compatibility issues

Ajayn84 avatar Jan 30 '25 14:01 Ajayn84

@Ajayn84 Have you found a workaround with this? We are also facing the same issue for same SMART on FHIR implementation.

@aeneasr - Could you please share the other suggestion that you may have on how to go about fixing this in hydra?

sagarshah1983 avatar Feb 07 '25 19:02 sagarshah1983

Hello, we already have methods to properly delimit string arrays using JSON encoding if I'm not mistaken in our sqlxx package. However, changing the way these things are parsed is a breaking change and requires a careful migration path as it can break all existing records. Given the risk associated, we just ask you to use a different delimiter in scopes.

Furthermore, | is not a valid url character and would need to be url-en/decoded in URLs, which makes it not that great of an option for use in the scope field, further reducing the likelihood of getting this merged.

aeneasr avatar Feb 09 '25 14:02 aeneasr

We cant replace the "|" pipe char with other char, as its a regulatory ask in healthcare. Hl7 Smart App launch link where it indicates the same https://www.hl7.org/fhir/smart-app-launch/scopes-and-launch-context.html#finer-grained-resource-constraints-using-search-parameters

Ajayn84 avatar Feb 10 '25 05:02 Ajayn84

@Ajayn84 Have you found a workaround with this? We are also facing the same issue for same SMART on FHIR implementation.

@aeneasr - Could you please share the other suggestion that you may have on how to go about fixing this in hydra?

No @sagarshah1983 , we are also trying to implement Smart on FHIR and specs indicate use of "|" in scopes, without a workaround

Ajayn84 avatar Feb 10 '25 05:02 Ajayn84

Thank you for pointing me to the spec - in that case the use case is legitimate in my view. Still, it's not trivial to implement this and if we fix it it should be a long-term solution (i.e. using the appropriate data types). I will synchronize with @vinckr to figure out what to best do here as I'm actually PTO :)

aeneasr avatar Feb 10 '25 09:02 aeneasr

Thank you for pointing me to the spec - in that case the use case is legitimate in my view. Still, it's not trivial to implement this and if we fix it it should be a long-term solution (i.e. using the appropriate data types). I will synchronize with @vinckr to figure out what to best do here as I'm actually PTO :)

Thanks @aeneasr.

Ajayn84 avatar Feb 10 '25 10:02 Ajayn84

@Ajayn84 can you write me an email at [email protected] to discuss the options further please?

vinckr avatar Feb 10 '25 18:02 vinckr

@Ajayn84 can you write me an email at [email protected] to discuss the options further please?

Sure @vinckr

Ajayn84 avatar Feb 11 '25 05:02 Ajayn84