<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Athila Figueiredo</title>
    <description>The latest articles on DEV Community by Athila Figueiredo (@athilaf).</description>
    <link>https://dev.to/athilaf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4281485%2F1a61eb86-5fc1-4baa-b19b-346ec61d6155.png</url>
      <title>DEV Community: Athila Figueiredo</title>
      <link>https://dev.to/athilaf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/athilaf"/>
    <language>en</language>
    <item>
      <title>A Row-Level Security Policy That Looked Right -- Until My Own Test Suite Proved It Wasn't</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:56:21 +0000</pubDate>
      <link>https://dev.to/athilaf/a-row-level-security-policy-that-looked-right-until-my-own-test-suite-proved-it-wasnt-5kg</link>
      <guid>https://dev.to/athilaf/a-row-level-security-policy-that-looked-right-until-my-own-test-suite-proved-it-wasnt-5kg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw55trg1d8xz6zgcohcwr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw55trg1d8xz6zgcohcwr.png" alt="architecture diagram" width="800" height="907"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A security review of a multi-tenant, payments-adjacent platform keeps showing up in the kind of work I do — row-level security correctness, ledger immutability, refund rules. So I built the subject matter from scratch, specifically so the review methodology itself is demonstrable instead of just described in a proposal.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's enforced, and how
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tenant isolation&lt;/strong&gt;: real PostgreSQL Row-Level Security, &lt;code&gt;FORCE&lt;/code&gt;d even for the table owner. Verified by connecting as an isolated &lt;code&gt;app_user&lt;/code&gt; role under different session contexts and actually trying to read another tenant's data — not by reading the policy and assuming it's correct.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ledger immutability&lt;/strong&gt;: the app role was never granted &lt;code&gt;UPDATE&lt;/code&gt; or &lt;code&gt;DELETE&lt;/code&gt; on the ledger table — enforced by Postgres's privilege system before a row-level policy is even evaluated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refund rules&lt;/strong&gt;: a trigger rejects a refund that exceeds its charge's amount, and rejects a second refund against an already-refunded charge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Balance correctness&lt;/strong&gt;: the account balance is a view computed from the ledger entries, never a stored column — there's no balance that can drift out of sync with the transactions that are supposed to explain it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The real bug the test suite caught
&lt;/h2&gt;

&lt;p&gt;The first version of the tenant-isolation policy had what looked like a reasonable admin-bypass shortcut:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.tenant_id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
    &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;tenant_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.tenant_id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;uuid&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The intent: "no tenant context set means this must be an admin connection." The actual effect: &lt;strong&gt;any connection that simply forgot to set the tenant context — not an admin, just a bug — could see every tenant's data.&lt;/strong&gt; A test written specifically to check this (&lt;code&gt;test_no_tenant_context_sees_nothing&lt;/code&gt;) failed against it immediately.&lt;/p&gt;

&lt;p&gt;The fix removes the special case entirely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tenant_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.tenant_id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the tenant isn't set, the comparison against &lt;code&gt;NULL&lt;/code&gt; is &lt;code&gt;UNKNOWN&lt;/code&gt; for every row, and Postgres RLS treats &lt;code&gt;UNKNOWN&lt;/code&gt; as deny — so an unconfigured connection now correctly sees nothing. Admin access belongs on a separate role with &lt;code&gt;BYPASSRLS&lt;/code&gt;, never a magic value threaded through the tenant policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;PostgreSQL 16, Python, &lt;code&gt;psycopg&lt;/code&gt; 3, pytest. CI runs against a real &lt;code&gt;postgres:16&lt;/code&gt; service container, not SQLite and not a mock.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/postgres-ledger-rls-review" rel="noopener noreferrer"&gt;https://github.com/Athilaf/postgres-ledger-rls-review&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>security</category>
      <category>python</category>
      <category>testing</category>
    </item>
    <item>
      <title>Zero-Downtime Deploys, Proven With a Live Load Test Instead of a Green Checkmark</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:54:57 +0000</pubDate>
      <link>https://dev.to/athilaf/zero-downtime-deploys-proven-with-a-live-load-test-instead-of-a-green-checkmark-4ci9</link>
      <guid>https://dev.to/athilaf/zero-downtime-deploys-proven-with-a-live-load-test-instead-of-a-green-checkmark-4ci9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb5t4v1yjnv6mylihoofl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb5t4v1yjnv6mylihoofl.png" alt="architecture diagram" width="800" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A deploy that "succeeded" isn't the same as a deploy that dropped zero requests. Most "zero-downtime" pipelines run the script, see exit code 0, and call it done — without ever actually proving nothing was dropped while it happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The new container only goes live after it answers its own &lt;code&gt;/health&lt;/code&gt; check — never before.&lt;/li&gt;
