npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pdpa-guard

v0.1.1

Published

PDPA compliance scanner for vibe-coded apps (Firebase/Supabase region, security rules, PII fields, cross-border subprocessors). Run with npx before you deploy.

Readme

pdpa-guard

สแกนโปรเจกต์ vibe-coded (Firebase / Supabase / vanilla JS) หา risk ตาม พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล (PDPA) ก่อนกด deploy — ไม่ต้อง install ถาวร รันผ่าน npx ได้เลย

ทำมาเพราะ AI coding assistant (รวมถึง Claude) จะ focus ที่ "ทำให้โค้ดรันได้" เป็นหลัก และมักข้ามเรื่อง region, security rules, PII field ไปโดยไม่ตั้งใจ — เครื่องมือนี้คือ safety net ชั้นสุดท้ายก่อน production

ใช้งาน

npx pdpa-guard .

จะได้ไฟล์ pdpa-report.md สรุปปัญหาทั้งหมด แยกตามความรุนแรง

Options

npx pdpa-guard <path>              # สแกนโฟลเดอร์ที่ระบุ (default: โฟลเดอร์ปัจจุบัน)
npx pdpa-guard . -o report.md      # เปลี่ยนชื่อไฟล์ output
npx pdpa-guard . --fail-on high    # exit code 1 ถ้าเจอ severity >= high (ใช้กับ CI/pre-commit hook)
npx pdpa-guard . --json            # output เป็น JSON แทน markdown

ใช้เป็น pre-deploy hook

เพิ่มใน package.json:

{
  "scripts": {
    "predeploy": "npx pdpa-guard . --fail-on critical"
  }
}

จะบล็อค deploy อัตโนมัติถ้าเจอ security rule เปิดกว้างแบบ allow read, write: if true;

สแกนอะไรบ้าง

| หมวด | เช็คอะไร | อ้างอิงกฎหมาย | |---|---|---| | Cloud Region | Firebase Realtime DB URL, Firestore locationId, Cloud Functions region — เตือนถ้าไม่ใช่ region เอเชีย | PDPA มาตรา 28-29 (โอนข้อมูลข้ามพรมแดน) | | Security Rules | firestore.rules, storage.rules, database.rules.json ที่เปิดกว้างแบบ if true หรือไม่มี auth check | ความเสี่ยงข้อมูลรั่วไหล — ปรับสูงสุด 5 ล้านบาท | | PII Fields | grep หา field name ที่เข้าข่ายข้อมูลส่วนบุคคล (ทั่วไป/อ่อนไหว/พิกัด/การเงิน/เด็ก) ทั้งไทยและอังกฤษ | PDPA มาตรา 6, 20, 24, 26 | | Subprocessors | third-party SDK ที่ส่งข้อมูลออกนอกประเทศ (Sentry, Gemini, OpenAI, Analytics ฯลฯ) | ต้องระบุใน Privacy Policy |

ข้อจำกัด (อ่านก่อนใช้จริง)

  • นี่คือ static scanner ไม่ใช่ legal audit — จับ pattern ที่พบบ่อยได้ แต่ไม่แทนที่ที่ปรึกษากฎหมาย/DPO
  • เช็ค region ได้เฉพาะที่ hardcode ไว้ในโค้ด/config — ถ้าตั้งผ่าน Firebase Console อย่างเดียวโดยไม่มี URL ในโค้ด จะตรวจไม่เจอ
  • PII keyword list เป็น heuristic — field ชื่อแปลกที่ไม่อยู่ใน list จะหลุดสแกน ควรเสริม rules/pii-keywords.json ตามโดเมนของแอปตัวเอง
  • ไม่เช็ค data flow จริง (field ที่เก็บแล้วส่งไปไหนต่อ) — เช็คแค่ "มี field นี้อยู่ในโค้ด"
  • Consent flow, Privacy Policy, Data Subject Rights ต้องทำเองตาม checklist ท้าย report

แก้ไข PII keyword list

เพิ่ม/ลบ keyword ได้ที่ rules/pii-keywords.json — แบ่งเป็น 5 หมวด: general, sensitive, location, financial, child แต่ละหมวดมี severity ต่างกัน

Subprocessor ที่รู้จัก

ดูรายชื่อทั้งหมดที่ lib/scanners/subprocessor-check.js — ครอบคลุม Firebase, Supabase, AWS, Clerk, Auth0, MongoDB Atlas, LINE API, Google Sheets, Omise/2C2P และอื่นๆ เพิ่มรายการใหม่ได้โดยแก้ array KNOWN_SUBPROCESSORS ในไฟล์นั้น

รันใน CI (GitHub Actions)

Copy .github/workflows/pdpa-check.yml ไปไว้ใน repo ของตัวเอง จะรันสแกนอัตโนมัติทุก PR/push และบล็อคถ้าเจอปัญหาระดับ critical พร้อม upload รายงานเป็น artifact ให้ดูย้อนหลังได้

ทดสอบ

npm test

ใช้ Node.js built-in test runner (node --test) ไม่มี dependency ภายนอก มี fixture โปรเจกต์จำลอง (มีปัญหา / ไม่มีปัญหา) อยู่ใน test/fixtures/

Publish / แจกต่อ

ดูขั้นตอนเต็มที่ PUBLISHING.md

License

MIT — เอาไปแจกต่อ แก้ไข ปรับใช้ได้อิสระ ดู LICENSE