<?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: Justyn Temme</title>
    <description>The latest articles on DEV Community by Justyn Temme (@justyntemme).</description>
    <link>https://dev.to/justyntemme</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%2F53280%2F93df30be-0d4b-45fa-82a4-cea661c930ab.jpg</url>
      <title>DEV Community: Justyn Temme</title>
      <link>https://dev.to/justyntemme</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/justyntemme"/>
    <language>en</language>
    <item>
      <title>Fenix: A new mobile browser from Mozilla</title>
      <dc:creator>Justyn Temme</dc:creator>
      <pubDate>Wed, 08 Aug 2018 14:14:03 +0000</pubDate>
      <link>https://dev.to/justyntemme/fenix-a-new-mobile-browser-from-mozilla-3dcf</link>
      <guid>https://dev.to/justyntemme/fenix-a-new-mobile-browser-from-mozilla-3dcf</guid>
      <description>&lt;h2&gt;
  
  
  About the Project
&lt;/h2&gt;

&lt;p&gt;Mozilla recently created a Github repository for a brand new mobile web browser named Fenix. Not much is known about this project. There has been no official statement from Mozilla at this time. A source close to the projects expects a usable project to land somewhere in 2019. With the current rate of code pumping out of the project I would expect that if not earlier. Sebastian Kaspari seems to be the lead developer with most of the commit history.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical Details
&lt;/h3&gt;

&lt;h3&gt;
  
  
  GeckoView
&lt;/h3&gt;

&lt;p&gt;Fenix opts to use Mozilla's own GeckoView, rather than the default android webview. Geckos wiki mentions it is not quite ready for production, which leads me to believe a lot of the work going into GeckoView is specifically for Fenix. You can try out GeckoView by following the steps &lt;a href="https://wiki.mozilla.org/Mobile/GeckoView#What_is_GeckoView" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Nightly track on its way
&lt;/h3&gt;

&lt;p&gt;Seven days ago, project lead Sebastian created an issue to set up a testing track on google play. This will allow developers and early adopters to get the first look at Fenix, and how it stacks up to other modern browsers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Build File
&lt;/h3&gt;

&lt;p&gt;The project recently added a Dockerfile that builds all releases of the APK. The Docker project uses the same build chain, which makes it very simple for devs to help contribute to the project. All you need is docker and the other build dependencies are handled within the Dockerfile. This is a great Docker use case that more projects should be taking advantage of&lt;/p&gt;

&lt;h3&gt;
  
  
  Mozilla Public License V2
&lt;/h3&gt;

&lt;p&gt;The project currently is Licensed as open source, under the Mozilla Public License Version 2&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;All of my test builds would not install on both physical Android devices, as well as device emulators. If you are able to get a build working on a certain version of android please email me at &lt;a href="mailto:justyn@nextwavesolutions.io"&gt;justyn@nextwavesolutions.io&lt;/a&gt; so that I can share images with how the current state of the browser looks. Until then I will be awaiting the testing branch to be deployed on the Play Store.&lt;/p&gt;

&lt;h3&gt;
  
  
  No IOS
&lt;/h3&gt;

&lt;p&gt;It's interesting to notice that there is only an Android version of this browser. That is not to say development won't happen for IOS devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contributing
&lt;/h3&gt;

&lt;p&gt;Recently Ryan Sipes asked for clarification on build instructions to help contribute to the project. If you take a look at issue #55, you will see Sebastian recommend contributing to Mozilla mobiles android-components library. That is where a lot of the tools being used by Fenix are hosted. The third comment on issue #55 is a post written by myself detailing how to use Docker to build the apk's. Here you will find instructions on how to build and retrieve the proper APK.&lt;/p&gt;