&lt;li&gt;Cutover is an atomic pointer-file flip that a small reverse proxy re-reads on &lt;strong&gt;every single request&lt;/strong&gt;, so there's no restart and no dropped connection — the proxy is either talking to the old version or the new one, never neither.&lt;/li&gt;
&lt;li&gt;If the new version never becomes healthy after retries, it's torn down automatically and the old one keeps serving, completely untouched — rollback is the default outcome of failure, not a manual step someone has to remember.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The proof, not just the claim
&lt;/h2&gt;

&lt;p&gt;The integration test fires a request every 50ms through an entire live blue/green deploy and asserts every single one came back &lt;code&gt;200&lt;/code&gt; — not just that the deploy script exited cleanly. A second scenario deploys a container whose &lt;code&gt;/health&lt;/code&gt; deliberately always returns &lt;code&gt;500&lt;/code&gt;, and asserts the script refuses to cut over, removes the broken container, and that the live pointer never moved.&lt;/p&gt;

&lt;p&gt;Both scenarios run as real steps in CI, building and exercising the actual Docker image on every push — not a mocked version of the deploy.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Windows-specific bug that only showed up in CI
&lt;/h2&gt;

&lt;p&gt;Local tests passed. CI failed with &lt;code&gt;Permission denied&lt;/code&gt; trying to run &lt;code&gt;./scripts/deploy.sh&lt;/code&gt;. Root cause: Git for Windows ships with &lt;code&gt;core.filemode=false&lt;/code&gt; by default, so &lt;code&gt;chmod +x&lt;/code&gt; in the working tree is never actually recorded in the git index — the executable bit silently doesn't make it into the commit even though the file runs fine locally. Fixed with &lt;code&gt;git update-index --chmod=+x&lt;/code&gt; directly against the index instead of relying on the filesystem bit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Node.js (built-in &lt;code&gt;http&lt;/code&gt;/&lt;code&gt;fs&lt;/code&gt;/&lt;code&gt;node:test&lt;/code&gt;, zero runtime dependencies), Docker, GitHub Actions, Bash.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/cicd-blue-green-deploy" rel="noopener noreferrer"&gt;https://github.com/Athilaf/cicd-blue-green-deploy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>node</category>
      <category>github</category>
    </item>
    <item>
      <title>A Shopify Cart That Nudges Toward Free Shipping Instead of Just Showing a Total</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:49:51 +0000</pubDate>
      <link>https://dev.to/athilaf/a-shopify-cart-that-nudges-toward-free-shipping-instead-of-just-showing-a-total-48b2</link>
      <guid>https://dev.to/athilaf/a-shopify-cart-that-nudges-toward-free-shipping-instead-of-just-showing-a-total-48b2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33ctum4gnj2eo5xjrpbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F33ctum4gnj2eo5xjrpbf.png" alt="architecture diagram" width="800" height="1149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A static cart total doesn't nudge anyone toward free shipping — a progress bar and the right upsell do. But "the right upsell" is the part most implementations get wrong: suggest the cheapest item in the catalog and it won't cross the threshold; suggest the most expensive one lying around and you've oversold and look greedy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The heuristic
&lt;/h2&gt;

&lt;p&gt;Pick the &lt;strong&gt;cheapest candidate that still crosses the remaining amount&lt;/strong&gt; to free shipping. Nothing more, nothing less. If no candidate crosses it, fall back to the most expensive one available — still the best progress on offer, honestly presented.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Liquid, not a mockup
&lt;/h2&gt;

&lt;p&gt;The snippets (&lt;code&gt;cart-progress-bar.liquid&lt;/code&gt;, &lt;code&gt;cart-upsell.liquid&lt;/code&gt;) are the actual templates a Shopify theme would ship — rendered and tested headlessly with &lt;code&gt;liquidjs&lt;/code&gt;, a standalone Liquid engine, so the logic is verified without needing a live store or the Shopify CLI.&lt;/p&gt;

&lt;p&gt;The same math runs twice, deliberately: server-side in Liquid math filters on first page load, then through a tested TypeScript module (&lt;code&gt;cartMath.ts&lt;/code&gt;) on every AJAX add-to-cart afterward. One source of truth for the decision logic, not two copies that quietly drift apart over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  A finding worth knowing if you're testing Shopify themes headlessly
&lt;/h2&gt;

