Skip to content

Dev merge - Title: Blog content: Post A + article updates with real code and tutorial links - #21

Merged
csupenn merged 12 commits into
mainfrom
dev
Jun 15, 2026
Merged

csupenn merged 12 commits into
mainfrom
dev

Conversation

@csupenn

@csupenn csupenn commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Post A — new blog article: The Bug That Made My Encryption Instantly Useless (encryption-bug-aes-gcm-ephemeral-key): covers the ephemeral-key bug in getEncryptionKey(), the AES-GCM
    authentication-tag failure, the three-tier fix (memory cache → localStorage persist → importKey), round-trip test pattern, and the honest XSS limitation of client-held keys
  • SSRF article (preventing-ssrf-attacks-ai-workflows): rewrote with real ssrf.ts code, provenance-aware exemption, DNS-rebinding limitation, GitHub link, Tutorial 01 cross-link; fixed inaccurate
    "allowlist" claim
  • Five Layers article (five-layers-of-security-owasp-top-10): A03 updated with AES-256-GCM at rest + XSS limitation; rate limiting updated to UpstashRateLimitStore / pluggable store; A10 adds
    provenance-aware exemption; inline GitHub links to ssrf.ts, encryption.ts, rate-limit.ts; Tutorial 01/02/04 cross-links
  • Other articles: GitHub repo link + topflow.dev/blog cross-links added to ciso-to-fullstack-developer, gdpr-compliance-by-design, open-source-security-transparency,
    why-i-built-topflow-without-a-database; fixed "10 node types" → "12"
  • Docs: implementation status updated (T4/T6/T7 ✅, test count 536/27 suites), README SEO link to AI Security Tutorials, AI-Security README Published column with topflow.dev/blog URLs

Test plan

  • pnpm tsc --noEmit exits clean
  • pnpm lint — no new errors
  • Visit topflow.dev/blog after deploy: new Post A renders, SSRF and Five Layers articles show updated content
  • Confirm GitHub links in articles resolve to correct files on main

csupenn and others added 12 commits June 14, 2026 19:38
T6 — architecture-overview.md:
- Sandbox: honest "new Function() with limited scope" wording; note T3 as planned
- Rate limiter: note in-memory/per-instance limitation; note T4 as planned
- SSRF: reference lib/security/ssrf.ts and provenance-aware exemption
- Contributing: replace shipped items (SSRF, testing) with actual open items (T3, T4)
- Dev setup: remove "(when available)" from pnpm test comment

T7 — next.config.mjs:
- Remove typescript.ignoreBuildErrors — tsc --noEmit passes clean (0 errors)
…19)

T6 — architecture-overview.md:
- Sandbox: honest "new Function() with limited scope" wording; note T3
as planned
- Rate limiter: note in-memory/per-instance limitation; note T4 as
planned
- SSRF: reference lib/security/ssrf.ts and provenance-aware exemption
- Contributing: replace shipped items (SSRF, testing) with actual open
items (T3, T4)
- Dev setup: remove "(when available)" from pnpm test comment

T7 — next.config.mjs:
- Remove typescript.ignoreBuildErrors — tsc --noEmit passes clean (0
errors)
Adds UpstashRateLimitStore implementing the existing RateLimitStore
interface using a Redis sorted-set sliding window (ZADD + ZREMRANGEBYSCORE
+ ZRANGE pipeline). The execute-workflow route now picks the store via
createUpstashStore(): uses Upstash when UPSTASH_REDIS_REST_URL and
UPSTASH_REDIS_REST_TOKEN are set, falls back to MemoryRateLimitStore
otherwise (CI, local dev without Redis).

No changes to RateLimiter or existing rate-limit tests — only the store
changes. 7 new tests covering pipeline commands, timestamp parsing, NaN
filtering, null zrange handling, and RateLimiter integration.

deps: @upstash/redis (REST client, no native binaries)
Adds Tutorial 04 covering the Redis sorted-set sliding-window adapter
(UpstashRateLimitStore). Explains why in-memory limiting fails in
serverless (per-instance counters), the ZADD/ZREMRANGEBYSCORE/ZRANGE
pipeline, graceful env-var fallback, and the mock-in-tests pattern.
Includes attack trees for multi-instance bypass and residual IP-rotation
gap, plus 5 hands-on labs.

Updates tutorial series index and implementation status to reflect T4
shipped and Tutorial 04 draft-complete.
makeMockRedis now returns { redis, calls } so tests access the calls
array directly instead of casting redis.pipeline() to a type that
doesn't overlap with Upstash's Pipeline<[]>.
 Code (2 commits):
- UpstashRateLimitStore — Redis sorted-set sliding window, 4-command
pipeline, createUpstashStore() env-var factory
- Route wired to pick Redis when env vars present, fall back to
in-memory
  - jest.config.js updated to transform @upstash/redis (ESM)
  - Route test mocks the store module to stay hermetic
  - 7 new tests, 536 total passing

Tutorial 04 — full 8-section doc covering: why in-memory fails in
serverless, the sorted-set algorithm, multi-instance attack trees,
interface-first
design payoff, graceful-fallback trade-off, and 5 hands-on labs
including the "break the uniqueness invariant" exercise.
Publishes "The Bug That Made My Encryption Instantly Useless" — a
security case study of the getEncryptionKey() ephemeral-key bug:
generateKey() was called on every invocation, producing a fresh key
each time, making every ciphertext immediately unrecoverable.

Covers the bug mechanism, why AES-GCM fails silently on key mismatch,
the generate-once/cache/persist fix, the round-trip test that catches
it, and the honest XSS limitation of a client-held key.

- lib/blog/blog-data.ts: add metadata (slug, SEO, category: Security)
- components/blog/articles/encryption-bug-aes-gcm-ephemeral-key.tsx: full article
- components/blog/blog-content.tsx: register EncryptionBugContent in contentMap
- 05-implementation-status.md: mark T6/T7 ✅ Done (PR #19), T4 durable
  rate limiter ✅ shipped (PR #20); update test count 503→536,
  suites 25→27; advance branch baseline to 71c7d34
- README.md: add AI Security Tutorials row in Documentation section
  linking to docs/AI-Security/ and topflow.dev/blog (SEO cross-link)
- docs/AI-Security/osv-scanner/README.md: replace Blocker column with
  Published column containing topflow.dev/blog URLs for tutorials
  01/02/04/05; fix stale "03 and 04 blocked" note → only 03 blocked
…torial cross-links

- preventing-ssrf-attacks-ai-workflows: rewrote with real ssrf.ts code, provenance-aware
  exemption explanation, DNS-rebinding honest limitation, GitHub link, Tutorial 01 cross-link;
  fixed inaccurate "allowlist" claim to reflect actual blocklist implementation
- five-layers-of-security-owasp-top-10: A03 now mentions AES-256-GCM at rest with XSS
  limitation; rate limiting updated to reference UpstashRateLimitStore/pluggable store
  interface; A10 adds provenance-aware exemption; GitHub links and Tutorial 01/02/04 cross-links added
- ciso-to-fullstack-developer: fix "10 node types" → "12"; add GitHub + topflow.dev/blog CTA
- gdpr-compliance-by-design: add GitHub link to conclusion CTA
- open-source-security-transparency: add GitHub link to conclusion
- why-i-built-topflow-without-a-database: add GitHub link referencing encryption.ts
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
top-flow Ready Ready Preview, Comment Jun 15, 2026 7:22am

@csupenn
csupenn merged commit 9ada3ad into main Jun 15, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — 257ccfd7 Deployed Jun 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant