<?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: Andreas Tiefenthaler</title>
    <description>The latest articles on DEV Community by Andreas Tiefenthaler (@pxlpnk).</description>
    <link>https://dev.to/pxlpnk</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%2F71898%2F9083dc35-26d8-4114-b965-8cd206163c12.jpg</url>
      <title>DEV Community: Andreas Tiefenthaler</title>
      <link>https://dev.to/pxlpnk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pxlpnk"/>
    <language>en</language>
    <item>
      <title>Awesome Ruby Security Resources</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Mon, 05 Nov 2018 22:09:38 +0000</pubDate>
      <link>https://dev.to/pxlpnk/awesome-ruby-security-resources-2nma</link>
      <guid>https://dev.to/pxlpnk/awesome-ruby-security-resources-2nma</guid>
      <description>&lt;p&gt;A New, Curated List of Ruby-related Security Resources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/pxlpnk/awesome-ruby-security" rel="noopener noreferrer"&gt;https://github.com/pxlpnk/awesome-ruby-security&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I just started out collecting them in one place, so it is far from complete or perfect. Everyone is invited to help out and submit more useful links so we all can build secure apps.&lt;/p&gt;

&lt;p&gt;Also, make sure to check out the node.js list we have been working already: &lt;a href="https://github.com/lirantal/awesome-nodejs-security" rel="noopener noreferrer"&gt;https://github.com/lirantal/awesome-nodejs-security&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>security</category>
      <category>devhelp</category>
    </item>
    <item>
      <title>dev.to Show us your octocat alter ego</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Thu, 18 Oct 2018 07:25:13 +0000</pubDate>
      <link>https://dev.to/pxlpnk/devto-show-of-your-octocat-alter-ego-1hna</link>
      <guid>https://dev.to/pxlpnk/devto-show-of-your-octocat-alter-ego-1hna</guid>
      <description>&lt;p&gt;GitHub released an &lt;a href="https://myoctocat.com/" rel="noopener noreferrer"&gt;octocat builder&lt;/a&gt;. I was waiting for this for many years and I am super excited. &lt;/p&gt;

&lt;p&gt;I am curious how dev.to would look like if we all where octocats.&lt;/p&gt;

&lt;p&gt;This is me as an octocat&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FG3PbcZL2%2Foctocat-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FG3PbcZL2%2Foctocat-2.png" title="pxlpnk cat" alt="pxlpnk cat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please post yours in the comments.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>What security updates should one follow?</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Tue, 16 Oct 2018 12:05:39 +0000</pubDate>
      <link>https://dev.to/pxlpnk/what-security-updates-should-one-follow-2d6j</link>
      <guid>https://dev.to/pxlpnk/what-security-updates-should-one-follow-2d6j</guid>
      <description>&lt;p&gt;I am trying to figure out what RSS feeds, mailing lists, twitter accounts, blogs, etc one should follow to get good updates on security issues and vulnerabilities.&lt;/p&gt;

&lt;p&gt;Any framework, language or platform is good.&lt;br&gt;
I am currently following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NodeJS Security: &lt;a href="https://groups.google.com/forum/#!forum/nodejs-sec"&gt;https://groups.google.com/forum/#!forum/nodejs-sec&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Wired security: &lt;a href="https://www.wired.com//category/security/"&gt;https://www.wired.com//category/security/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AWS security bulletins(quite a lot and noisy): &lt;a href="https://aws.amazon.com/security/security-bulletins/"&gt;https://aws.amazon.com/security/security-bulletins/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What are you following, and why?&lt;/p&gt;

&lt;p&gt;Maybe we can get a nice list going that helps a bigger audience. &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>security</category>
    </item>
    <item>
      <title>Securing your Ruby and Rails Codebase</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Mon, 24 Sep 2018 08:09:55 +0000</pubDate>
      <link>https://dev.to/pxlpnk/securing-your-ruby-and-rails-codebase-2cg3</link>
      <guid>https://dev.to/pxlpnk/securing-your-ruby-and-rails-codebase-2cg3</guid>
      <description>

