-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shard: Add support for HTTP Basic Auth
The API end point of some shards are protected with HTTP Basic Auth. This will make the promql-query component to fail receiving a '401 Unauthorized' error response. To address that, we have added the possibility to specify HTTP Basic Auth credentials on shards. Apart from that, the query is performed in the back end for security issues. Since the request's "Authorization" header contains the base64-encoded user and password, if we performed the query in the front end that information would be easy to obtain by inspecting the HTTP requests.
- Loading branch information
1 parent
4ed6d1b
commit 4eee35c
Showing
8 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 4.2.11 on 2024-06-04 07:52 | ||
|
||
from django.db import migrations, models | ||
|
||
import promgen.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("promgen", "0022_rule_labels_annotations"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="shard", | ||
name="basic_auth", | ||
field=models.BooleanField( | ||
default=False, help_text="This shard's API requires HTTP Basic Auth" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="shard", | ||
name="basic_auth_password", | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name="shard", | ||
name="basic_auth_user", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=255, | ||
null=True, | ||
validators=[promgen.validators.http_basic_auth_user_id], | ||
), | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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