<?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"><channel><title><![CDATA[sechackfi]]></title><description><![CDATA[sechackfi]]></description><link>https://anirudhkaspsky.site</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 15:31:51 GMT</lastBuildDate><atom:link href="https://anirudhkaspsky.site/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Codex CLI - Your Little Coding Pet]]></title><description><![CDATA[While casually scrolling through X (formerly Twitter) last week, a tweet from Sam Altman caught my attention. He introduced Codex, a lightweight CLI agent recently launched by OpenAI, built on top of their o3 and o4-mini models. Naturally, I was curi...]]></description><link>https://anirudhkaspsky.site/codex-cli-your-little-coding-pet</link><guid isPermaLink="true">https://anirudhkaspsky.site/codex-cli-your-little-coding-pet</guid><category><![CDATA[Security]]></category><category><![CDATA[genai]]></category><dc:creator><![CDATA[Anirudh]]></dc:creator><pubDate>Mon, 28 Apr 2025 19:11:33 GMT</pubDate><content:encoded><![CDATA[<p>While casually scrolling through X (formerly Twitter) last week, a tweet from Sam Altman caught my attention. He introduced <strong>Codex</strong>, a lightweight CLI agent recently launched by OpenAI, built on top of their <strong>o3</strong> and <strong>o4-mini</strong> models. Naturally, I was curious.</p>
<p>During one of our weekly <strong>security meetup forums</strong>, I decided to give Codex a spin. (If you’re into tech and security, feel free to join us on our <a target="_blank" href="https://discord.gg/7ASB4rGRpK">Discord forum</a>.</p>
<h2 id="heading-getting-started-with-codex">Getting Started with Codex</h2>
<p>Setting up Codex is refreshingly straightforward. Here's how you can get started:</p>
<p>You need to install it via npm and export your OpenAI API key for use in the current session, or configure it in the shell configuration file, or the project environment file, depending on your use case.</p>
<p><code>npm install -g @openai/codex</code></p>
<p>To build from source, follow these steps:</p>
<ol>
<li><p>Clone the repository and navigate to the CLI package:</p>
<pre><code class="lang-plaintext"> git clone https://github.com/openai/codex.git
 cd codex/codex-cli
</code></pre>
</li>
<li><p>Enable corepack:</p>
<pre><code class="lang-plaintext"> corepack enable
</code></pre>
</li>
<li><p>Install dependencies and build:</p>
<pre><code class="lang-plaintext"> pnpm install
 pnpm build
</code></pre>
</li>
<li><p>Get usage and options:</p>
<pre><code class="lang-plaintext"> node ./dist/cli.js --help
</code></pre>
</li>
<li><p>Run the locally built CLI directly:</p>
<pre><code class="lang-plaintext"> node ./dist/cli.js
</code></pre>
</li>
<li><p>Or link the command globally for convenience:</p>
<pre><code class="lang-plaintext"> pnpm link
</code></pre>
</li>
</ol>
<p>You can generate the API key by visiting OpenAI’s platform settings page.</p>
<p><strong>Disclaimer:</strong> Payments are required as it uses credits to hit OpenAI’s API endpoints and resources to interact with the models.</p>
<h2 id="heading-first-experiments-with-codex">First Experiments with Codex</h2>
<p>Once everything was ready, we started experimenting. One of our first prompts was:</p>
<blockquote>
<p><em>codex "Write a Python script to serialize and deserialize objects in Python."</em></p>
</blockquote>
<p>You can also specify which model Codex should use for generating or reviewing code, giving you the flexibility based on your needs.</p>
<pre><code class="lang-plaintext">codex -m o3 "&lt;prompt&gt;"
</code></pre>
<p>To spice things up from a security engineer’s perspective, we decided to test Codex in a real-world scenario:</p>
<ul>
<li><p>Cloned the <strong>WebGoat</strong> repository, a well-known, deliberately insecure application used for learning web app sec and code reviews.</p>
</li>
<li><p>Then, asked Codex to perform a security code review on the repo.</p>
</li>
<li><p>To our surprise, Codex:</p>
<ul>
<li><p>Prepared a security report.</p>
</li>
<li><p>Identified the application as intentionally vulnerable.</p>
</li>
<li><p>Listed vulnerabilities along with recommendations for remediation.</p>
</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1745867865836/51b9a0bf-1989-4ed8-b062-4cd77c5d5d24.png" alt class="image--center mx-auto" /></p>
<p>We further expanded its use case to identify security misconfigurations in a pod.yaml file, perform taint analysis, prepare a SARIF report, and conduct SCA analysis within a venv.</p>
<p>With local git repositories, you can ask codex to write code, explain code, perform linting, generate test cases, examine the codebase to raise PRs, and conduct code reviews. It can also be used in a headless mode in your pipelines, like this:</p>
<pre><code class="lang-yaml"><span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Update</span> <span class="hljs-string">readme.md</span> <span class="hljs-string">in</span> <span class="hljs-string">codex</span>
  <span class="hljs-attr">run:</span> <span class="hljs-string">|
    npm install -g @openai/codex
    export OPENAI_API_KEY="${{ secrets.OPENAI_KEY }}"
    codex -a auto-edit --quiet "update readme.md"</span>
</code></pre>
<p>As models become more fine-tuned and their capabilities expand, I can see it becoming a valuable tool for developers and security engineers alike, helping them to write, test, and review code faster and smarter.</p>
<p>Could Codex eventually become a viable <strong>alternative to traditional SAST tools</strong>?<br />Maybe. It’s early days, but the potential is there. Let’s wait and watch. 😉</p>
<p>References:</p>
<p><a target="_blank" href="https://github.com/openai/codex">Codex CLI</a></p>
]]></content:encoded></item></channel></rss>