Skip to content

Verify SSL certificates by default #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ Otherwise it's optional. <br/><br/>

To hide the output from curl set the argument `silent` to `true`. The default value is `false`.<br/><br/>

```yml
verify_ssl: false
```

To disable verification of SSL-certificates in curl set the argument `verify_ssl` to `false`. The default value is `true`. See also: [`curl` docs on option `-k`](https://curl.se/docs/manpage.html#-k).<br/><br/>


```yml
data: "Additional JSON or URL encoded data"
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
description: 'json | form-urlencoded | json-extended'
silent:
description: 'Optional, set to true to disable output and therefore IP leaking'
verify_ssl:
description: 'Optional, set to false to disable verification of SSL certificates'
default: true
data:
description: 'Optional additional data to include in the payload'

Expand Down
34 changes: 17 additions & 17 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ if [ -n "$webhook_auth" ]; then
WEBHOOK_ENDPOINT="-u $webhook_auth $webhook_url"
fi

options="--http1.1 --fail"

if [ "$silent" ]; then
curl -k -v --http1.1 --fail -s \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-Hub-Signature-256: sha256=$WEBHOOK_SIGNATURE_256" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT &> /dev/null
options="$options -s"
else
curl -k -v --http1.1 --fail \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-Hub-Signature-256: sha256=$WEBHOOK_SIGNATURE_256" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT
fi
options="$options -v"
fi

if [ "$verify_ssl" = false ]; then
options="$options -k"
fi

curl $options \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-Hub-Signature-256: sha256=$WEBHOOK_SIGNATURE_256" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT