<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>docker &amp;mdash; Swagg::Blogg</title>
    <link>https://blog.swagg.net/tag:docker</link>
    <description>or: How I Learned to Stop Worrying and Love the WWW&lt;br&gt;&lt;a href=&#34;https://www.swagg.net&#34;&gt;Home&lt;/a&gt;&amp;nbsp;&lt;a href=&#34;https://blog.swagg.net/feed/&#34;&gt;RSS&lt;/a&gt;</description>
    <pubDate>Fri, 01 May 2026 04:54:28 +0000</pubDate>
    <image>
      <url>https://i.snap.as/gopN8vBC.png</url>
      <title>docker &amp;mdash; Swagg::Blogg</title>
      <link>https://blog.swagg.net/tag:docker</link>
    </image>
    <item>
      <title>Updates: Mandatory Fun</title>
      <link>https://blog.swagg.net/updates-mandatory-fun?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[So I mentioned in my previous post that, with the powers granted to me by Mojolicious, I have migrated from the venerable Apache server with all my server-side fancy stuff being CGI to Docker containers. Awesome! This morning my buddy n4vn33t shared with me an interesting blog post; I&#39;ll let the post speak for itself but my takeaway was essentially, sure that upstream Docker image I&#39;m using ought to be patched and ready to rock but... What if it&#39;s not? It would help to add RUN apt-get -y upgrade to my Dockerfile to make sure I&#39;ve got the latest and greatest stuff. And so I did. And then I ran my container locally to give it a quick test and now my remaining CGI scripts are returning 404s. If I run the app locally with morbo www-swagg.pl it &#34;just works&#34; so I must&#39;ve borked my Docker container!&#xA;&#xA;To troubleshoot, I comment out the apt-get -y upgrade stuff and rebuild. That should yield the same result as prior to the change right? Well, no it didn&#39;t. At this point I&#39;m lost so I begin removing all traces of previous images, re-pulling and re-building things. Still got 404s for my beloved guestbook which I think goes without saying, is completely unacceptable! Then I thought about this line in my Dockerfile:&#xA;&#xA;RUN cpanm RJBS/Getopt-Long-Descriptive-0.105.tar.gz&#xA;&#xA;Why run that instead of cpanm Getopt::Long::Descriptive? You see, this module isn&#39;t one that I&#39;m using in my scripts but rather it&#39;s a dependency; a module I&#39;m using is using this module. One day (prior to this) my Docker container refused to build and I narrowed the problem down to v0.106 of Getopt::Long::Descriptive building and, as it&#39;s not a module I&#39;m much concerned with (I just need it so the module I do need will build) I enter the command as you see above to force installation of the prior version that I know will build just fine. So I start by checking out the changelogs for my modules that I&#39;m using in my scripts. Thankfully it didn&#39;t take me long to see this in the changelog for Mojolicious (first module I checked 🙃):&#xA;&#xA;  9.11  2021-03-20&#xA;  - This release contains fixes for security issues, everybody should upgrade!&#xA;  - Disabled format detection by default to fix vulnerabilities in many Mojolicious applications. That means some of&#xA;  your routes that previously matched &#34;/foo&#34; and &#34;/foo.json&#34;, will only match &#34;/foo&#34; after upgrading. From now on you&#xA;  will have to explicitly declare the formats your routes are allowed to handle.&#xA;  # /foo&#xA;  # /foo.html&#xA;  # /foo.json&#xA;  $r-  get(&#39;/foo&#39;)-  to(&#39;bar\#yada&#39;);&#xA;  becomes&#xA;  $r-  get(&#39;/foo&#39; =  [format =  [&#39;html&#39;, &#39;json&#39;]])-  to(&#39;bar\#yada&#39;, format =  undef);&#xA;  And if you are certain that your application is not vulnerable, you also have the option to re-enable format&#xA;  detection for a route and all its nested routes. Due to the high risk of vulnerabilities, this feature is going to&#xA;  be removed again in a future release however.&#xA;  my $active = $r-  any([format =  1]);&#xA;  $active-  get(&#39;/foo&#39;)-  to(&#39;Test\#first&#39;);&#xA;  $active-  put(&#39;/bar&#39;)-  to(&#39;Test\#second&#39;);&#xA;  ...&#xA;&#xA;Ahh that&#39;s right... I&#39;m doing this:&#xA;&#xA;plugin &#39;Config&#39;;&#xA;&#xA;CGI scripts&#xA;plugin CGI =  [&#39;/cgi-bin/guest&#39;  =  &#39;./cgi-bin/guestmm.cgi&#39;];&#xA;plugin CGI =  [&#39;/cgi-bin/whoami&#39; =  &#39;./cgi-bin/whoami.cgi&#39;  ];&#xA;&#xA;The .cgi file extension wasn&#39;t technically necessary but I want that to still work because:&#xA;&#xA;I already have hyperlinks all over the place that use the extension&#xA;It&#39;s a CGI script and I want it to &#34;look&#34; like that... Petty I know&#xA;&#xA;So here&#39;s my v9.11+ compliant way of using the extension:&#xA;&#xA;plugin CGI =  [&#39;/cgi-bin/guest.cgi&#39;  =  &#39;./cgi-bin/guestmm.cgi&#39;];&#xA;plugin CGI =  [&#39;/cgi-bin/whoami.cgi&#39; =  &#39;./cgi-bin/whoami.cgi&#39;  ];&#xA;&#xA;Excellent, we&#39;re back in business! Fighting issues like this can sometimes feel like a &#34;waste&#34; of an afternoon because at the end of the day... My site hasn&#39;t really changed. I gained no new fun buttons or GIFs but I can sleep easy tonight knowing that my site is just a bit more &#34;hardened&#34; against script kiddies who never cease to make our lives just a little bit more complicated. Let&#39;s that tag this puppy, push it to my cloud provider and call it a day:&#xA;&#xA;After we&#39;ve run: docker build -t www-swagg .&#xA;docker tag www-swagg gcr.io/www-swagg/www-swagg&#xA;docker push gcr.io/www-swagg/www-swagg&#xA;Bunch of output follows...&#xA;&#xA;And now we&#39;re safe. Until tomorrow when the next round of vulnerabilities gets discovered anyways 🤦‍♂️&#xA;&#xA;Until next time bug,&#xA;&#xA;Dan B&#xA;&#xA;docker&#xA;perl&#xA;mojolicious&#xA;&#xA;Homepage&#xD;&#xA;Code&#xD;&#xA;Mail&#xD;&#xA;Social&#xD;&#xA;Chat&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>So I mentioned in my previous post that, with the powers granted to me by <a href="https://mojolicious.org/">Mojolicious</a>, I have migrated from the venerable Apache server with all my server-side fancy stuff being CGI to Docker containers. Awesome! This morning my buddy <a href="https://n4vn33t.com/">n4vn33t</a> shared with me an interesting <a href="https://pythonspeed.com/articles/security-updates-in-docker/">blog post</a>; I&#39;ll let the post speak for itself but my takeaway was essentially, sure that upstream <a href="https://hub.docker.com/layers/perl/library/perl/5.32/images/sha256-8a14ecfa8344ede0abdb48a0c7089a21d0725b5001a1df1f25dbd05adebe76cd?context=explore">Docker image</a> I&#39;m using ought to be patched and ready to rock but... What if it&#39;s not? It would help to add <code>RUN apt-get -y upgrade</code> to my <code>Dockerfile</code> to make sure I&#39;ve got the latest and greatest stuff. And so I did. And then I ran my container locally to give it a quick test and now my remaining CGI scripts are returning 404s. If I run the app locally with <code>morbo www-swagg.pl</code> it “just works” so I must&#39;ve borked my Docker container!</p>

<p>To troubleshoot, I comment out the <code>apt-get -y upgrade</code> stuff and rebuild. That should yield the same result as prior to the change right? Well, no it didn&#39;t. At this point I&#39;m lost so I begin removing all traces of previous images, re-pulling and re-building things. Still got 404s for my beloved <a href="https://www.swagg.net/cgi-bin/guest.cgi">guestbook</a> which I think goes without saying, is completely unacceptable! Then I thought about this line in my <code>Dockerfile</code>:</p>

<pre><code>RUN cpanm RJBS/Getopt-Long-Descriptive-0.105.tar.gz
</code></pre>

<p>Why run that instead of <code>cpanm Getopt::Long::Descriptive</code>? You see, this module isn&#39;t one that I&#39;m using in <em>my</em> scripts but rather it&#39;s a <em>dependency</em>; a <a href="https://metacpan.org/pod/WebService::Mattermost">module I&#39;m using</a> is using <a href="https://metacpan.org/pod/Getopt::Long::Descriptive">this module</a>. One day (prior to this) my Docker container refused to build and I narrowed the problem down to v0.106 of Getopt::Long::Descriptive building and, as it&#39;s not a module I&#39;m much concerned with (I just need it so the module I <em>do</em> need will build) I enter the command as you see above to force installation of the prior version that I know will build just fine. So I start by checking out the changelogs for my modules that I&#39;m using in my scripts. Thankfully it didn&#39;t take me long to see this in the <a href="https://metacpan.org/changes/distribution/Mojolicious">changelog for Mojolicious</a> (first module I checked 🙃):</p>