&lt;p&gt;Shopify's &lt;code&gt;| money&lt;/code&gt; filter — used everywhere in real themes to format cents as currency — is provided by the Shopify platform itself, not by core Liquid. &lt;code&gt;liquidjs&lt;/code&gt; doesn't ship it. The test suite registers a small shim to render these snippets outside of a store — deliberately simple (USD, two decimals), explicitly documented as a test shim, not a reimplementation of Shopify's real multi-currency formatting.&lt;/p&gt;

&lt;p&gt;16 tests cover both the pure decision logic and the actual rendered HTML output of the real Liquid templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;TypeScript, Liquid, Vitest, &lt;code&gt;liquidjs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/shopify-cart-upsell" rel="noopener noreferrer"&gt;https://github.com/Athilaf/shopify-cart-upsell&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>typescript</category>
      <category>liquid</category>
      <category>testing</category>
    </item>
    <item>
      <title>JWT Auth Where a Stolen Refresh Token Burns Itself</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:44:45 +0000</pubDate>
      <link>https://dev.to/athilaf/jwt-auth-where-a-stolen-refresh-token-burns-itself-1936</link>
      <guid>https://dev.to/athilaf/jwt-auth-where-a-stolen-refresh-token-burns-itself-1936</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx8k65whbq2x4zmpj3hdm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx8k65whbq2x4zmpj3hdm.png" alt="architecture diagram" width="800" height="984"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A refresh token that lives for days and never changes is a single point of failure. If it leaks — a log line, a proxy, a browser extension — it's valid until it expires, and there's no way to tell the difference between the legitimate user and whoever stole it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: treat every refresh token as single-use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each successful &lt;code&gt;/auth/refresh&lt;/code&gt; call rotates the token — the one just used is invalidated, a new one is issued.&lt;/li&gt;
&lt;li&gt;If the &lt;strong&gt;same&lt;/strong&gt; token is ever presented a second time, that's not a client retrying — a legitimate client never reuses a token it already exchanged. It means the token leaked and someone else is replaying it.&lt;/li&gt;
&lt;li&gt;The response to that reuse isn't "reject this one request" — it's revoking &lt;strong&gt;every&lt;/strong&gt; active session for that user, treating it as a compromise signal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built with ASP.NET Core 8 Minimal APIs, BCrypt password hashing, short-lived HMAC-signed access tokens, and 12 xUnit tests — including a fake-clock abstraction so expiry logic is tested deterministically instead of with real &lt;code&gt;Thread.Sleep&lt;/code&gt; calls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two real bugs, found by actually running the thing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bug 1 — caught by the test suite itself:&lt;/strong&gt; the rotation logic was treating &lt;em&gt;any&lt;/em&gt; revoked token — including ones revoked through a normal, legitimate logout — as "reuse detected." That would have falsely nuked a user's other active sessions just because they logged out somewhere else. Fixed by separating &lt;code&gt;WasRotated&lt;/code&gt; (genuine reuse signal) from &lt;code&gt;IsRevoked&lt;/code&gt; (administrative revocation) as two distinct states instead of one conflated boolean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bug 2 — caught only by running the API manually, not by unit tests:&lt;/strong&gt; &lt;code&gt;/me&lt;/code&gt;, a protected endpoint, returned &lt;code&gt;null&lt;/code&gt; for every claim even with a perfectly valid token. ASP.NET Core silently remaps short JWT claim names (&lt;code&gt;sub&lt;/code&gt;, &lt;code&gt;unique_name&lt;/code&gt;) to long &lt;code&gt;ClaimTypes&lt;/code&gt; URIs on the way in by default — &lt;code&gt;options.MapInboundClaims = false&lt;/code&gt; fixes it. Unit tests of the token service in isolation never would have caught this; it only shows up once the actual middleware pipeline runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;C#, .NET 8, ASP.NET Core, BCrypt.Net-Next, xUnit.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/jwt-auth-api" rel="noopener noreferrer"&gt;https://github.com/Athilaf/jwt-auth-api&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>security</category>
      <category>testing</category>
    </item>
    <item>
      <title>Reservations That Survive 50 Simultaneous Buyers Without Overselling One Unit</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:39:38 +0000</pubDate>
      <link>https://dev.to/athilaf/reservations-that-survive-50-simultaneous-buyers-without-overselling-one-unit-nde</link>
      <guid>https://dev.to/athilaf/reservations-that-survive-50-simultaneous-buyers-without-overselling-one-unit-nde</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0u48nusch4j97zsj7m27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0u48nusch4j97zsj7m27.png" alt="architecture diagram" width="800" height="1164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Two requests both read "10 available." Both reserve 6. That's overselling — the classic e-commerce bug — and it's usually a database-locking problem wearing a business-logic costume. Most fixes either slow everything down with a heavy lock held across a network round-trip, or don't actually close the race condition.&lt;/p&gt;

