<?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: Sulav Dahal</title>
    <description>The latest articles on DEV Community by Sulav Dahal (@sulav_dahal).</description>
    <link>https://dev.to/sulav_dahal</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2570248%2Ffd2afcc1-ee47-4297-b96e-8938f9a5ff2c.jpg</url>
      <title>DEV Community: Sulav Dahal</title>
      <link>https://dev.to/sulav_dahal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sulav_dahal"/>
    <language>en</language>
    <item>
      <title>From Paper to Code: Why Security is Now a Business Imperative for Developers</title>
      <dc:creator>Sulav Dahal</dc:creator>
      <pubDate>Sat, 14 Dec 2024 14:36:03 +0000</pubDate>
      <link>https://dev.to/sulav_dahal/from-paper-to-code-why-security-is-now-a-business-imperative-for-developers-2g47</link>
      <guid>https://dev.to/sulav_dahal/from-paper-to-code-why-security-is-now-a-business-imperative-for-developers-2g47</guid>
      <description>&lt;p&gt;Software isn’t just about making businesses efficient anymore — it’s about making them secure.&lt;/p&gt;

&lt;p&gt;In the past, businesses operated on paper; mistakes or breaches were physical, limited in scope. Today, everything runs on software — orders, transactions, customer records, entire infrastructures. The stakes? Higher than ever. A single vulnerability can destroy trust, cost millions, and expose sensitive customer data.&lt;/p&gt;

&lt;p&gt;As developers, we’re not just building software; we’re &lt;strong&gt;custodians of digital trust&lt;/strong&gt;. Here’s how we can &lt;strong&gt;think security-first&lt;/strong&gt; from day one, and ensure your systems are resilient at every stage — development, deployment, and maintenance.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;1. Development: Building a Foundation of Trust&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Encrypt Data in Transit and at Rest&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data in transit or at rest should never be left exposed. Without encryption, anyone snooping on the network can read sensitive information. Use &lt;strong&gt;HTTPS (TLS)&lt;/strong&gt; for all communications and encrypt sensitive data like passwords and personally identifiable information (PII) with robust algorithms like &lt;strong&gt;AES-256&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;Encrypt data in transit using Python with &lt;code&gt;ssl&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;import ssl
import socket

context = ssl.create_default_context()
hostname = "example.com"

with socket.create_connection((hostname, 443)) as sock:
    with context.wrap_socket(sock, server_hostname=hostname) as ssock:
        print(ssock.version())  # Output: TLSv1.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; For APIs, libraries like &lt;code&gt;httpx&lt;/code&gt; or frameworks like Django enforce HTTPS by default. Enable these options and test their configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Validate All Inputs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Every input a user provides is a potential attack vector. Without validation, you’re vulnerable to SQL injection, cross-site scripting (XSS), and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Exploit Scenario:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An attacker submits &lt;code&gt;' OR 1=1 --&lt;/code&gt; in a login form. If your backend appends this to an SQL query, they bypass authentication entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Fix:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Use parameterized queries to sanitize inputs. For example, in Python with SQLAlchemy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sqlalchemy import text

query = text("SELECT * FROM users WHERE email = :email")
result = db.execute(query, {"email": user_email})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip&lt;/strong&gt;: Output encoding matters too. For web apps, use libraries like &lt;strong&gt;Django’s&lt;/strong&gt; &lt;code&gt;mark_safe&lt;/code&gt; or &lt;strong&gt;Jinja2&lt;/strong&gt; carefully. XSS attacks thrive on unescaped HTML.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;2. Deployment: The Silent Killer — Misconfigurations&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;SeManage Secrets Securely&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Hardcoding API keys or passwords in source code is a recipe for disaster. Use tools like &lt;strong&gt;AWS Secrets Manager&lt;/strong&gt; or &lt;strong&gt;HashiCorp Vault&lt;/strong&gt; to manage them securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bad Practice Example&lt;/strong&gt;:&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 = “12345-super-secret-key”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Good Practice:&lt;/strong&gt; Store secrets in environment variables and retrieve them dynamically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os

api_key = os.getenv("API_KEY")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Harden Your CI/CD Pipeline&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;CI/CD systems are juicy targets. If an attacker compromises your pipeline, they can inject malicious code into your production build.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use &lt;strong&gt;signed commits&lt;/strong&gt; and enforce them with tools like Git Hooks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integrate security scans into the pipeline (e.g., &lt;strong&gt;Snyk&lt;/strong&gt;, &lt;strong&gt;Dependabot&lt;/strong&gt;, or &lt;strong&gt;OWASP Dependency-Check&lt;/strong&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: GitHub Actions configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jobs:
  security_scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run Snyk Scan
        run: snyk test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Regularly rotate CI/CD credentials and restrict permissions to only what’s necessary.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;3. Maintenance: Securing the Software Lifecycle&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Monitor for Vulnerabilities&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Your job doesn’t stop after deployment. Systems evolve, but so do threats. Use tools like &lt;strong&gt;OSSEC, Wazuh&lt;/strong&gt; or any reliable &lt;strong&gt;SIEM&lt;/strong&gt; for host-based intrusion detection.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Log Monitoring&lt;/strong&gt;: Set up alerts for unusual behavior. For example, multiple failed login attempts or suspicious API requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Patching&lt;/strong&gt;: Stay on top of vulnerabilities with tools like &lt;strong&gt;Nessus&lt;/strong&gt; or &lt;strong&gt;OpenVAS&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Plan for Incident Response&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;No system is foolproof. What matters is how quickly and effectively you respond.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Playbooks&lt;/strong&gt;: Create predefined response plans for common scenarios (e.g., data breaches, DDoS attacks).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backups&lt;/strong&gt;: Encrypt them and store them securely. Test restoration regularly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real Threat&lt;/strong&gt;: Ransomware can lock your systems. If you don’t have offline backups, you’re toast.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Pro Tip: Adopt a Zero-Trust Architecture&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Operate under the assumption that &lt;strong&gt;nothing is safe by default&lt;/strong&gt;. Authenticate and authorize every user, service, and device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best Practices&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use micro-segmentation to limit lateral movement within networks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement Multi-Factor Authentication (MFA) for all critical systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Encrypt internal communications with mutual TLS (mTLS).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;4. Advanced Considerations&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Securing Serverless Apps&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Modern architectures bring new challenges. For serverless apps, ensure that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;IAM roles have &lt;strong&gt;least privilege access&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Events are validated before triggering lambda functions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Protecting APIs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;APIs are everywhere — and attackers love them. Secure them with rate limiting, authentication, and input validation.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Example&lt;/strong&gt;: Using Flask-Limiter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask_limiter import Limiter
from flask_limiter.util import get_remote_address

limiter = Limiter(key_func=get_remote_address)
app = Flask(__name__)
limiter.init_app(app)

@app.route("/api", methods=["GET"])
@limiter.limit("5 per minute")
def api():
    return "Rate limited API"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Closing Thoughts&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Security isn’t a feature. It’s a mindset. The moment you think you’ve done enough, a new vulnerability will emerge. Treat security as a continuous process — review your practices, learn from breaches, and evolve.&lt;/p&gt;

&lt;p&gt;Remember, the software you build today runs the businesses of tomorrow. Make it efficient, yes — but more importantly, make it secure.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>devops</category>
      <category>softwaredevelopment</category>
      <category>devsecops</category>
    </item>
  </channel>
</rss>
