Commit graph

518 commits

Author SHA1 Message Date
Adnan Hajdarević
6797bf7cf7
Merge pull request #462 from moorereason/req-context
Add Request object to hook package to simplify API
2020-09-26 15:20:32 +02:00
Cameron Moore
c6603894c1 Add Request object to hook package to simplify API
To avoid having to pass around so many parameters to the hook package,
create a Request object to store all request-specific data.  Update APIs
accordingly.
2020-09-25 19:46:06 -05:00
Adnan Hajdarević
b8498c564d
Merge pull request #460 from moorereason/iss456-log-exec-err
Log stdlib error on failed exec.LookPath
2020-09-25 07:13:35 +02:00
Cameron Moore
dd5fa20415 Log stdlib error on failed exec.LookPath
The error returned by exec.LookPath was never surfaced to the user.
Without that detail, the user can't tell the difference between a
non-existent path and a permissions issue.

Additionally, when ExecuteCommand is an absolute path, we were still
attempting to prepend the CommandWorkingDirectory if the ExecuteCommand
was not found, which made it difficult to know which path the user
intended to execute.

This commit simplifies the logic to avoid multiple attempts with
ExecuteCommand is an absolute path and changes the error message from:

  error locating command: '/path/to/file'

to:

  error in exec: "/path/to/file": stat /path/to/file: no such file or directory
  error in exec: "/path/to/file": permission denied

Fixes #457
2020-09-24 21:02:07 -05:00
Adnan Hajdarević
c7a8fbc929
Merge pull request #449 from moorereason/feature/448-return-json
Update ExtractParameterAsString to return JSON on complex types
2020-08-03 08:08:38 +02:00
Adnan Hajdarević
04ca211531
Merge pull request #446 from moorereason/feature/json-array
Add support for top-level JSON array in payload
2020-08-03 08:07:09 +02:00
Cameron Moore
ae5e9e7894 Update ExtractParameterAsString to return JSON on complex types
Fixes #448
2020-07-31 11:58:12 -05:00
Adnan Hajdarević
47e5ae5527
Merge pull request #447 from moorereason/feature/docs-toc
Add a table of contents to some of the docs
2020-07-31 14:47:49 +02:00
Cameron Moore
534e99bf13 Add a table of contents to some of the docs 2020-07-29 17:23:23 -05:00
Cameron Moore
0e90ccb441 Add support for top-level JSON array in payload
Detect if leading character in JSON payload is an array bracket.  If
found, decode payload into an interface{} and then save the results into
payload["root"].  References to payload values would need to reference
the leading, "virtual" root node (i.e. "root.0.name").

Fixes #215
2020-07-29 16:56:25 -05:00
Adnan Hajdarević
f692da2465
Merge pull request #445 from moorereason/bugfix/require-go14
Bugfix/require go14
2020-07-29 08:53:51 +02:00
Gabe Gałązka
fb9b22a118 Change minimum golang version to 1.14 in README 2020-07-27 13:18:35 -05:00
Cameron Moore
eefcd7f7d5 Require Go 1.14
When go.mod specifies go 1.14 or higher, the go tools now verify that
vendor/modules.txt is consistent with go.mod.  Fixed by running `go mod
vendor`.
2020-07-27 13:18:18 -05:00
Adnan Hajdarević
c4f29b5d8b
Merge pull request #432 from moorereason/bugfix/logging-gocritic
Fix issues in logging middleware
2020-05-29 09:43:32 +02:00
Adnan Hajdarević
dd84a68483
Merge pull request #431 from moorereason/bugfix/pidfile-tighten
Tighten file permissions on pidfile creation
2020-05-29 09:42:55 +02:00
Cameron Moore
c9199d62e4 Tighten file permissions on pidfile creation
Fixes report from gosec: "G306: Expect WriteFile permissions to be 0600
or less."  Also, use new octal number formatting.
2020-05-28 18:23:02 -05:00
Cameron Moore
3d824b47b7 Rename var to avoid shadowing bytes package
importShadow: shadow of imported package 'bytes' (gocritic)
2020-05-28 18:20:07 -05:00
Cameron Moore
cc98de88ce Fix godoc comment on LogEntry.Panic 2020-05-28 18:17:41 -05:00
Adnan Hajdarević
e71b45b28f
Merge pull request #427 from moorereason/feature/empty-payload-signature
Warn on failed validate of empty payload signature
2020-05-23 09:28:09 +02:00
Cameron Moore
41ac427a89 Warn on failed validate of empty payload signature
If signature validation fails on an empty payload, append a note to the
end of the error message.

Updates #423
2020-05-22 14:02:12 -05:00
Adnan Hajdarević
7b3c5fd028
Merge pull request #426 from moorereason/bugfix/issue425
Fix request dumper
2020-05-22 07:15:43 +02:00
Cameron Moore
526c9a20ac Fix request dumper
The existing code had a bug in printing request params.  Simplify the
request logger by using httputil.DumpRequest.