&lt;h2&gt;
  
  
  The approach
&lt;/h2&gt;

&lt;p&gt;Optimistic concurrency instead of a database lock: an atomic compare-and-swap on a versioned record, with retry on conflict. No lock held while waiting on the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test that actually matters
&lt;/h2&gt;

&lt;p&gt;50 threads race to reserve 1 unit each from a stock of 20. The result: exactly 20 successes, 30 "out of stock" — zero oversold, every single run, not just on a lucky one. That's the whole point of testing concurrency logic with actual concurrent threads instead of asserting on the function in isolation.&lt;/p&gt;

&lt;p&gt;Built with Java, Spring Boot, and gRPC — with the domain logic and the RPC layer tested &lt;strong&gt;separately&lt;/strong&gt;, so a bug in the gRPC plumbing can't hide behind a mock of the business logic, and vice versa. The gRPC layer itself is tested in-process (server and channel in the same JVM), which is the pattern grpc-java itself recommends — no real network port needed to verify the service contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  A build error that only showed up in CI
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;protoc-gen-grpc-java&lt;/code&gt; generates code that references &lt;code&gt;javax.annotation.Generated&lt;/code&gt;, which was removed from the JDK starting with Java 9. Fixed by adding &lt;code&gt;javax.annotation-api&lt;/code&gt; as a compile-time dependency — found because CI uses a clean JDK, not because it was anticipated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Java, Spring Boot, gRPC.&lt;/p&gt;

&lt;p&gt;If overselling has ever cost you a refund, an apology email, or a customer, this is the pattern that makes it structurally impossible instead of "handled most of the time."&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/inventory-reservation-grpc" rel="noopener noreferrer"&gt;https://github.com/Athilaf/inventory-reservation-grpc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>grpc</category>
      <category>springboot</category>
      <category>concurrency</category>
    </item>
    <item>
      <title>Turning an AWS WAF From a Checkbox Into a Dashboard You Actually Read</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:34:32 +0000</pubDate>
      <link>https://dev.to/athilaf/turning-an-aws-waf-from-a-checkbox-into-a-dashboard-you-actually-read-1o5d</link>
      <guid>https://dev.to/athilaf/turning-an-aws-waf-from-a-checkbox-into-a-dashboard-you-actually-read-1o5d</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhupx6vaeryko5zebrwxa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhupx6vaeryko5zebrwxa.png" alt="architecture diagram" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A WAF that just sits there "protecting" an app isn't a security review — it's a checkbox nobody ever looks at again. The real question a WAF should be able to answer at a glance is: is something actually happening right now, and does it need a human?&lt;/p&gt;

&lt;h2&gt;
  
  
  What this baseline includes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Rate limiting plus two AWS-managed rule groups.&lt;/li&gt;
&lt;li&gt;Full request logging into a pre-wired CloudWatch dashboard — not logs that exist somewhere and get checked during an incident, a dashboard that's already there.&lt;/li&gt;
&lt;li&gt;A Python module that turns the raw log stream into what a review actually reads: block rate over time, the IPs getting blocked most, and an alert threshold with a &lt;strong&gt;minimum-sample guard&lt;/strong&gt; — so a quiet afternoon with 3 requests doesn't trigger a false alarm the way a naive percentage threshold would.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tested, not just deployed
&lt;/h2&gt;

&lt;p&gt;12 tests cover the analysis module specifically — including the minimum-sample guard, which is the one piece of logic in this project that isn't obvious until you've been burned by a false alarm from a tiny sample size in production.&lt;/p&gt;

&lt;p&gt;Fully defined in Terraform, validated with &lt;code&gt;checkov&lt;/code&gt; in CI on every push — static analysis, no AWS account needed to confirm the security posture is sound before you ever deploy it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Python, Terraform/AWS, GitHub Actions.&lt;/p&gt;