&lt;p&gt;Read More ... &lt;a href="http://nextwavesolutions.io/post/fenix/" rel="noopener noreferrer"&gt;http://nextwavesolutions.io/post/fenix/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>java</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to DOS Yourself With Argon2</title>
      <dc:creator>Justyn Temme</dc:creator>
      <pubDate>Thu, 12 Apr 2018 19:28:43 +0000</pubDate>
      <link>https://dev.to/justyntemme/how-to-dos-yourself-with-argon2-20a4</link>
      <guid>https://dev.to/justyntemme/how-to-dos-yourself-with-argon2-20a4</guid>
      <description>&lt;p&gt;Recently while penetration testing a clients server I found a DOS attack via a simple post request. On a page which took text input, as well as a hashing method, and returned the hash string, I was able to DOS the entire server. &lt;/p&gt;

&lt;h2&gt;
  
  
  Starve the CPU
&lt;/h2&gt;

&lt;p&gt;The exploit was a simple bash script that made a POST request with the text as &lt;code&gt;testing&lt;/code&gt; and the hash function, &lt;code&gt;Argon2&lt;/code&gt;. Now one interesting thing to note is exactly how much CPU usage each hash function takes. Many would consider this all the more reason to use Argon2 over a weak hashing function like MD5, I would agree. The issue is not within Argon2. It is a much superior hashing function. However, when a small 1 core 512mb digital ocean droplet is told to hash strings thousands of times, one after the other, the CPU usage quickly goes from idle to 100%. This caused the entire server to stop responding until we stopped the script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;p&gt;Just how can we stop attacks like this from occurring? Well as with all security, it must be thought of during the design of the software. The entire system must be taken into account as a single functioning body with many parts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Efficiency O(o)
&lt;/h3&gt;

&lt;p&gt;When engineering any piece of software, from API to full-scale application, one must think of efficiency of the entire system. Does the size of the request, match the amount of processing it would take? Many would consider this to be O(o), or &lt;code&gt;amount of time grows linearly with the size of the input&lt;/code&gt;. You can find the explanation referenced and more information on Big O notation explained very methodically &lt;a href="http://www.itprotoday.com/software-development/defeating-denial-service-cpu-starvation-attacks" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rate Limiting
&lt;/h3&gt;

&lt;p&gt;If the goal of efficiency simply can not be met due to requirements of the software, one can look to limit the rate at which requests can be made, otherwise known as rate limiting. By stopping an attacker from leveraging an inefficient request, you can allow the server enough time to complete the function and return for the next, rather than dying a slow death.&lt;/p&gt;

&lt;h4&gt;
  
  
  Rate Limiting an API in Go
&lt;/h4&gt;

&lt;p&gt;It's well documented Go is my favorite programming language. Once again I get to explain how simple it is to create secure effective apps using the tooling built into the language. As expected with most things, goes implementation of rate limiting is basic enough to be used by any junior developer, and scales with tools and would make any senior developer ecstatic. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;import "time"&lt;/code&gt;&lt;br&gt;
We will start by importing the time package. This will allow us to dictate the frequency we allow requests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;

&lt;span class="n"&gt;burstLimit&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;

&lt;span class="n"&gt;tick&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewTicker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;tick&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we are defining the options for our limiter, as well as implementing a burst limit to allow for fast response calls, and still limit the amount in a given time frame. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;throttle := make(chan time.time, burstLimit)&lt;/code&gt; This will create a channel that another function can peek into and see the time or burstLimit. This will allow us to use go routines to manage requests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;tick&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;throttle&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;

      &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;// does not exit after tick.Stop()&lt;/span&gt;

&lt;span class="p"&gt;}()&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the goRoutine that will tick the timer forward, and at every tick, check if the requests are greater than the burstLimit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;throttle&lt;/span&gt;  &lt;span class="c"&gt;// rate limit our Service.Method RPCs&lt;/span&gt;

  &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Service.Method"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is our final piece of code. This will look through the requests and check tick the counter within the channel the goRoutine uses. If tick.Stop is not called then the service request will carry on as normal. To see the full source code, as well as see more advanced rate limiting implementations visit the &lt;a href="https://github.com/golang/go/wiki/RateLimiting" rel="noopener noreferrer"&gt;Golang Wiki&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can read more of my work &lt;a href="https://nextwavesolutions.io" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hacking</category>
      <category>security</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
