feat(server-charm): add configuration options to set OIDC#1111
Open
rene-oromtz wants to merge 6 commits into
Open
feat(server-charm): add configuration options to set OIDC#1111rene-oromtz wants to merge 6 commits into
rene-oromtz wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1111 +/- ##
==========================================
+ Coverage 77.74% 77.78% +0.04%
==========================================
Files 118 118
Lines 12332 12358 +26
Branches 1014 1019 +5
==========================================
+ Hits 9587 9613 +26
Misses 2523 2523
Partials 222 222
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds charm-level configuration to enable/disable OIDC and to correctly handle inbound redirects when the server is deployed behind a reverse proxy. Also includes a MongoDB/GridFS access hotfix for newer PyMongo versions and expands unit coverage for the new charm/app behavior.
Changes:
- Add charm config/options and env wiring for OIDC (
web_secret_key,oidc_*) and abehind_proxytoggle. - Conditionally enable Werkzeug
ProxyFixin the Flask app whenBEHIND_PROXY=true. - Update GridFS collection access to bracket notation to avoid PyMongo attribute-access issues.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/tests/test_app.py | Adds tests asserting ProxyFix enable/disable behavior. |
| server/src/testflinger/database.py | Uses bracket notation for fs.files/fs.chunks to fix PyMongo compatibility. |
| server/src/testflinger/application.py | Conditionally wraps the WSGI app in ProxyFix based on BEHIND_PROXY. |
| server/charm/tests/unit/test_config.py | Adds unit tests for OIDC config validation. |
| server/charm/tests/unit/test_charm.py | Adds unit tests for charm behavior with valid/invalid OIDC config. |
| server/charm/src/config.py | Introduces new config fields and validation for OIDC and proxy settings. |
| server/charm/src/charm.py | Exposes new config values to the workload via environment variables. |
| server/charm/charmcraft.yaml | Declares new charm config options for OIDC and proxy deployment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the required configuration options so it can enable OIDC. The ground work was already made so this only adds the configuration at the charm level.
It also adds
ProxyFixconditionally based on if the application is running behind a proxy, this is different than the HTTP_PROXY and NO_PROXY as those are used for outbound and this is required for inbound requests. Without ProxyFix, the OIDC provider is unable to redirect back to the application.Finally, this also "sneaks" a hotfix needed with PyMongo > 4.9 e.g. db["fs."] otherwise the application is unable to start:
Note
Integration tests are failing because of this MongoDB issue, the tests uses the image that is available on
mainuntil this fix is landed, expect failures as the application will never start (it crashes with the above traceback)Resolved issues
Resolves CERTTF-714
Documentation
Web service API changes
Tests
Added unit tests for charm configuration and also tested on staging:
