Skip to content

Add support for authenticated HTTP access for interchange project download and index access#157

Draft
tilowiklundSensmetry wants to merge 2 commits intomainfrom
tw/auth
Draft

Add support for authenticated HTTP access for interchange project download and index access#157
tilowiklundSensmetry wants to merge 2 commits intomainfrom
tw/auth

Conversation

@tilowiklundSensmetry
Copy link
Member

@tilowiklundSensmetry tilowiklundSensmetry commented Jan 15, 2026

Will satisfy #10

Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
tilowiklundSensmetry added a commit that referenced this pull request Feb 2, 2026
This MR implements the basic infrastructure for adding authentication to
HTTP requests (to indices, project source, ...). It is an intermediate
MR to #157, which intends to
bring more complete support, both in terms of supported authentication
schemes and configurability.

This MR only implements:
- Basic authentication scheme (username:password)
- Configurable in the CLI, via environment variables

The CLI looks for triplets of environment variables following the
pattern `SYSAND_CRED_<X>`, `SYSAND_CRED_<X>_BASIC_USER`,
`SYSAND_CRED_<X>_BASIC_PASS`. The `<X>` part is arbitrary, but every
`<X>` has to appear either not at all, or for all three patterns. The
first variable is a glob pattern to match URLs to allow authentication
for, while the other two provide the actual credentials.

Example
```
SYSAND_CRED_FOO='https://*.foo.com/**' SYSAND_CRED_FOO_BASIC_USER="bar" SYSAND_CRED_BASIC_PASS="baz" sysand <OP>
```
Would allow the use of `bar:baz` as credentials for urls such as
`https://www.foo.com/a/b/c`, `https://index.foo.com/hey.kpar`, ...

Credentials are only actually sent if an initial request generates a 4xx
status. The strictly correct behaviour here would be to try sending
credentials only in response to an explicit `401` with
`WWW-Authenticate` header, but this would, I believe, be incompatible
with using, for example, private GitLab/GitHub pages.

---------

Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <75035892+tilowiklundSensmetry@users.noreply.github.com>
Co-authored-by: Victor Linroth <victor.linroth@sensmetry.com>
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.

1 participant