finga
faba2949d2
cargo: Bump hmac
and sha2
dependencies.
...
ci/woodpecker/push/woodpecker Pipeline was successful
Bump the `hmac` dependency to `0.12`, therefor remove deprecated
`NewMac`. Further, bump the `sha2` dependency to `0.10`.
2023-06-11 22:37:25 +02:00
finga
57d4f10b41
cargo: Bump clap
to 4.3
...
ci/woodpecker/push/woodpecker Pipeline was successful
Bump `clap` to latest version.
2023-06-11 18:01:37 +02:00
finga
f6ec8af944
clippy: Fix clippy::get_first
...
ci/woodpecker/push/woodpecker Pipeline failed
Fix the `clippy::get_first` lint.
Note clippy fails due to a false positive.
2023-06-11 17:27:18 +02:00
finga
f38c70373c
metrics: Increase hooks_successful
when done
ci/woodpecker/push/woodpecker Pipeline was successful
2022-03-23 15:20:39 +01:00
finga
0312a600ed
Add from
annotation to inherited errors
2022-01-07 11:49:16 +01:00
finga
856cdc9457
Update build dependencies
...
This needed also some adaption in order to use `clap 3.0.0-rc.0`.
2021-12-09 13:40:17 +01:00
finga
506001a366
Improve error message
...
Write a more correct error message.
2021-11-22 14:42:10 +01:00
finga
5775870a8e
Move hook related code into hooks.rs
...
This concludes the code separation into several files.
2021-11-19 14:28:26 +01:00
finga
1280352f25
Move config related code into config.rs
...
To continue with code separation to improve readability.
2021-11-19 13:41:48 +01:00
finga
5e1d433c38
Move metrics related code into metrics.rs
...
To improve readability metrics related code moves to `metrics.rs`.
2021-11-19 11:40:21 +01:00
finga
3a95ecfd11
Rename webook.rs
to filter.rs
...
Also improve code separation, still more to come.
2021-11-19 11:28:37 +01:00
finga
b7ad590d39
Create interrelate macro to evaluate filters
...
This reduces code duplication.
2021-11-19 11:26:53 +01:00
finga
b8f114900b
Compile regex when parsing config
...
The regexes are now compiled when the config is parsed and not each
time a new webhook is received.
Adapt tests to using parsed regex.
2021-11-19 11:26:23 +01:00
finga
83785cc77d
Add comments to metrics
...
To improve readability.
2021-11-18 00:16:09 +01:00
finga
8c9d9e63f2
Add HeaderFilter
for filter based on the header
...
This extends filtering to filter also on the received http header.
2021-11-17 15:13:12 +01:00
finga
9c423b8dc8
Add Not
filter to FilterType
...
To invert the result of filters.
2021-11-17 14:06:07 +01:00
finga
4d39488c32
Use a custom parser for commands
...
The removes the dependency for `nom` as commands are now parsed with
its own tiny parser.
2021-11-17 13:17:15 +01:00
finga
4b9186b10d
Fix json parsing bug
...
Increase version for building a new Debian package.
2021-11-16 14:39:22 +01:00
finga
3a482a3eb9
Remove prototyping code which is commented out
...
This comments are ment for future development and not for the main
branch yet.
2021-11-14 11:58:34 +01:00
finga
e7e136195b
Fix metrics check when disabled
...
Previously, disabled metrics had no effect and a request to the
`/metrics` route was answered nonetheless.
Remove needles borrow
2021-11-13 19:59:58 +01:00
finga
a122bf28d2
Use atomics instead of mutexes
...
Use atomics instead of mutexes to improve access on metrics. Therefor
also remove unneeded borrows.
2021-11-13 14:37:02 +01:00
finga
b4b46ebd58
Refactor filters
...
Clean up some comments and refactor the code to improve readability
and to get rid of "ugly" unwraps.
2021-11-13 14:16:21 +01:00
finga
d92e8029f2
Break up code into multiple files
...
In order to increase readability, maintainability and maybe a future
independence regarding web frameworks move code to new files.
2021-11-11 21:09:47 +01:00
finga
f24a786ec6
Make the metrics page configurable
...
Make the metrics page configurable with an `ip_filter`.
This closes #10 .
2021-11-09 14:57:41 +01:00
finga
f0f1d3239d
Use BTreeMap
instead of HashMap
...
As ordering of `BTreeMap` is easier for testing and the difference
does not really matter.
2021-11-09 13:58:57 +01:00
finga
a12ad80cba
Add metrics page
...
Add a page to print metrics.
2021-11-08 14:59:49 +01:00
finga
beb039aa3c
Reorder code
...
To improve readibility and to prepeare split of `webhookey` code from
`Rocket` some functions are reordered.
2021-11-07 16:43:10 +01:00
finga
4594db6c44
Remove feature annotation
...
This is not needed anymore.
2021-11-07 16:41:58 +01:00
finga
02dc225fa8
Update build dependencies to latest versions
...
Update build dependencies to latest version, also use the 2021 Rust
edition. This is also the next version of `webhookey` with version
number 0.1.1.
2021-11-06 12:12:22 +01:00
finga
c82c0fcbd5
Remove double parsing of data pointed to
...
As there was an issues with the parser which checked the validity of
the JSON pointer pointing to the received JSON data this part is
removed. Further some checks were added to double check that case
which lead to an invalid behaviour.
This fixes #9 .
2021-11-06 11:03:27 +01:00
finga
87d6f58f72
Rename variable in parse_command
test
...
Rename `map` to `headers` inside the `parse_command` test to improve
readability.
2021-11-06 10:38:52 +01:00
finga
5a88fb892b
Adapt to new versions of rocket and clap
...
Use clap `3.0.0-beta.5` and rocket `0.5.0-rc.1`.
2021-11-04 13:02:50 +01:00
finga
39096ef9cc
Colored help
...
Print colored help message.
2021-09-30 00:22:34 +02:00
finga
ed6646195c
Cargo update
...
Update dependencies.
2021-09-30 00:20:54 +02:00
finga
34e3e3f32a
Better command line argument parsing
...
Use structs and enums instead of builder style options.
2021-06-30 23:55:21 +02:00
finga
5d20366e5d
Fix clippy warnings
2021-06-30 23:52:19 +02:00
finga
65430e65b7
Restructure and minor improvements
...
In order to keep things together the code was restructured. Some small
improvements such as clippy warnings and the validation of a hook in
regards of the ip filter.
2021-06-15 12:48:00 +02:00
finga
d29bfdf88d
Use clap for command line arguments
...
To support command line arguments `clap` is used. This adds following
argument `--config`/`-c` to provide a different path for the
configurationf file and the subcommand `configtest` which parses and
loads the configuration and exits.
2021-05-31 16:14:19 +02:00
finga
43b7fd5625
Support so called conjunction filters
...
This introduces thee so called conjunction filters and therefore
restructures the configuration file. The most obvious changes from an
users perspective are that the `filters` field was renamed to `filter`
and can, from now on, only support a single filter at first
level. Thats why now different filter types are implemented, please
consult the readme for further information on their usage.
To reflect the changes the readme file is updated as well as the
example config file contained in this repository.
This is related to #8
2021-05-31 15:55:50 +02:00
finga
891a8a70ae
Update build deps and improve readability
...
The ip filtering is improved as well as the replacing of
parameters. The index page is removed.
2021-05-29 01:03:07 +02:00
finga
280dab6e8c
Support matching boolean values with regex
2021-04-22 11:56:28 +02:00
finga
17778cf8b4
Fix execution of scripts
...
For better script and argument support `run_script` is used instead of
`process::Command`.
2021-04-17 00:04:22 +02:00
finga
6af7d29833
Enable command parser to parse all values
...
To be able to parse other values than
`serde_json::Value::String(String)` we parse the pointer parameters
and replace all those values in the JSON data with strings.
2021-04-16 17:27:27 +02:00
finga
ea3121a985
Fix matching numbers against the regex
...
Still, `Null`, `Bool`, `Array` and `Object` types are
unmatchable. Work TBD...
2021-04-13 17:08:22 +02:00
finga
7f143e0b08
Split from_data()
up in smaller pieces
...
To still be able to handle errors correctly, also regarding the http
status code, `thiserror::Error` is used.
2021-04-03 01:10:50 +02:00
finga
8314214e06
Add optional ip_filter
to hook config
...
In order to allow or deny sources of requests the possibility to
configure a list of allowed or denied IP addresses was added as
described by the readme.
Closes #3
2021-04-02 01:59:45 +02:00
finga
8099bf773f
Arbitrary header fields in commands
...
Adopt the parser to be able to parse header fields.
2021-03-30 01:16:15 +02:00
finga
2c00441b34
Restructuring of from_data()
and configuration
...
For better readability, correctness and maintainability the
body (which is still rather large, though) was restructured.
Regarding the signature, to be able to configure different fields in
the HTTP header the configuration parameter signature was added.
2021-03-29 04:32:09 +02:00
finga
822ddafacb
Breakup from_data()
into smaller bits
...
To improve readability and reduce indention levels some code was moved
into their own functions.
And a test case was added to the `secret()` test.
2021-03-29 02:25:36 +02:00
finga
ee32424f8c
Use signature field for verification
...
Instead of looking for a "secret" field hmac is used. Therefore the
raw payload is hashed with all secrets consecutively in order to
validate its content. If the content is certified the established
behaviour is pursued..
2021-03-28 04:18:35 +02:00