<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shashaank Srivastava on Medium]]></title>
        <description><![CDATA[Stories by Shashaank Srivastava on Medium]]></description>
        <link>https://medium.com/@shashaank.srivastava04?source=rss-0a3cbf682ab7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BORULDvIqw_bimAD</url>
            <title>Stories by Shashaank Srivastava on Medium</title>
            <link>https://medium.com/@shashaank.srivastava04?source=rss-0a3cbf682ab7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 14:45:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shashaank.srivastava04/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Building a Secure Code Executor: A Sandbox-First Architecture]]></title>
            <link>https://medium.com/@shashaank.srivastava04/building-a-secure-code-executor-a-sandbox-first-architecture-7b0ecd66f14b?source=rss-0a3cbf682ab7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b0ecd66f14b</guid>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Shashaank Srivastava]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 19:38:16 GMT</pubDate>
            <atom:updated>2026-02-10T19:38:16.814Z</atom:updated>
            <content:encoded><![CDATA[<p>Running user-submitted code is one of those problems that looks easy… until it breaks your server.</p><p>What starts as <em>“just run this code”</em> quickly turns into questions about isolation, resource abuse, filesystem safety, and denial-of-service attacks. This article walks through a <strong>sandbox-first design</strong> for a code execution engine, using diagrams to explain how each layer protects the system.</p><p>🔗 <strong>Repository:</strong> <a href="https://github.com/ShashaankS/code-executor">https://github.com/ShashaankS/code-executor</a></p><h3>Why Code Execution Is Dangerous by Default</h3><p>When you accept arbitrary code from users, you’re effectively running <strong>untrusted programs</strong> on your infrastructure.</p><p>Without sandboxing, user code can:</p><ul><li>Consume 100% CPU</li><li>Allocate unbounded memory</li><li>Read server files</li><li>Spawn infinite processes</li><li>Crash or hang the host</li></ul><p>So the real challenge isn’t <em>execution</em> — it’s <strong>containment</strong>.</p><h3>High-Level System Overview</h3><p>Let’s start with the big picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DVhYEouLrdNn1-V-vfBkJg.png" /></figure><p><strong>Key idea:</strong><br> User code never touches the host system directly. Everything flows through a sandbox boundary.</p><h3>Execution Pipeline</h3><p>This repository follows a clean, extensible execution pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQGxA9vfv---eTCZ92vRVQ.png" /></figure><p>Each step is intentionally separated, making it easy to harden security <strong>without rewriting the core logic</strong>.</p><h3>What “Sandboxing” Actually Means</h3><p>Sandboxing is not a single feature — it’s a <strong>stack of constraints</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UWVH4XsE_E3jho5X58ZAkw.png" /><figcaption>Sandbox Responsibility Layers</figcaption></figure><p>Each layer reduces the blast radius if something goes wrong.</p><h3>Process Isolation</h3><p>Every execution runs in its <strong>own process</strong>.</p><p>Host OS<br> ├── Executor Process<br> │ ├── User Program #1<br> │ ├── User Program #2<br> │ └── User Program #3</p><p>Benefits:</p><ul><li>No shared memory</li><li>One crash ≠ system crash</li><li>Clean teardown after execution</li></ul><h3>Resource Limiting (CPU &amp; Memory)</h3><p>Untrusted code must never run forever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCWh756iEURm14f3U9iMSw.png" /></figure><p>This prevents:</p><ul><li>Infinite loops</li><li>Fork bombs</li><li>Memory exhaustion attacks</li></ul><h3>Filesystem Sandboxing</h3><p>User code should not see your server’s filesystem.</p><p>Sandbox FS<br> ├── /app<br> │ └── main.py<br> ├── /tmp<br> └── (no access outside)</p><p>Typical rules:</p><ul><li>Read-only system files</li><li>Temporary working directory</li><li>No access to /etc, /home, or secrets</li></ul><h3>Container-Based Sandboxing (A option)</h3><p>The architecture of this repo makes Docker-based isolation a natural next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sg_hLNUs2SeXAgQD3JYlZA.png" /></figure><p>Each execution can:</p><ul><li>Use a language-specific image</li><li>Run with capped resources</li><li>Be destroyed after completion</li></ul><p>This is how <strong>online judges and coding platforms</strong> operate at scale.</p><h3>Why Sandboxing Comes Before Language Support</h3><p>Many execution engines focus on adding more languages first.</p><p>That’s backwards.</p><p>❌ 10 languages + no sandbox = insecure<br>✅ 1 language + strong sandbox = production-ready</p><h3>Real-World Use Cases</h3><p>With proper sandboxing, this system can power:</p><ul><li>Online coding playgrounds</li><li>EdTech platforms</li><li>Competitive programming judges</li><li>AI-based code evaluators</li><li>Interview assessment tools</li></ul><p>All of them rely on <strong>safe execution at scale</strong>.</p><h3>Final Thoughts</h3><p>Executing code is easy.<br>Executing it <strong>safely</strong> is a systems engineering problem.</p><p>This repository lays down a sandbox-first foundation for building secure, scalable code execution platforms — the kind used in real-world production systems.</p><p>If you’re interested in backend security, infrastructure design, or developer platforms, this project is a strong and practical starting point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b0ecd66f14b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>