Skip to content

feat(cli): rudimentary support for http authentication#165

Merged
tilowiklundSensmetry merged 14 commits intomainfrom
tw/auth_basic
Feb 2, 2026
Merged

feat(cli): rudimentary support for http authentication#165
tilowiklundSensmetry merged 14 commits intomainfrom
tw/auth_basic

Conversation

@tilowiklundSensmetry
Copy link
Member

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 <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
@tilowiklundSensmetry tilowiklundSensmetry force-pushed the tw/auth_basic branch 2 times, most recently from 436fc24 to ec45ddd Compare January 28, 2026 09:16
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
@tilowiklundSensmetry tilowiklundSensmetry force-pushed the tw/auth_basic branch 2 times, most recently from 1dd6d85 to 90f61e1 Compare February 2, 2026 11:26
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
@tilowiklundSensmetry tilowiklundSensmetry force-pushed the tw/auth_basic branch 2 times, most recently from 92b2ed3 to 9a49a0a Compare February 2, 2026 11:33
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Copy link
Collaborator

@victor-linroth-sensmetry victor-linroth-sensmetry left a comment

Choose a reason for hiding this comment

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

Minor editorial things. Otherwise things seem fine.

tilowiklundSensmetry and others added 3 commits February 2, 2026 13:33
Co-authored-by: Victor Linroth <victor.linroth@sensmetry.com>
Signed-off-by: Tilo Wiklund <75035892+tilowiklundSensmetry@users.noreply.github.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Copy link
Collaborator

@andrius-puksta-sensmetry andrius-puksta-sensmetry left a comment

Choose a reason for hiding this comment

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

Looks good.

@tilowiklundSensmetry tilowiklundSensmetry merged commit 2992d16 into main Feb 2, 2026
55 checks passed
@tilowiklundSensmetry tilowiklundSensmetry deleted the tw/auth_basic branch February 2, 2026 15:51
simonas-drauksas-sensmetry pushed a commit that referenced this pull request Feb 3, 2026
Extends #165 with bearer token
authentication. Configured by environment variables

```
SYSAND_CRED_<X> = <PATTERN>
SYSAND_CRED_<X>_BEARER_TOKEN = <TOKEN>
```

---------

Signed-off-by: Tilo Wiklund <tilo.wiklund@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.

3 participants