
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Chabot is Web-hook receiver for ChatWork.
Chabot は ChatWork と Webhook を提供しているサービスとを連携させるアプリケーションです。
WebHook で受け取ったデータを、ejs テンプレートで定義したメッセージを指定したチャットに送信することが出来ます。
npm install -g chabot
インストールが完了すると chabot コマンドが利用できるようになります。
$ chabot -h
Usage: chabot [options] [command]
Commands:
create [options] [appname] create chabot app
Options:
-h, --help output usage information
-V, --version output the version number
chabot アプリの作成は chabot create です。-d オプションで作成したい場所のディレクトリパスを指定します。
$ chabot create -h
Usage: create [options] [appname]
Options:
-h, --help output usage information
-d, --dist [dir] the directory to place the app in [default: CWD]
-f, --force overwrite existing directory
実際に chabot アプリを作成してみましょう。
$ chabot create -d ~/ my_first_chabot
copying files.
completed!
> /Users/astronaughts/chabot/my_first_chabot
設定ファイルを開いてみましょう。
$ cd ~/chabot/my_first_chabot
$ vi config.json
初期値として github というボットの設定があります。
{
"port": 5000,
"bots": {
"github": {
"hostname": "github.com",
"token": "YOUR_TOKEN",
"route": "/github/hooks/:roomid"
}
}
}
ポートを指定します。
ボットの設定を指定します。複数定義可能です。
ボットの発言としたいアカウントの ChatoWork API のトークンを指定します。
外部サービスの WebHook の送信先として URL を指定します。
URL には :roomid を必ず含めるようにします。
:roomid はボットに発言させたいチャットの ID を指定します。
bot の実装ファイルをここに配置します。
bot が送信するメッセージのテンプレートファイルをここに配置します。
chabot create で最初にサンプルとして bots/github.js が配置されています。
module.exports = function (chabot) {
// WebHook で受けたデータをセット
var payload = JSON.parse(chabot.data.payload);
// ChatWork API の endpoint をセット
var endpoint = '/rooms/' + chabot.roomid + '/messages';
// templats/ 内のメッセージテンプレートを読み込む
var template = chabot.readTemplate('github.ejs');
// WebHook で受けたデータでメッセージテンプレートを描画
var message_body = chabot.render(template, payload);
// ChatWork API でメッセージ送信
chabot.client
.post(endpoint, {
body: message_body
})
.done(function (res) {
chabot.log('done');
})
.fail(function (err) {
chabot.error(err);
});
};
URL に指定されたチャットルームの ID です。
ChatWork API を操作するクライアントです。詳細は以下を参照。
astronaughts/simple-cw-node - github
WebHook から受け取った response です。
templates で配置したテンプレートファイルを読み込みます。
読み込んだテンプレートファイルを描画します。
テンプレートは ejs が利用できます。
github ボットのテンプレートは以下のように定義してあります。
プッシュのお知らせ♪
[info]<%= head_commit.message %>
[hr]変更のあったファイル:
<% if (head_commit.added.length) { %>【追加】
<% head_commit.added.forEach(function (file) { %> <%= file %>
<% }) %><% } else { %>【追加】
なし
<% } %><% if (head_commit.removed.length) { %>【削除】
<% head_commit.removed.forEach(function (file) { %> <%= file %>
<% }) %><% } else { %>【削除】
なし
<% } %><% if (head_commit.modified.length) { %>【修正】
<% head_commit.modified.forEach(function (file) { %> <%= file %>
<% }) %><% } else { %>【修正】
なし
<% } %>[hr]リポジトリ:<%= repository.name %>
コミット :<%= head_commit.url %>
コミッター:<%= head_commit.committer.username %>
[/info]
以下のコマンドで簡単に実行可能です。
$ node app
loaded bot: github
curl などで、github の WebHook のデータを試しに送信してみてください。
FAQs
Chabot is Web-hook receiver for ChatWork
We found that chabot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.