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

feat: add support for API key validation for self-hosted #322

Merged
merged 7 commits into from
Dec 8, 2023
Merged

feat: add support for API key validation for self-hosted #322

merged 7 commits into from
Dec 8, 2023

Conversation

omikader
Copy link
Contributor

@omikader omikader commented Dec 5, 2023

This PR gives people the ability to use the API key header to validate requests when self-hosting Unstructured. If the optional environment variable of UNSTRUCTURED_API_KEY does not match the request header of unstructured-api-key, then we fail with a 401 response instead of fulfilling the request.

This will allow people to self-host unstructured with confidence that only internal applications that have access to the shared key can use the service.

Closes #321

@awalker4
Copy link
Collaborator

awalker4 commented Dec 7, 2023

Thanks for the PR! This certainly makes sense. A few things:

  • Can you make sure this check only runs when UNSTRUCTED_API_KEY is set?
  • Can you add a small test to test_general/api.test_app.py to validate?
  • We could use a small note in the readme about using this

@omikader
Copy link
Contributor Author

omikader commented Dec 8, 2023

@awalker4 all set! Thanks for the quick review. Let me know if there's anything else you'd like to see before merging 🙂

@awalker4
Copy link
Collaborator

awalker4 commented Dec 8, 2023

Final thing - can you bump the version to 0.0.60 in the changelog? You can run make version-sync to bump all the relevant files. Thanks!

Copy link
Collaborator

@awalker4 awalker4 left a comment

Choose a reason for hiding this comment

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

LGTM!

@awalker4 awalker4 enabled auto-merge (squash) December 8, 2023 17:28
auto-merge was automatically disabled December 8, 2023 17:31

Head branch was pushed to by a user without write access

@awalker4 awalker4 enabled auto-merge (squash) December 8, 2023 17:33
auto-merge was automatically disabled December 8, 2023 17:50

Head branch was pushed to by a user without write access

@awalker4 awalker4 enabled auto-merge (squash) December 8, 2023 19:42
@awalker4 awalker4 merged commit c9909f2 into Unstructured-IO:main Dec 8, 2023
6 checks passed
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.

Support API Key for self-hosted
2 participants