-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
CHT-datasource doesn't handle remote authentication #9701
Comments
Wait, so https://github.com/medic/pouchdb-session-authentication is going away? I thought we just switched to that? 🤔 😅
FTR, this was by design. We concluded it was unnecessary to do any authentication work in the initial MVP of cht-datasource since it would be able to inherent the session from the context that it was running in. Not sure I would characterize this as a "bug". With the removal of session authentication, are we going to be in a situation where production workflows are going to be running with the user/pass included in the URL? It seems like this would not be the case in webapp/admin (which are the two places that the That does still leave us with the problem of how the integration tests for the |
Yes, this is going away. It's additional code we need to maintain and we don't need it anymore.
No, we're going to pass an "Authorization" header with "Basic" authentication in api and sentinel. But some other services (like healthcheck) are still using auth in URLs I believe. We hadn't switched those to sessions yet.
In my PR, I switched all datasource integration tests to hit the code through API endpoints. Up to you if you want to add other integration tests when implementing support for remote auth. |
Have not looked at the actual code change here, but taking this statement at face value this seems like a significant regression in test coverage, leaving the remote context of cht-datasource untested for by any sort of integration tests. This also seems to directly contradict the agreement reached in a separate PR to duplicate the tests here. The reason why I think integration test coverage is so important here is because the low-level nature of the cht-datasource code makes it pretty risky to assume it is sufficiently tested by other integration/e2e workflows. I am less worried about the |
Describe the bug
cht-datasource uses fetch to interact with a remote data source. However, all it receives when the datasource is initialized is the URL, but not authentication, and it further does not handle authentication at all.
cht-core/shared-libs/cht-datasource/src/remote/libs/data-context.ts
Line 71 in 35bb802
And fetch does not support adding inlined basic authentication in the URL, for basic auth it requires an Authorization header.
There are some integration tests, but these are relying on enriching global fetch with a request-promise-native cookie jar that contains a session cookie:
cht-core/tests/utils/index.js
Line 68 in 35bb802
We are removing
To Reproduce
Steps to reproduce the behavior:
cht-core/tests/utils/index.js
Line 68 in 35bb802
Expected behavior
CHT-datasource should be independent of hacks we set up in e2e tests.
Environment
Additional context
As part of #6250 , and in conjunction with #8338 , I am removing all session setup and only relying on basic auth. CouchDb can now handle basic auth with many iterations out of the box, and maintaining sessions adds code complexity with we don't need anymore (fe. an entire PouchDb plugin which we now no longer need to maintain).
The text was updated successfully, but these errors were encountered: