Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/bketelsen/captainhook
A generic webhook endpoint that runs scripts based on the URL called
This tool was built as part of a CI orchestration process, to be called when
Docker trusted builds finish. It explicitly ignores the posted data from the webhook
because that would be insecure
, which is bad
.
Captainhook would not be possible if not for all of the great projects it depends on. Please see SHOULDERS.md to see a list of them.
go get github.com/bketelsen/captainhook
configdir
mkdir ~/captainhook
{
"scripts": [
{
"command": "ls",
"args": [
"-l",
"-a"
]
},
{
"command": "echo",
"args": [
"hello"
]
}
]
}
Name this script endpoint1.json
captainhook -configdir ~/captainhook
curl -X POST http://localhost:8080/endpoint1
Each script you create in the configdir
will be executed when
the corresponding endpoint is called.
If you have a script called deployBigApp.json
you would trigger
it by posting to http://your.captainhook.url/deployBigApp.
The scripts in the json file are executed sequentially, and the output is logged and returned to the caller in the response, which always has an HTTP status code of 200 (OK) even if your scripts didn't work. This is intentional, to avoid causing errors in external services like Docker or Github, which might not like you returning statuses other than 200 (OK).
You'll sometimes need to access the POST data of the request for information such as a callback URL. You can pass the raw POST data to a script by adding {{POST}} to the script arguments.
{
"scripts": [
{
"command": "echo",
"args": [
"{{POST}}"
]
}
]
}
You can limit who can call your webhooks by specifying "allowedNetworks" in the json config.
{
"scripts": [
{
"command": "echo"
}
],
"allowedNetworks": [
"10.0.0.0/8",
"127.0.0.1/32"
]
}
This would allow your hook to be called from the 10.0.0.0/8 network, or from localhost.
Only enable proxy support if you are on a trusted network behind a reverse proxy. End-users with direct network access can subvert the allowedNetworks restriction if proxy support is on.
captainhook -configdir ~/captainhook -enable-proxy -proxy-header X-Forwarded-For
docker pull bketelsen/captainhook
mkdir /some/local/config
$EDITOR /some/local/config/myhook.json
docker run -d -v /some/local/config:/config bketelsen/captainhook
captainhook requires Go 1.13+ to build locally.
go get github.com/bketelsen/captainhook
Download
mkdir -p $GOPATH/src/github.com/bketelsen
cd $GOPATH/src/github.com/bketelsen
git clone git@github.com:bketelsen/captainhook.git
go build .
Copyright 2014, Brian Ketelsen and Kelsey Hightower LICENSE information found in LICENSE file.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.