&lt;p&gt;When writing software you want to avoid introducing functional bugs or security issues.&lt;/p&gt;

&lt;p&gt;For functional bugs, we usually write unit tests and try to cover edge cases. Integration tests then make sure that things work together.&lt;/p&gt;

&lt;p&gt;In this article, we will walk through how we can secure a Ruby, Rails, or Rack-based app.&lt;/p&gt;

&lt;p&gt;No matter if it is a new codebase, or we are adding it to a 10-year-old project, in the end we will have a decent level of security testing.&lt;/p&gt;

&lt;p&gt;For this article we will be using open-source software tools to secure our codebase. We will also consider some hosted and already configured alternatives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our toolbox&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;bundler-audit&lt;/li&gt;
&lt;li&gt;brakeman&lt;/li&gt;
&lt;li&gt;rubocop (has some security rules)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tools can be categorized into Static Application Security Testing (SAST) and Software Composition Analysis (SCA) tools.&lt;/p&gt;

&lt;p&gt;Static analysis scans your codebase and looks for certain kinds of patterns. It will not execute your code and cannot detect problems in generated code, or at runtime.&lt;/p&gt;

&lt;p&gt;The results will usually show the line of code the issue is detected. They will also alert you to the type of issue identified (with a severity), and sometimes an advisory on how to fix the problem.&lt;/p&gt;

&lt;p&gt;In contrast, software composition analysis will check the dependencies you are using for vulnerabilities.&lt;/p&gt;

&lt;p&gt;The report usually includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The package name of the affected dependency.&lt;/li&gt;
&lt;li&gt;Severity on how bad it is. This usually spans from &lt;code&gt;none&lt;/code&gt; to &lt;code&gt;critical&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The next safe version to upgrade to.&lt;/li&gt;
&lt;li&gt;Some more references that explain what the problem is and more details.&lt;/li&gt;
&lt;li&gt;In some cases an identifier that leads to a vulnerability database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run the security tools, you do not need a CI pipeline but it is generally recommended to have one in place.&lt;/p&gt;

&lt;p&gt;We will install the tools in a ruby/rails project. You will also learn how to enable the rake tasks and run them.&lt;/p&gt;

&lt;p&gt;All the tools also have normal executables and can be used one by one, or in a shell script.&lt;/p&gt;

&lt;h2&gt;Bundler Audit&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/rubysec/bundler-audit"&gt;Bundler Audit&lt;/a&gt; will detect vulnerable dependencies in your codebase&lt;/p&gt;

&lt;p&gt;First, add the bundler-audit gem to your Gemfile:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="s1"&gt;'bundler-audit'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and install your bundle.&lt;/p&gt;

&lt;p&gt;Now you can run a&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bundle audit check &lt;span class="nt"&gt;--update&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will update the local database first, and then check your project for vulnerable dependencies.&lt;/p&gt;

&lt;p&gt;Keep in mind that &lt;code&gt;bundle audit&lt;/code&gt; does not update the dependencies automatically. I recommend you to always update them before each run to ensure you get the best and most up-to-date results.&lt;/p&gt;

&lt;p&gt;To enable the rake tasks, add the following to your project Rakefile:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'bundler/audit/task'&lt;/span&gt;
&lt;span class="no"&gt;Bundler&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Audit&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;rake bundle:audit&lt;/code&gt; will now update the data and perform the checks.&lt;/p&gt;

&lt;p&gt;If you found any vulnerabilities at this point do not freak out. You can look into fixing them by updating the version to the next safe one.&lt;/p&gt;

&lt;p&gt;In case you can not update, you can use the &lt;code&gt;--ignore $vulnerability-id&lt;/code&gt; to suppress it for now.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bundle audit check &lt;span class="nt"&gt;--update&lt;/span&gt; &lt;span class="nt"&gt;--ignore&lt;/span&gt; OSVDB-108664
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The output looks something like this:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;bundle audit check &lt;span class="nt"&gt;--update&lt;/span&gt;