&lt;p&gt;If your WAF logs exist but nobody's ever turned them into a number worth checking at a glance, this is that number.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/aws-waf-security-dashboard" rel="noopener noreferrer"&gt;https://github.com/Athilaf/aws-waf-security-dashboard&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>python</category>
      <category>terraform</category>
    </item>
    <item>
      <title>Migrating a Task Queue's Broker Without Losing a Single Job in Flight</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:29:26 +0000</pubDate>
      <link>https://dev.to/athilaf/migrating-a-task-queues-broker-without-losing-a-single-job-in-flight-ol4</link>
      <guid>https://dev.to/athilaf/migrating-a-task-queues-broker-without-losing-a-single-job-in-flight-ol4</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78pd63d9r0o3gfwssizi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78pd63d9r0o3gfwssizi.png" alt="architecture diagram" width="800" height="1498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Swapping the broker behind a task queue sounds like a connection-string change until you ask the real question: what happens to the job that's mid-flight at the exact moment you cut over? Lose it, and work silently disappears — no error, no log, just a task that never runs. Duplicate it, and you've charged a card twice or sent a notification twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern
&lt;/h2&gt;

&lt;p&gt;A four-phase state machine for the cutover: &lt;strong&gt;parallel → cutover → draining → decommissioned&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explicit rules for which transitions are allowed, including rollback, at every phase.&lt;/li&gt;
&lt;li&gt;The old broker only gets decommissioned once &lt;strong&gt;two independent signals agree&lt;/strong&gt; it's actually empty — not one check that could be wrong, not a timer, not an assumption.&lt;/li&gt;
&lt;li&gt;Terraform provisions the replacement broker (ElastiCache/Valkey): replication group, subnet group, security group, parameter group.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security findings that came from a real tool, not a self-assessment
&lt;/h2&gt;

