Urgent.News

What's breaking now, across hundreds of outlets.

Tech

A vs B: Placing Your WAF Before or After a JSON API Gateway

An automated attacker does not need a suspicious URL to probe for SQL injection. A normal-looking POST to a search endpoint can carry the payload inside a JSON filter, nested object, or array. If the application builds SQL by concatenating that value, the request body becomes a route to the database. For security owners investigating how to block sql injection attempts hidden in json bodies,…

When designing a security strategy to protect against SQL injection attacks that exploit JSON bodies, the placement of a Web Application Firewall (WAF) becomes crucial. Two common deployment strategies are examined: inspecting JSON payloads before the API gateway (Option A) or after the gateway has transformed the request (Option B). Each placement offers distinct advantages and considerations depending on the specific deployment context and requirements.

In Option A, where inspection occurs before the API gateway, the WAF acts as the first layer of defense. The request, including its JSON payload, passes through the WAF where it can be examined for suspicious patterns indicative of an SQL injection attempt. This placement is beneficial when the API gateway itself is exposed to the internet or when multiple downstream APIs share a common entry point.

By filtering requests at the WAF level, the application is shielded from potentially harmful traffic before it reaches the gateway. However, it's essential to note that if the API gateway transforms the request body, for instance, altering the JSON structure or altering content, this can create a discrepancy between the request inspected by the WAF and the one forwarded to the application.

Consequently, there is a risk of missing some injection attempts, as the transformation could lead to a request that the WAF does not recognize as malicious.

Option B, on the other hand, places the WAF after the API gateway, meaning the request has already been transformed by the gateway before it encounters the WAF. This placement can be advantageous when the gateway performs necessary transformations, such as converting incoming data into a format expected by the application. Inspecting after the gateway ensures that the application receives requests in the format they are designed to handle, reducing the likelihood of misinterpretation or errors.

However, this approach increases the attack surface because the WAF must defend against attacks on all entry points, including internal and administrative endpoints. Additionally, any security controls placed at this stage must be robust enough to handle the transformed data and ensure that legitimate traffic is not inadvertently blocked.

In both scenarios, it's vital to conduct thorough testing. Authorized tests should be run against a staging environment, simulating a wide range of legitimate and malicious payloads, including nested JSON structures, malformed JSON, and various encoding techniques. The outcomes of these tests should be meticulously recorded, focusing on three key areas: the decision made by the WAF, whether the application successfully received the request, and the actions taken by the application with the received data.

While the presence of blocked responses indicates successful detection, it does not guarantee comprehensive coverage of all possible injection vectors or transformations.

The official documentation of SafeLine, a self-hosted WAF, outlines its capabilities in filtering HTTP traffic, including protection against SQL injection attacks. However, it does not specify whether SafeLine inspects nested JSON bodies or decodes JSON data to a certain depth. As such, validating the deployment of SafeLine within your specific environment becomes crucial.

This includes confirming the WAF's behavior regarding JSON parsing, ensuring that authentication contexts are preserved during request transformations, and verifying that client identities are accurately propagated to downstream systems for effective attribution and policy enforcement.

Ultimately, the choice between inspecting JSON payloads before or after an API gateway should be based on a comprehensive evaluation of the deployment environment, the specific security needs of the application, and the thoroughness of testing performed. Regardless of the chosen placement, implementing strict security practices, such as utilizing parameterized queries and explicitly allowing safe identifiers in dynamic queries, remains paramount in mitigating the risk of SQL injection attacks through JSON payloads.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How to Evaluate and Block SQL Injection Attempts Hidden in JSON Bodies

An API can reject suspicious query strings while still accepting dangerous input inside a JSON request body. A search endpoint might receive {"filter":"pending"} , then concatenate that value into a…

  • Identify endpoint and set safe test conditions
  • Install SafeLine WAF to filter HTTP/S traffic
  • Test JSON bodies in controlled environment

When a review sends the plan back

First published on openspec-ui.dev . A tester ran Review on an OpenSpec change and got five things to fix. They ran Propose again and saw no change in the files.

  • Review sends plan back for changes
  • Tester identifies five necessary fixes
  • Verdict "changes needed" triggers Update stage

How to Reply to a TikTok Comment With a Video (2026): Pick One Real Comment, Stick to Your Facts, Script It in 25 Seconds

Full disclosure: I built a comment-reply script tool on Capafy, so I'm biased. Everything below works with a notes app, the comment you want to answer and about fifteen minutes.

  • Select a real comment worthy of a reply, such as a question or objection.
  • Write only confirmed facts like numbers, experiences, and limitations.
  • Draft three reply angles: direct answer, demonstration, or reframed perspective.

Package a Chrome Extension Without Store Upload Errors

Originally published on ExtensionLaunch . If you want to package a Chrome extension for the Chrome Web Store, the file you need is a ZIP, not the CRX that Chrome's "Pack extension" button gives you.

  • Use ZIP format, not CRX, for Chrome extension uploads
  • Ensure ZIP contains extension files directly, not nested folders
  • Update version number in manifest.json to avoid rejection

More from Sunday, 29 November 2026 →