Updating ruby-advisory-db ...
From https://github.com/rubysec/ruby-advisory-db
 &lt;span class="k"&gt;*&lt;/span&gt; branch            master     -&amp;gt; FETCH_HEAD
Already up to date.
Updated ruby-advisory-db
ruby-advisory-db: 322 advisories
Name: omniauth-oauth2
Version: 1.0.2
Advisory: CVE-2012-6134
Criticality: High
URL: http://www.osvdb.org/show/osvdb/90264
Title: Ruby on Rails omniauth-oauth2 Gem CSRF vulnerability
Solution: upgrade to &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; 1.1.1

Name: rubyzip
Version: 1.2.1
Advisory: CVE-2018-1000544
Criticality: Unknown
URL: https://github.com/rubyzip/rubyzip/issues/369
Title: Directory Traversal &lt;span class="k"&gt;in &lt;/span&gt;rubyzip
Solution: upgrade to &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; 1.2.2

Vulnerabilities found!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;Brakeman&lt;/h2&gt;

&lt;p&gt;Next, we will add &lt;a href="https://github.com/presidentbeef/brakeman"&gt;Brakeman&lt;/a&gt; as our first static code analysis tool.&lt;br&gt;
Brakeman will look for known insecure patterns and configurations in your code base. It will also check if you are using a known vulnerable rails version.&lt;/p&gt;

&lt;p&gt;Brakeman works not only for Rails, but it also covers Sinatra and any kind of rack application.&lt;/p&gt;

&lt;p&gt;First, add the dependency to your Gemfile:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;gem brakeman
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and install it:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then you can run it for the first time in your rails root directory.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;brakeman
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will invoke Brakeman and output some lengthy report. Here is a gist with a sample report: &lt;a href="https://gist.github.com/pxlpnk/4a829b6101abe5fc0102d358d8dd028d"&gt;https://gist.github.com/pxlpnk/4a829b6101abe5fc0102d358d8dd028d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If your app is safe and you get no findings run it, first of all good job!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But then you want to see how it looks like, so you can try it with &lt;a href="https://github.com/OWASP/railsgoat"&gt;OWASP/RailsGoat&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you run Brakeman for the first time on any older Rails application you might get a lot of findings.&lt;/p&gt;

&lt;p&gt;To make things easier, you want to start with more severe issues and work down to the less critical ones.&lt;/p&gt;

&lt;p&gt;To do so, use &lt;code&gt;brakeman -w3&lt;/code&gt; and it will show only high, &lt;code&gt;-w2&lt;/code&gt; will show high and medium, &lt;code&gt;-w1&lt;/code&gt; will show all other findings.&lt;/p&gt;

&lt;p&gt;Approaching it level-by-level usually works the best and is the most efficient.&lt;/p&gt;

&lt;p&gt;If you plan to use rake, you can install the RakeTask very easily.&lt;/p&gt;

&lt;p&gt;Running a&lt;/p&gt;

&lt;p&gt;&lt;code&gt;brakeman --rake&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;will create a task file in &lt;code&gt;lib/tasks/brakeman.rake&lt;/code&gt; which can be run with:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;rake brakeman:run
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To customize it and use more advanced options see the documentation &lt;a href="https://brakemanscanner.org/docs/brakeman_as_a_library/"&gt;brakeman as a library/&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;RuboCop&lt;/h2&gt;

&lt;p&gt;While &lt;a href="https://github.com/rubocop-hq/rubocop"&gt;rubocop&lt;/a&gt; is known as a linter and formatter, it comes with some security rules and can be extended with some community extensions.&lt;/p&gt;

&lt;p&gt;Let us get started with installing RuboCop first. Add the following to your Gemfile:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'rubocop'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;require: &lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then run our old friend&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Once this has finished, you can execute the &lt;code&gt;rubocop&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;If you have not used rubocop before you might see a lot of output and warnings printed out in your terminal.&lt;/p&gt;