<blockquote><p>9.11  2021-03-20
 – This release contains fixes for security issues, everybody should upgrade!
 – Disabled format detection by default to fix vulnerabilities in many Mojolicious applications. That means some of
   your routes that previously matched “/foo” and “/foo.json”, will only match “/foo” after upgrading. From now on you
   will have to explicitly declare the formats your routes are allowed to handle.
     # /foo
     # /foo.html
     # /foo.json
     $r-&gt;get(&#39;/foo&#39;)–&gt;to(&#39;bar#yada&#39;);
   becomes
     $r-&gt;get(&#39;/foo&#39; =&gt; [format =&gt; [&#39;html&#39;, &#39;json&#39;]])–&gt;to(&#39;bar#yada&#39;, format =&gt; undef);
   And if you are certain that your application is not vulnerable, you also have the option to re-enable format
   detection for a route and all its nested routes. Due to the high risk of vulnerabilities, this feature is going to
   be removed again in a future release however.
     my $active = $r-&gt;any([format =&gt; 1]);
     $active-&gt;get(&#39;/foo&#39;)–&gt;to(&#39;Test#first&#39;);
     $active-&gt;put(&#39;/bar&#39;)–&gt;to(&#39;Test#second&#39;);
...</p></blockquote>

<p>Ahh that&#39;s right... I&#39;m doing this:</p>

<pre><code>plugin &#39;Config&#39;;

# CGI scripts
plugin CGI =&gt; [&#39;/cgi-bin/guest&#39;  =&gt; &#39;./cgi-bin/guest_mm.cgi&#39;];
plugin CGI =&gt; [&#39;/cgi-bin/whoami&#39; =&gt; &#39;./cgi-bin/whoami.cgi&#39;  ];
</code></pre>

<p>The <code>.cgi</code> file extension wasn&#39;t technically necessary but I want that to still work because:</p>
<ol><li>I already have hyperlinks all over the place that use the extension</li>
<li>It&#39;s a CGI script and I want it to “look” like that... Petty I know</li></ol>

<p>So here&#39;s my v9.11+ compliant way of using the extension:</p>

<pre><code>plugin CGI =&gt; [&#39;/cgi-bin/guest.cgi&#39;  =&gt; &#39;./cgi-bin/guest_mm.cgi&#39;];
plugin CGI =&gt; [&#39;/cgi-bin/whoami.cgi&#39; =&gt; &#39;./cgi-bin/whoami.cgi&#39;  ];
</code></pre>

<p>Excellent, we&#39;re back in business! Fighting issues like this can sometimes feel like a “waste” of an afternoon because at the end of the day... My site hasn&#39;t really changed. I gained no new fun buttons or GIFs but I can sleep easy tonight knowing that my site is just a bit more “hardened” against script kiddies who never cease to make our lives just a little bit more complicated. Let&#39;s that tag this puppy, push it to my cloud provider and call it a day:</p>

<pre><code># After we&#39;ve run: docker build -t www-swagg .
docker tag www-swagg gcr.io/www-swagg/www-swagg
docker push gcr.io/www-swagg/www-swagg
# Bunch of output follows...
</code></pre>

<p>And now we&#39;re safe. Until tomorrow when the next round of vulnerabilities gets discovered anyways 🤦‍♂️</p>

<p>Until next <del>time</del> bug,</p>

<p>Dan B</p>

<p><a href="https://blog.swagg.net/tag:docker" class="hashtag"><span>#</span><span class="p-category">docker</span></a>
<a href="https://blog.swagg.net/tag:perl" class="hashtag"><span>#</span><span class="p-category">perl</span></a>
<a href="https://blog.swagg.net/tag:mojolicious" class="hashtag"><span>#</span><span class="p-category">mojolicious</span></a></p>
<ul><li><a href="https://www.swagg.net">Homepage</a></li>
<li><a href="https://codeberg.org/swaggboi">Code</a></li>
<li><a href="mailto:swaggboi@slackware.uk">Mail</a></li>
<li><a href="https://eattherich.club/@swaggboi">Social</a></li>
<li><a href="https://discord.gg/6MXVZKU">Chat</a></li></ul>
]]></content:encoded>
      <guid>https://blog.swagg.net/updates-mandatory-fun</guid>
      <pubDate>Wed, 24 Mar 2021 18:52:47 +0000</pubDate>
    </item>
  </channel>
</rss>