Skip to content
Naoya Tech
Go back

Automating an OSS Vulnerability Feed with Notion Workers

10:03 Security

Overview

This video automates adding newly published vulnerabilities from the GitHub Security Advisory API to a Notion database, with no server to manage. naoyashiga studies security by reading OSS vulnerability reports and used to search the advisories by hand and paste links into Notion; automating that frees up time for learning.

It uses the Notion Developer Platform: the Notion CLI (ntn) to create and deploy the project, and Notion Workers to run the TypeScript code on Notion’s side. Claude Code writes the code.

Key Points

Chapters

概要

この動画では、GitHub Security Advisory APIで新しく公開された脆弱性情報を、サーバーを管理することなくNotionのデータベースへ自動で追加します。筆者はOSSの脆弱性報告を読んでセキュリティを学んでおり、これまではアドバイザリーを手作業で検索し、リンクをNotionに貼っていました。この作業を自動化することで、学習に使える時間が増えます。

使うのはNotion Developer Platformで、プロジェクトの作成とデプロイにはNotion CLI(ntn)を、TypeScriptのコードをNotion側で動かす場所としてNotion Workersを使います。コードはClaude Codeに書かせます。

ポイント

  • 定期実行するスクリプトには、ふつう誰かが面倒を見続けるサーバーが必要です。Notion Workersならコードを預けるだけで実行してくれるため、短時間で終わる処理を決まった間隔で回す用途に向いています。
  • Workersには、外部のデータを定期的にNotionへ取り込むSyncs、Notionのエージェントから呼び出せる関数のTools、外部サービスからのイベントを受け取るWebhooksがあります。今回はSyncsを使います。
  • ntn workers newでそのままデプロイできるプロジェクトが作られ、デプロイコマンド1つでバンドル、ビルド(サーバー側で実行)、アップロードまで済みます。同期のコードをデプロイして失敗した原因は、日付フィルターのバグでした。
  • 同期はGitHub APIのレートリミットを考えて6時間ごとに実行します。GitHub Advisory IDを主キーにupsertし、既存の行は更新、新しいものだけを追加します。
  • その後、脆弱性の種類によるカテゴリー(XSS、SSRF、RCEなど)を追加し、取得範囲を12時間から3日間に広げ、安くてOpenAI互換のAPIを持つDeepSeek V4 Flashによる日本語要約も加えます。APIキーは.envからntn workers env pushで環境変数として送ります。

チャプター

Watch on YouTube

Share this post on:

Previous Video
What Is Dependency Injection? Building It Up Step by Step
Next Video
How Git Works Internally: Blobs, Trees, Commits and Refs