&lt;p&gt;For this post, we are not so much interested in the linting and formatting rules. Instead we make sure we only run the security relevant rules.&lt;/p&gt;

&lt;p&gt;We will be using the following &lt;code&gt;.rubocop.yml&lt;/code&gt; configuration to start out.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;AllCops&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;DisabledByDefault&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;

&lt;span class="s"&gt;Security/Eval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Security/JSONLoad&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Security/MarshalLoad&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Security/Open&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Security/YAMLLoad&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Bundler/InsecureProtocolSource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;Rails/OutputSafety&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We are disabling all the style and linting rules, and enabling only security-relevant ones. This is only done for simplicity in this blog post.&lt;/p&gt;

&lt;p&gt;Running the &lt;code&gt;rubocop&lt;/code&gt; command now should be way less noisy.&lt;/p&gt;

&lt;p&gt;This is how it looks like on the RailsGoat repository:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nv"&gt;$ &lt;/span&gt;bundlex &lt;span class="nb"&gt;exec &lt;/span&gt;rubocop
Inspecting 121 files
............C....................
Offenses:

app/controllers/password_resets_controller.rb:6:20: C: Security/MarshalLoad: Avoid using Marshal.load.
    user &lt;span class="o"&gt;=&lt;/span&gt; Marshal.load&lt;span class="o"&gt;(&lt;/span&gt;Base64.decode64&lt;span class="o"&gt;(&lt;/span&gt;params[:user]&lt;span class="o"&gt;))&lt;/span&gt; unless params[:user].nil?
                   ^^^^

121 files inspected, 1 offense detected
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Not too impressive yet, but we are getting some relevant security info already.&lt;/p&gt;

&lt;p&gt;Now we will add some more security rules.&lt;/p&gt;

&lt;p&gt;Add the following to your Gemfile: &lt;code&gt;gem 'rubocop-gitlab-security'&lt;/code&gt; and run &lt;code&gt;bundle install again&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now add the following to the configuration file &lt;code&gt;rubycop.yml&lt;/code&gt;:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;GitlabSecurity/DeepMunge&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;GitlabSecurity/JsonSerialization&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;GitlabSecurity/RedirectToParamsUpdate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;GitlabSecurity/SendFileParams&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;GitlabSecurity/SqlInjection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;GitlabSecurity/SystemCommandInjection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Those curated rules by the &lt;a href="https://gitlab.com/gitlab-org/rubocop-gitlab-security"&gt;GitLab team&lt;/a&gt; add tremendous value to our security setup.&lt;/p&gt;

&lt;p&gt;Now we need to require the new modules when running RuboCop:&lt;/p&gt;

&lt;p&gt;Either by running:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt; bundle &lt;span class="nb"&gt;exec &lt;/span&gt;rubocop &lt;span class="nt"&gt;--require&lt;/span&gt; rubocop-gitlab-security
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;or add this to the &lt;code&gt;rubocop.yml&lt;/code&gt;:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;require&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rubocop-gitlab-security&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We can now find more security problems in the RailsGoat repository. Here is a gist with a sample report:&lt;a href="https://gist.github.com/pxlpnk/958c500aab22f90b54918d6d9573251d"&gt;https://gist.github.com/pxlpnk/958c500aab22f90b54918d6d9573251d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To configure the RakeTasks add:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubocop/rake_task'&lt;/span&gt;
&lt;span class="no"&gt;RuboCop&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;RakeTask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requires&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s1"&gt;'rubocop-gitlab-security'&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;to your RakeFile and run it: &lt;code&gt;rake rubocop&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;Fixing Findings&lt;/h2&gt;

&lt;p&gt;To not drown in findings I recommend you configure and enable one scanner at a time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with high severity findings and filter out the rest.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some of the results will be false positives or are no danger at all for various reasons. They can usually be ignored and added to a list to not be noisy.&lt;/p&gt;

