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

Make cache service work with authenticated asset downloads #6120

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

Martchus
Copy link
Contributor

This PR incorporates #6114 which should probably be merged first.

It will tweak the cache service and the openQA user agent in general so both work when authenticated asset downloads are enabled. See https://progress.opensuse.org/issues/170380 and individual commit messages for details.

If wanted I can also extend tests. (Maybe I'll have to adapt tests anyway.) I tested this locally. Before this change it didn't work and with it it works when connecting directly and when using NGINX.

Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.98%. Comparing base (9f541d9) to head (ed0fc96).
Report is 13 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6120   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files         396      396           
  Lines       39557    39558    +1     
=======================================
+ Hits        39157    39158    +1     
  Misses        400      400           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* Use signatures
* Use more compact coding style
The openQA user agent code so far preserves manually set headers including
the `X-API-…` headers used for authentication. This is probably not
required and has the problematic side-effect that those headers are not
updated when following redirections. That means authentication fails when a
redirection is in place. This is the case when querying assets of a job as
done by the cache service.

In order to make the cache service work when authentication for assets is
enabled via 4c8ed39 this change updates
the `X-API-…` headers regardless of whether they are already present. Any
custom values will be overridden but preserving custom values is not
required anyways. (The accepted header will still be preserved.)

Related ticket: https://progress.opensuse.org/issues/174154
When the `/api/v1/auth` route is used via the NGINX configuration
`auth_request` the request URL is not the URL relevant for authentication
because the request URL/path will always be `/api/v1/auth`. Instead the
`X-Original-URI` is used to specify the actual path as done in the NGINX
config template.

Related ticket: https://progress.opensuse.org/issues/170380
@Martchus
Copy link
Contributor Author

I pushed one more commit because I forgot to include these changes into the commit yesterday.

@mergify mergify bot merged commit eb56fa8 into os-autoinst:master Jan 17, 2025
46 checks passed
@Martchus Martchus deleted the auth-3 branch January 17, 2025 12:36
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.

3 participants