Commit graph

37 commits

Author SHA1 Message Date
finga faba2949d2 cargo: Bump hmac and sha2 dependencies.
All checks were successful
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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Bump `clap` to latest version.
2023-06-11 18:01:37 +02:00
finga 35b31b2a15 cargo: Cargo update
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Update the build dependencies by `cargo update`.
2023-06-11 17:28:01 +02:00
finga f195162ce5 Update build dependencies
Use clap `v3.0`.
2022-01-07 11:50:52 +01:00
finga f7aea10c6b Update build dependencies 2021-12-14 17:00:55 +01:00
finga 620fa520ce Raise version to 0.1.6 2021-12-09 13:43:46 +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 5f5d014bc0 Update build dependencies 2021-11-26 10:58:37 +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 0d9c5f650f Update build dependencies 2021-11-17 14:07:39 +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 4a54aabf26 Increase version to v0.1.3
Increase version to `v0.1.3` and update build deps.
2021-11-13 20:00:07 +01:00
finga b2205ea5f4 Increase version to 0.1.2
Also update build dependencies and fix readme.
2021-11-10 10:50:59 +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 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 ed6646195c Cargo update
Update dependencies.
2021-09-30 00:20:54 +02:00
finga dd78835f17 Cargo update 2021-06-30 23:45:46 +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 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 29caaff596 Fix debian build overwriting config file
Add missing `confi-files` parameter to `Cargo.toml`.
2021-04-22 13:19:28 +02:00
finga 2ddb2d376f Cargo update 2021-04-22 13:19:03 +02:00
finga 280dab6e8c Support matching boolean values with regex 2021-04-22 11:56:28 +02:00
finga d552e29e8f Build a Debian package
The first version `0.1.0-rc.0` and metadata for `cargo-deb` is now in
`Cargo.toml`. For that, the service file as well as the config file
were moved.

For a improved systemd service file the `User` and `Group` is now set
via variables and the log level is now set to `info`. In the previous
version of the service file the parameter for `ExecStart` was missing
which prevented this file from working.

The dependencies in `Cargo.lock` were updated.
2021-04-17 00:08:11 +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 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 84c24e9129 Cargo update 2021-03-29 02:27:13 +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
finga 3dae942b7e Update build dependencies 2021-03-22 00:06:14 +01:00
finga 0610fd49c9 Replace command parameters with values
To create a minimalistic parser, nom is used to identify and replace
parameters given in the command field.

For clarity the `action` field for hooks was renamed to `command`.
2021-03-21 22:38:14 +01:00
finga e052af5114 Enable tls and update dependencies 2021-03-19 15:44:26 +01:00
finga a0d7813687 Cargo update 2021-03-17 11:01:20 +01:00
finga 82ccbf0a7e Implement proper logging
The `log` and `env_logger` crates are used for logging.
2021-03-03 17:01:41 +01:00
finga c8505b27c5 Parse config file and act upon
All dependencies were updated.

An example configuration file `config.yml` is added to show the
configuration options. Following locations are checked:
- `/etc/webhookey/config.yml`
- `<config_dir>/webhookey/config.yml`
- `./config.yml`

Whereas `<config_dir>` is depending on the platform:
- Linux:   `$XDG_CONFIG_HOME` or `$HOME/.config`
- macOS:   `$HOME/Library/Application Support`
- Windows: `{FOLDERID_RoamingAppData}`

Each hook's action is executed if all of the specified filters match.
2021-03-03 15:36:31 +01:00
finga d8ca63ab37 Parse JSON from post request
Accept a post request and try to parse it expecting the data is
formated in JSON.
2021-02-02 11:17:27 +01:00