&lt;p&gt;Once you have fixed or muted the findings and it behaves as you would like, move on to the next one.&lt;/p&gt;

&lt;p&gt;When you have reached the point that you feel happy and comfortable with your setup, enable these tools to fail your CI builds and run them on every code change you commit.&lt;/p&gt;

&lt;p&gt;Now you will always know when something is not up to your security standards.&lt;/p&gt;

&lt;h2&gt;Hosted Services and Other Alternatives&lt;/h2&gt;

&lt;p&gt;In addition to the open source tools that are available, there are also a set of commercially available tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.guardrails.io"&gt;GuardRails&lt;/a&gt; runs all the tools from this article. The service will post a comment on your GitHub pull request when they detect something. It is a zero-configuration security tool that does a bunch of heavy lifting for you and filters out all the false positives.&lt;/p&gt;

&lt;p&gt;You also have companies like &lt;a href="https://snyk.io/"&gt;Snyk&lt;/a&gt; that focus only on your dependencies, and will alert you when they detect new vulnerabilities. &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt; and &lt;a href="https://gitlab.com/"&gt;GitLab&lt;/a&gt; also provide this as part of their offerings.&lt;/p&gt;

&lt;h2&gt;Open Source Security Tools are Great&lt;/h2&gt;

&lt;p&gt;The ruby community has put massive effort into creating those tools. They are free for everyone to use and should be supported!&lt;/p&gt;

&lt;p&gt;If you can afford it, send them some money or other support so they can continue and improve the tools in the future.&lt;/p&gt;

&lt;p&gt;How do you secure your codebase? Let me know at &lt;a href="mailto:andy@occamslabs.com"&gt;andy@occamslabs.com&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>security</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>TIL#2: patches in GitHub gists and reasons why jekyll won't generate my pages</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Mon, 24 Sep 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/pxlpnk/til2-patches-in-github-gists-and-reasons-why-jekyll-wont-generate-my-pages-2785</link>
      <guid>https://dev.to/pxlpnk/til2-patches-in-github-gists-and-reasons-why-jekyll-wont-generate-my-pages-2785</guid>
      <description>&lt;h2&gt;
  
  
  Patchfiles Syntax highlighting in GitHub gists
&lt;/h2&gt;

&lt;p&gt;Someone sent me gist today with a patchfile in it. To my delight, I noticed that they are highlighting the changes nicely.This improves the readability of a patch tremendously.Check out this patchfile: &lt;a href="https://gist.github.com/pxlpnk/357a32e789b63d5d809a40d886bc9337"&gt;https://gist.github.com/pxlpnk/357a32e789b63d5d809a40d886bc9337&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is important that the filename ends in &lt;code&gt;.patch&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jekyll and future dates
&lt;/h2&gt;

&lt;p&gt;This morning I spent around 15 minutes trying to figure out why a post using &lt;a href="https://jekyllrb.com/"&gt;jekyll&lt;/a&gt; would not show up.Some furious google searching resulted in a case of &lt;em&gt;This makes a lot of sense, but why?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It turns out, that jekyll will not generate anything that has the date set to a future time.In my case, the date was set for today, but one hour into the future.&lt;/p&gt;

&lt;p&gt;Here is what I learned on why it might not generate posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The post is not placed in the _posts directory.&lt;/li&gt;
&lt;li&gt;The post has an incorrect title. Posts should be named YEAR-MONTH-DAY-title.MARKUP (Note the MARKUP extension, which is usually .md or .markdown)&lt;/li&gt;
&lt;li&gt;The post's date is in the future. You can make the post visible by setting future: true in _config.yml (documentation)&lt;/li&gt;
&lt;li&gt;The post has published: false in its front matter. Set it to true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Big thank you to StackOverflow and their users for helping me out one more time: &lt;a href="https://stackoverflow.com/questions/30625044/jekyll-post-not-generated"&gt;https://stackoverflow.com/questions/30625044/jekyll-post-not-generated&lt;/a&gt;&lt;/p&gt;

