Skip to content

Commit

Permalink
fix: disallow trailing . in key name (#77)
Browse files Browse the repository at this point in the history
* fix: disallow trailing . in key name

* fix: upgrade aws cli to version 2
  • Loading branch information
knutties authored May 27, 2024
1 parent 999581a commit 57807d6
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ root = true
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = false
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ async fn create(
let req = request.into_inner();
let key = key.into_inner();

if key.ends_with(".") {
log::error!("configuration key {key} cannot end with a '.' character.");
return Err(bad_argument!(
"Configuration key cannot end with a '.' character. \
Please remove the trailing '.' in the key name."
));
}

if req.value.is_none() && req.schema.is_none() && req.function_name.is_none() {
log::error!("No data provided in the request body for {key}");
return Err(bad_argument!("Please provide data in the request body."));
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
gnumake
# Why do we need this?
stdenv.cc
awscli
awscli2
jq
nodejs_18
nixpkgs-fmt
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tenant:
grep 'DATABASE_URL=' .env | sed -e 's/DATABASE_URL=//' | xargs ./scripts/create-tenant.sh -t $(TENANT) -d

validate-aws-connection:
aws --endpoint-url=http://$(DOCKER_DNS):4566 --region=ap-south-1 sts get-caller-identity
aws --no-cli-pager --endpoint-url=http://$(DOCKER_DNS):4566 --region=ap-south-1 sts get-caller-identity

validate-psql-connection:
pg_isready -h $(DOCKER_DNS) -p 5432
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eventOrder": [
"event.test.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pm.test("400 check", function () {
pm.response.to.have.status(400);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "x-tenant",
"value": "test",
"type": "default"
}
],
"body": {
"mode": "raw",
"options": {
"raw": {
"language": "json"
}
},
"raw_json_formatted": {
"value": "value1",
"schema": {
"type": "string",
"pattern": ".*"
}
}
},
"url": {
"raw": "{{host}}/default-config/key.",
"host": [
"{{host}}"
],
"path": [
"default-config",
"key."
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 57807d6

Please sign in to comment.