&lt;p&gt;This is the project where Checkov stopped being theoretical. Three rounds of real findings, fixed in sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Missing &lt;code&gt;auth_token&lt;/code&gt; on the replication group, and &lt;code&gt;multi_az_enabled&lt;/code&gt; expressed as a conditional Terraform expression — Checkov's static analysis can't resolve a conditional, it needs a literal &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Security group and rule missing &lt;code&gt;description&lt;/code&gt;, wide-open egress to &lt;code&gt;0.0.0.0/0&lt;/code&gt; on all ports (removed entirely — the broker never needs to call out), and no customer-managed KMS key on the replication group (added a dedicated &lt;code&gt;aws_kms_key&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The KMS key created in step 2 didn't have an explicit &lt;code&gt;policy&lt;/code&gt; — added one scoped to the account root, no wildcard principal.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each fix revealed the next real finding. The lesson that stuck: only close the loop when CI is actually green, never on the first commit that looks like a fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Python (state machine + 10 tests, all passing locally before push), Terraform/AWS.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/redis-to-elasticache-zero-downtime" rel="noopener noreferrer"&gt;https://github.com/Athilaf/redis-to-elasticache-zero-downtime&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>terraform</category>
      <category>devops</category>
    </item>
    <item>
      <title>A Webhook That Arrives Twice Should Never Run Your Handler Twice</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:20:49 +0000</pubDate>
      <link>https://dev.to/athilaf/a-webhook-that-arrives-twice-should-never-run-your-handler-twice-1k7g</link>
      <guid>https://dev.to/athilaf/a-webhook-that-arrives-twice-should-never-run-your-handler-twice-1k7g</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsy7j1f2b7tjzzlvzcabv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsy7j1f2b7tjzzlvzcabv.png" alt="architecture diagram" width="800" height="1353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A webhook arriving twice isn't an edge case — it's the normal behavior of at-least-once delivery, which is what every major provider actually guarantees. Retry a timeout, hit a race condition, and your handler gets called twice for the same event. If it isn't built for that, the failure mode is invisible until a customer gets charged twice or an email goes out twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this implements
&lt;/h2&gt;

&lt;p&gt;The same security scheme providers like Stripe use, built from scratch and implemented twice — independently, in Python and Node.js:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HMAC-SHA256 signature verification&lt;/strong&gt; — reject anything not actually signed by the sender's shared secret.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timestamp validation&lt;/strong&gt; — reject stale or replayed requests outside an acceptable window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idempotency-key deduplication&lt;/strong&gt; — catch true duplicates even when the signature and timestamp both check out.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where the two ecosystems actually differ
&lt;/h2&gt;

&lt;p&gt;This is the part most "same thing in two languages" demos skip, and it's the part that actually matters if you're hiring across stacks:&lt;/p&gt;

&lt;p&gt;Python's &lt;code&gt;hmac.compare_digest&lt;/code&gt; tolerates comparing strings of different lengths — it just returns &lt;code&gt;False&lt;/code&gt;. Node's &lt;code&gt;crypto.timingSafeEqual&lt;/code&gt; throws an exception if the buffers aren't the same length. Naively porting the Python logic to Node means an unhandled exception on a malformed request instead of a clean 401. The Node implementation checks length before the constant-time comparison specifically because of this difference — documented in the README, not just discovered and silently patched.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's tested
&lt;/h2&gt;

&lt;p&gt;7 tests in Python (&lt;code&gt;pytest&lt;/code&gt;), 7 in Node (&lt;code&gt;node --test&lt;/code&gt;) — both passing locally before every push, both confirmed green in CI independently (two separate jobs: &lt;code&gt;python-tests&lt;/code&gt;, &lt;code&gt;node-tests&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Python, Node.js, HMAC-SHA256, pytest, node:test, GitHub Actions.&lt;/p&gt;

&lt;p&gt;If you're integrating any payment, messaging, or SaaS webhook and "what happens if it arrives twice" isn't already answered in your code, this is the answer — in whichever of the two stacks you're running.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/webhook-idempotent-auth" rel="noopener noreferrer"&gt;https://github.com/Athilaf/webhook-idempotent-auth&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>node</category>
      <category>webhooks</category>
      <category>security</category>
    </item>
    <item>
      <title>Removing the One Secret Most CI/CD Pipelines Still Leave Lying Around</title>
      <dc:creator>Athila Figueiredo</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:20:19 +0000</pubDate>
      <link>https://dev.to/athilaf/removing-the-one-secret-most-cicd-pipelines-still-leave-lying-around-3p9c</link>
      <guid>https://dev.to/athilaf/removing-the-one-secret-most-cicd-pipelines-still-leave-lying-around-3p9c</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1wxvm0dmswt23enf92zu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1wxvm0dmswt23enf92zu.png" alt="architecture diagram" width="799" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Every long-lived AWS credential sitting in a CI secrets vault is a standing risk — not because the vault is weak, but because a credential that never expires is a credential that, if it ever leaks, works forever until someone notices and rotates it manually.&lt;/p&gt;

&lt;p&gt;Most "fix" that risk by rotating the key more often. That's treating the symptom. The actual fix is to remove the static credential entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this module does
&lt;/h2&gt;

&lt;p&gt;This Terraform module replaces static AWS access keys in GitHub Actions with OIDC federation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Actions issues a short-lived OIDC token for the workflow run.&lt;/li&gt;
&lt;li&gt;AWS exchanges that token for a temporary IAM role session — scoped to the specific repository and branch via the role's trust policy.&lt;/li&gt;
&lt;li&gt;There is no static key to rotate, because there is no static key to leak in the first place.&lt;/li&gt;
&lt;li&gt;The temporary session expires automatically; no manual cleanup, no secret rotation schedule to maintain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's actually in the repo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A complete Terraform module (&lt;code&gt;main.tf&lt;/code&gt;, &lt;code&gt;variables.tf&lt;/code&gt;, &lt;code&gt;outputs.tf&lt;/code&gt;, &lt;code&gt;versions.tf&lt;/code&gt;) — not a snippet, something you can plan/apply.&lt;/li&gt;
&lt;li&gt;A GitHub Actions CI workflow that validates the module itself on every push: &lt;code&gt;terraform fmt&lt;/code&gt;, &lt;code&gt;terraform validate&lt;/code&gt;, &lt;code&gt;tflint&lt;/code&gt;, and &lt;code&gt;checkov&lt;/code&gt; — all static analysis, no AWS account needed to verify the module is sound.&lt;/li&gt;
&lt;li&gt;Three Mermaid diagrams in the README: the architecture, a before/after comparison, and a sequence diagram of the actual OIDC handshake.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A real lint finding, not just a clean first pass
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tflint&lt;/code&gt; caught an actually unused &lt;code&gt;data "aws_caller_identity"&lt;/code&gt; block left over from an earlier draft — removed before the first green CI run. Small, but it's the kind of thing that's easy to miss by eye and exactly what static analysis in CI is for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Terraform, AWS IAM, GitHub Actions.&lt;/p&gt;

&lt;p&gt;If your pipeline still has an &lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt; sitting in a GitHub secret right now, this is the pattern that removes it for good.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Athilaf/aws-github-oidc-keyless-auth" rel="noopener noreferrer"&gt;https://github.com/Athilaf/aws-github-oidc-keyless-auth&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>github</category>
      <category>security</category>
    </item>
  </channel>
</rss>