</description>
      <category>todayilearned</category>
    </item>
    <item>
      <title>TIL#1: Working efficiently with GitHub Apps and using jekyll-compose</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Fri, 21 Sep 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/pxlpnk/til1-working-efficiently-with-github-apps-and-using-jekyll-compose-2c0j</link>
      <guid>https://dev.to/pxlpnk/til1-working-efficiently-with-github-apps-and-using-jekyll-compose-2c0j</guid>
      <description>&lt;p&gt;I want to document more what I have been learning throughout my days. Even as someone who writes code for 10+ years there are many new things every day that we stumble uppon. &lt;/p&gt;

&lt;p&gt;I want to share some of those with the great dev.to community.&lt;/p&gt;

&lt;p&gt;Here we go, two rather unrelated things:&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Apps
&lt;/h2&gt;

&lt;p&gt;Working with &lt;a href="https://developer.github.com/apps/"&gt;GitHub apps&lt;/a&gt; can be cumbersome. You have to set up a local tunnel and trigger the outgoing events using their user interface. Even though some tunnelling provider (is this a term?) allow you to replay it through their interface it can be tricky.&lt;/p&gt;

&lt;p&gt;Today I learned that every GitHub app has a log with the full outgoing requests. Those requests include headers and body.&lt;/p&gt;

&lt;p&gt;The request are found in your app settings under the advanced tab.&lt;/p&gt;

&lt;p&gt;Now I can replay things with curl and no tunnelling setup from a local file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST "Content-Type: application/json" -d "@githubwebhookpayload.json" 'http://localhost:8080/webhook'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  jekyll-compose
&lt;/h2&gt;

&lt;p&gt;If you run a static website powered by jekyll &lt;a href="https://github.com/jekyll/jekyll-compose"&gt;jekyll-compose&lt;/a&gt; makes your life easier. Work on blog posts and pages becomes more natural as you handle the drafts away from your actual posts.&lt;/p&gt;

&lt;p&gt;Create a new draft:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ bundle exec jekyll draft "Today I Learned #1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new file in the &lt;code&gt;_drafts&lt;/code&gt; folder. Once you finished writing and editing you publish the draft:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ bundle exec jekyll publish _drafts/today-i-learned-1.md
Draft _drafts/today-i-learned-1.md was moved to _posts/2018-09-21-today-i-learned-1.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it for today, keep on learning new things every day. 🤓&lt;/p&gt;

&lt;p&gt;You have an idea how to make this better? Let me know: &lt;a href="//mailto:hello@an-ti.eu"&gt;hello@an-ti.eu&lt;/a&gt;&lt;/p&gt;

</description>
      <category>todayilearned</category>
    </item>
    <item>
      <title>The Agile and the Beast</title>
      <dc:creator>Andreas Tiefenthaler</dc:creator>
      <pubDate>Tue, 24 Apr 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/pxlpnk/the-agile-and-the-beast-2d8n</link>
      <guid>https://dev.to/pxlpnk/the-agile-and-the-beast-2d8n</guid>
      <description>&lt;p&gt;Most security analysts have the same mindset, they want to reduce and avoid risk at any cost. They think in attack vectors, vulnerabilities, access rights and how to minimize the threat.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The security team is a nag. &lt;br&gt;&lt;br&gt;
They won't allow us to ship it like this.  &lt;br&gt;&lt;br&gt;
Why is the security team always saying no?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This works perfectly fine in a development process where the waterfall model.&lt;br&gt;
There the security analyst can take care of risk, plan accordingly and in the end have a penetration test and assessment to ensure everything is done in a secure way.&lt;br&gt;
But then agile, scrum and sprints start to happen.&lt;br&gt;
The code is released faster to production, from many months for a release too many releases within a month.&lt;/p&gt;