Also print the request before handing it downstream.

Fixes #425
2020-05-21 17:47:55 -05:00
Adnan Hajdarević
a75ab4f92f
Merge pull request #420 from adnanh/master
Update README.md
2020-05-14 14:22:48 +02:00
Adnan Hajdarević
345bf3d409
Update README.md 2020-05-14 14:22:24 +02:00
Adnan Hajdarevic
e6e324235d Bump version to v2.7.0 2020-05-12 19:14:25 +02:00
Adnan Hajdarevic
6c8d2e6b6d Merge branch 'master' into development 2020-05-12 19:13:27 +02:00
Adnan Hajdarević
c8ea86f6ce
Merge pull request #417 from moorereason/bugfix/error-locating-command-test
Fix missing command test
2020-05-12 13:52:37 +02:00
Cameron Moore
4f437e4642 Fix missing command test 2020-05-11 20:21:37 -05:00
Adnan Hajdarević
7267733aa8
Merge pull request #351 from dexpota/master
Add help target to Makefile
2020-04-27 21:46:23 +02:00
Adnan Hajdarević
95bd1b3072
Merge pull request #413 from moorereason/feature/go1.14ciphers
Use Go 1.14 cipher suites
2020-04-25 17:04:59 +02:00
Adnan Hajdarević
9cb199c8b3
Merge pull request #415 from moorereason/bugfix/missing-rid-on-missing-cmd
Add request ID logging on missing command
2020-04-25 16:59:21 +02:00
Cameron Moore
4407c0190b Add request ID logging on missing command 2020-04-24 15:32:33 -05:00
Cameron Moore
4897bea79f Use Go 1.14 cipher suites
Now that Go 1.14 is out, we can remove cipher_suites.go and use the
stdlib.
2020-04-24 09:13:11 -05:00
Adnan Hajdarević
38294cd0c6
Merge pull request #383 from moorereason/feature/pidfile
Add pidfile support
2020-02-14 19:35:18 +01:00
Adnan Hajdarević
dc4f42bb26
Merge pull request #384 from moorereason/feature/value-walk
Show failed parameter node lookups
2020-02-14 19:13:36 +01:00
Adnan Hajdarević
472ce4863f
Merge pull request #388 from moorereason/feature/multi-signature
Feature/multi signature
2020-01-07 10:50:41 +01:00
Wyatt Johnson
de626ab2bb fix: updated based on review
- added support for sha512
- added notes to docs
2020-01-06 18:23:30 -06:00
Wyatt Johnson
f8c8932866 fix: spelling 2020-01-06 18:23:20 -06:00
Wyatt Johnson
6d3b81fc61 fix: simplify implementation 2020-01-06 18:23:09 -06:00
Wyatt Johnson
11e0031a9f feat: added multiple sig support 2020-01-06 18:22:55 -06:00
Adnan Hajdarević
53f63a7614
Merge pull request #387 from adnanh/revert-355-master
Revert "Multiple Signature Support"
2020-01-03 23:40:05 +01:00
Adnan Hajdarević
8c5b2e0c17
Revert "Multiple Signature Support" 2020-01-03 23:38:49 +01:00
Cameron Moore
7fa3a8900c Show failed parameter node lookups
When attempting to match a JSON path for initial setup, it would be
helpful to know where the path failed. This change logs the failed
parameter node. For example, if you are trying to match path "a.b.d.e",
but you failed to include the "c" node, webhook will log an error
"parameter node not found: d.e" to assist in troubleshooting.
2019-12-30 21:51:11 -06:00
Cameron Moore
e1634fe669 Add missing windows dependency 2019-12-29 18:08:35 -06:00
Cameron Moore
876c853073 Add pidfile support
Copy a simple implementation from the Moby project, since importing
their package would pull in too many dependencies.

Fixes #320
2019-12-29 18:00:55 -06:00
Adnan Hajdarević
569921cd72
Merge pull request #381 from moorereason/feature/logfile
Feature/logfile
2019-12-29 20:10:16 +01:00
Cameron Moore
fda328dc23 Refactor fatal logging during service startup
Create a log queue to postpone the first log write until after
privilege dropping and log file opening.
2019-12-28 20:50:33 -06:00
Adnan Hajdarević
aa03daeff8
Merge pull request #380 from moorereason/feature/http-methods
Feature/http methods
2019-12-28 14:17:39 +01:00
Cameron Moore
811481298a Fix method not allowed log message 2019-12-28 07:09:36 -06:00
Cameron Moore
5af6e4d1ec Open listener port earlier 2019-12-27 12:01:12 -06:00