&lt;p&gt;The process becomes faster, the company starts living and breathing &lt;em&gt;agile&lt;/em&gt;, the security analysts and security engineers start to rotate and losing the grip on their perfectly secured applications and processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Panic
&lt;/h2&gt;

&lt;p&gt;Everything goes so fast, the development teams release 3 new features and a selection of bug fixes during the two-week penetration test.&lt;br&gt;
Two findings that where reported are fixed by accident in the meanwhile. What is the report worth now?&lt;br&gt;
How can the security analyst even do their job in this environment and protect the assets?&lt;/p&gt;

&lt;p&gt;Times have changed my friend, next the analyst falls into a crisis and a breakup phase.&lt;br&gt;
The 5 stages of grief:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;denial&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;They won't be doing this forever, once the product is released and stable they will go back to the old way.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most likely not, and they will be striving for even faster releases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;anger&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;Why are they not following my processes, they are mandatory and there to ensure the safety.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;They also slow down the developers, reduce velocity and give chance to the competitors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bargaining&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;If you follow my processes, I make them a bit easier and say less no to you.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;They are already faster than you, you would enter their world at a stage when they already shipped and moved on to the next thing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;depression&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;I can't do my job, everyone is working against me, I am always too slow and they won't fix my vulnerabilities I put into their backlog.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the time where the analyst should either consider looking for alternative employment options or start un-learning and re-learning what they already know.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;acceptance&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;The dev team won't change what they are doing, and the rest of the company is on the agile train as well. What can I do?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Relief
&lt;/h2&gt;

&lt;p&gt;This is the point where the security analysts and teams can start being part of enabling the business to strife, and turn from a &lt;em&gt;nag&lt;/em&gt; and no-sayer to an enabler.&lt;br&gt;
But how does one approach this? Everyone is talking about &lt;a href="https://www.youtube.com/watch?v=I8OSX4Kk97o"&gt;shifting to the left&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are two obvious starting points, technology, and people. While many would start putting effort into the technology first, they should go and talk to the people.&lt;br&gt;
Put some technology into the development lifecycle, add some code analysis into the build pipeline and make sure nobody can release until the security checks are all passing.&lt;br&gt;
Going this route, will result in frustrated developers that can not make their goals anymore and hit tricky roadblocks set up by the security team (&lt;em&gt;Why do I have to update a database dependency when I am just fixing a frontend bug?&lt;/em&gt;).&lt;br&gt;
At this point shortcuts will be taken, technology removed, people might even leave the company.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;nag&lt;/em&gt; is back.&lt;/p&gt;

&lt;h2&gt;
  
  
  People First
&lt;/h2&gt;

&lt;p&gt;In order to do make sustainable changes, the &lt;strong&gt;people&lt;/strong&gt; who work on the codebase, the infrastructure, and the product come first.&lt;br&gt;
The analyst needs to start talking to people and understand what is important to them.&lt;br&gt;
What their goals are and how they are planning to achieve them.&lt;br&gt;
It is crucial to understand the tools they are currently using.&lt;br&gt;
Once the analyst understands the priorities and the used tools, they can get to work and start introducing security features and tooling.&lt;br&gt;
The easiest approach here is to start enabling some security features as warnings on the existing tools.&lt;br&gt;
Make sure that they don't break the build, but people are getting notified.&lt;br&gt;
Define some achievable shared goals with the engineering team, and achieve them in collaboration with them.&lt;/p&gt;

&lt;p&gt;Gradually enable more checks as the goals are achieved, and consider what tools would support the teams to deliver value in a secure manner.&lt;/p&gt;

&lt;p&gt;Do you have some ideas, critique or want to share your story with me, you can reach me at &lt;a href="//mailto:hello@occamslabs.com"&gt;hello@occamslabs.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://www.occamslabs.com/blog/security-team-and-the-struggle-with-agile"&gt;www.occamslabs.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>agile</category>
      <category>devsecops</category>
    </item>
  </channel>
</rss>
