<?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 Raphael Bottino on Medium]]></title>
        <description><![CDATA[Stories by Raphael Bottino on Medium]]></description>
        <link>https://medium.com/@raphabot?source=rss-94534226a645------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QkVjEL5j5Oyiv61zDVWWfQ.jpeg</url>
            <title>Stories by Raphael Bottino on Medium</title>
            <link>https://medium.com/@raphabot?source=rss-94534226a645------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 27 May 2026 13:53:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raphabot/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[Simulating, Detecting and Responding to S3 Ransomware Attacks]]></title>
            <link>https://raphabot.medium.com/simulating-detecting-and-responding-to-s3-ransomware-attacks-9f85b2a97086?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f85b2a97086</guid>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[ransomware]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 16:10:33 GMT</pubDate>
            <atom:updated>2025-04-25T03:12:41.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/660/0*-dnfgXekusC3sfIO.png" /></figure><p>I am fascinated by the world of possibilities that Cloud Computing enables people and organizations to achieve. When it comes to security, tools and frameworks such as the Shared Responsibility Model make following good security practices easier than ever. I am equally fascinated by new attack vectors that Cloud Computing enables bad actors to achieve, though.</p><p>Not that recently ago, Halcyon put up a really <a href="https://www.halcyon.ai/blog/abusing-aws-native-services-ransomware-encrypting-s3-buckets-with-sse-c">interesting article</a> about a concerning new ransomware campaign targeting Amazon S3 buckets. This is a new kind of ransomware. One that only exists in the cloud, thanks to the cloud, since it leverages some of the many great security features that are built-in into AWS to help organizations achieve security and compliance encrypting Amazon S3 Objects, but to encrypt for ransom instead.</p><p>I am not going to go over many details about the attack itself, since there are many great articles out there going over them already, like the one from Halcyon themselves or <a href="https://www.sentinelone.com/blog/cloud-ransomware-developments-the-risks-of-customer-managed-keys/">this one</a> from SentinelOne. So why are we here, then? I believe the kind of information that these types of articles bring are priceless, but I also believe that one should be able to programmatically be able to validate if their own environment are susceptible to this kind of attack, and also validate if they can detect and respond in case they are.</p><p>This article is about understanding how S3 encryption works, how you can use the <a href="http://github.com/raphabot/s3-ransomware-simulator">S3 Ransomware Simulator</a> to test your own environment, how you can programmatically detect this kind of attack, respond to it, but also how to prevent it as well.</p><h3><strong>The Attack</strong></h3><p>On its core, the attack is simple, but it requires understanding a bit of how encryption works in Amazon S3.</p><p>You might have heard that Amazon S3 automatically applies encryption to all new object uploaded at no additional cost and with no impact on performance since January 5, 2023. And that’s great news! But there are different ways to encrypt an object in AWS, so first we need to go over them.</p><h4>Understanding S3 Encryption</h4><ul><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingClientSideEncryption.html">Client-side encryption</a> — This is the most straightforward type of Encryption in S3. You/your application encrypt the data, <em>before</em> uploading it to S3, with a key that you own and manage, even if outside of AWS.</li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingServerSideEncryption.html">Server-side encryption: Amazon S3 managed keys (SSE-S3)</a> — This Encryption method is the one that is enabled by default since 2023. You send your objects and they are encrypted by AWS Server-side, with Amazon S3 managed keys, and each object is encrypted with a unique key.</li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html">Server-side encryption: AWS KMS keys (SSE-KMS)</a> — <a href="https://docs.aws.amazon.com/kms/latest/developerguide/overview.html">AWS KMS</a> is a managed service to create and manage keys. Here you send your object and AWS uses server-side encryption leveraging these KMS keys to encrypt them, in case a compliance standard you must adhere to requires you to have full control of the encryption keys.</li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingDSSEncryption.html">Dual-layer server-side encryption: AWS KMS keys (DSSE-KMS)</a> — Not that different from SSE-KMS. However, some compliance standards require you to apply multilayer encryption to your data, so DSSE-KMS applies two layers of encryption to the objects.</li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#specifying-s3-c-encryption">Server-side encryption: customer-provided keys (SSE-C)</a> — It’s like Client-side and Server-Side encryptions had a baby. Like in Client-Side, AWS doesn’t host/manage your keys. Like SSE, you don’t need to worry about encrypting your objects before uploading to the bucket. Here you provide the key as part of the upload request and AWS will encrypt the object on upload, but never save the key anywhere. This is the one we care about.</li></ul><h4><strong>Why Is it Effective?</strong></h4><p>Given that an attacker has access to rewrite a victim’s S3 Objects, picking SSE-C as encryption method is the most effective way to guarantee that only they can recover the objects. Since the attacker can create one unique key per victim, they can leverage this key to rewrite the objects, overwrite them and the only way to recover access to these files, would be using they key that belongs only to the attacker.</p><h3>Replicating The Attack</h3><p>In order to programmatically detect and respond to this kind of attack, we need to first be able to programmatically replicate this kind of attack. When it comes to the S3 API, I am fairly familiar with the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html">GetObject</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a> actions. But in my mind it wouldn’t make much sense for an attacker to download (GetObject) every single object in a bucket in order to upload (PutObject) them back, while encrypting the data. So I started a research on the best way to encrypt existing objects in a bucket.</p><p>That research led me to, funnily enough, AWS’s own blog page, where a <a href="https://aws.amazon.com/blogs/storage/encrypting-existing-amazon-s3-objects-with-the-aws-cli/">blog post on how to encrypt existing objects</a> described some of the best techniques. Even though the article uses the AWS CLI to encrypt the existing objects, and my goal is to use Python’s <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">Boto3 SDK</a>, it led me exactly to what I was looking for, the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html">CopyObject</a> action. In summary, I just need to make a <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/copy_object.html">CopyObject</a> request, where the source and destinations of the copy are the same object, while making sure I was making the proper encryption request as well.</p><h4><strong>The Code</strong></h4><p>First and foremost, you can follow along in your own environment. You can find the code in the <a href="http://github.com/raphabot/s3-ransomware-simulator">S3 Ransomware Simulator GitHub repository.</a>. It tries, as much as possible, to mimic the behavior of an attacker exploiting your own AWS environment.</p><p>The behavior goes as below:</p><ol><li>It enumerate all the buckets available in that account, if the flag --all-buckets is used;</li><li>It generates and saves to disk an AES-256 encryption key to be used in the attack;</li><li>For each of the buckets, or just the one in case the flag --bucket-name was used it will:</li><li>Check if it can PutObject in the bucket, dropping a dummy object</li><li>Check if it can GetObject in the bucket, getting the previously uploaded dummy file</li><li>Deletes the dummy file</li><li>Considering all permissions are in place, and the flag --encrypt-objects was provided, it will:</li><li>List and encrypt all objects</li><li>Drop a fake ransom note</li></ol><p>An example of the execution can be seen below:</p><pre>$ python3 attacker.py --bucket-name raphabot-no-ransomware --encrypt-objects<br><br>S3 Bucket Encryption Tool with SSE-C<br><br>Processing specified bucket: raphabot-no-ransomware<br>Generated AES-256 encryption key for SSE-C: M+a4reQycj3pBBZyYs1KE9XpOcdyT7kGq1Mu+q5u+vM=<br>Key MD5: S2k8nSe8W9C7A2JO+Nr4mw==<br><br>Checking bucket: raphabot-no-ransomware<br>  GetObject permission: Yes<br>  PutObject permission: Yes<br><br>Processing bucket: raphabot-no-ransomware<br>  Encrypting: regular-file.txt<br>  Encrypted 1 files in raphabot-no-ransomware using SSE-C<br>  Ransom note dropped in raphabot-no-ransomware.<br><br>Encryption key saved to encryption_key.bin<br>WARNING: This key is required to decrypt your files. Store it securely!<br><br>Encryption complete. Total files encrypted: 1<br>Warning: Without the encryption key, your files cannot be recovered!</pre><h3><strong>Detection</strong></h3><p>In order to respond, we need first to detect. If you ever read about <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/monitoring-overview.html">logging and monitoring in Amazon S3</a>, you know there are many different options to do so. To understand if our buckets are being targets of a Ransomware attack, however, some options are better than others.</p><p>So I created a criteria for how I’d listen to events. Whatever method that was picked, had to:</p><ol><li>Be cheap/free</li><li>Be scalable</li><li>Be simple</li><li>Be fast on notifying of the event</li></ol><p>If you’ve been around for a while, you might know that the most traditional way to listen to events in an S3 bucket is to use <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html">Event Notification</a>. At first, this looked like a great option, since it is built to have event notifications delivered in seconds, it is <a href="https://aws.amazon.com/blogs/storage/reliable-event-processing-with-amazon-s3-event-notifications/">free</a> and, although originally only supporting SNS and SQS, since November of 2021 <a href="https://aws.amazon.com/blogs/aws/new-use-amazon-s3-event-notifications-with-amazon-eventbridge/">it supports EventBridge</a>. If you are not familiar with <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is.html">Amazon EventBridge</a>, the gist is that it is a serverless service that makes it easier to build scalable event-driven applications.</p><p>Scalability doesn’t end with the performance of detection, though, and I also want to be able to deploy this detection across many buckets at scale, as code. This is where this solution starts to fall apart. Despite CloudFormation obviously supporting S3 Buckets, the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html">S3::Bucket resource type</a> <em>creates</em> an Amazon S3 bucket, it doesn’t update one. An alternative would be using <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html">Custom Resources</a>, but this would come with its own set of challenges when it comes to scale (applying the event notification across multiple buckets before the <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-timeout.html#:~:text=maximum%20value%20of-,900%20seconds%20%2815%20minutes%29.,-This%20page%20describes">maximum Lambda timeout</a>, for instance), complexity (writing code to take in consideration any exceptions) and security (maintaining the code dependencies up to date).</p><p>Another great option would be using <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html">CloudTrail</a>. CloudTrail comes enabled by default, logs management events across AWS services also by default, and it is free. So, chances are that you are already using CloudTrail. It is fast, with AWS suggesting that CloudTrail publishes log files <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/how-cloudtrail-works.html#:~:text=about%20every%205%20minutes">about every 5 minutes</a>, but real world testing shows that the <a href="https://tracebit.com/blog/how-fast-is-cloudtrail-today-investigating-cloudtrail-delays-using-athena#:~:text=the%20average%20CloudTrail%20delay%20appears%20to%20be%20considerably%20lower%20%2D%20around%202%C2%BD%20minutes">delay is considerably lower than that</a>. It doesn’t come without its own set of challenges, though.</p><p>Yes, CloudTrail is enabled by default and it’s free&amp;mldr; for management events. Events that happen within buckets, like CopyObjects, are called Data events, which are not enabled by default and they cost $0.10 per 100,000 data events delivered. However, when it comes to scalability and simplicity of deployment, it couldn’t be a better match. Either through the Console or via CloudFormation, one can create a new CloudTrail Trail (you gotta love AWS naming!) to listen to one, some or all Buckets. As you can imagine, even if you filter to listen to data events of only the most critical S3 Buckets, listening to all data events can get pretty expensive pretty quickly. The good news is that CloudTrail enables us to use <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/filtering-data-events.html">advanced event selectors</a> to filter which events we are listening to.</p><p>Creating an Advanced Selector like the one below, enables us to listen only to the CopyObject event for the selected Buckets:</p><pre>[<br>  {<br>    &quot;Name&quot;: &quot;CopyObject&quot;,<br>    &quot;FieldSelectors&quot;: [<br>      {<br>        &quot;Field&quot;: &quot;eventCategory&quot;,<br>        &quot;Equals&quot;: [<br>          &quot;Data&quot;<br>        ]<br>      },<br>      {<br>        &quot;Field&quot;: &quot;resources.type&quot;,<br>        &quot;Equals&quot;: [<br>          &quot;AWS::S3::Object&quot;<br>        ]<br>      },<br>      {<br>        &quot;Field&quot;: &quot;eventName&quot;,<br>        &quot;Equals&quot;: [<br>          &quot;CopyObject&quot;<br>        ]<br>      }<br>    ]<br>  }<br>]</pre><p>In summary, using CloudTrail, we are able not just to deploy a “detector” at scale easily, but also to cheaply run it at scale as well. The proof is that you can find this Detection defined as CloudFormation code that you can apply today in the same <a href="http://github.com/raphabot/s3-ransomware-simulator">S3 Ransomware Simulator repository</a>.</p><h3>Response</h3><p>Once we detect an attempt, we need to be able to respond to it. The response can and will look different based on different organization preferences. Some would not ever dream of making a change in their AWS environment automatically, others would like to have humans (like you!) notified so they can take action, but some would be fine to take at least some proactive action automatically based on these events, while further investigation is ongoing. For the purposes of this blog post, we will follow AWS’ own <a href="https://repost.aws/knowledge-center/potential-account-compromise">best practices on how to remediate if there are unauthorized activity in an AWS account</a>.</p><p>The first step to remediate the compromise of an AWS identity is to, first, understand what kind of identity it is, since the remediation steps to deal with each kind of identity is different. The type of identity used in an API call <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html">can be determined</a> by checking the type attribute of the userIdentity object in the CloudTrail event. There are three types of identity in AWS:</p><ul><li><strong>IAM User</strong>: When one creates an IAM User and wants to make a request against an AWS service, they need to generate a long lived pair of access key id and secret. Shows up as IAMUser in CloudTrail.</li><li><strong>Assumed Role</strong>: This is generally used when an application/service, not a person, needs to access AWS resources. Assuming a role leads to AWS Security Token Service generating a short-lived pair. Shows up as AssumedRole in CloudTrail.</li><li><strong>Identity Center User</strong>: AWS IAM Identity Center streamlines and simplifies workforce user access to applications or AWS accounts. For a request made on behalf of an IAM Identity Center user, it will show up as userIdentity in CloudTrail.</li></ul><p>Now let’s talk about the actual remediation: blocking this identity from making further requests in the AWS account.</p><p>For an IAM User, for instance, you could disable the user’s Access Keys. It’s good to remember that AWS recommends that, as best practice, to use temporary security credentials (such as IAM roles) instead of creating long-term credentials like access keys. So that’s probably a good idea anyway 😅</p><p>For an Assumed Role, you have options. You could update the role to remove this access, you could attach a policy denying CopyObject actions to S3&amp;mldr; the options are close to limitless! If you want to be precise, you can <a href="https://repost.aws/knowledge-center/iam-restrict-calls-ip-addresses">restrict requests from the attacker’s IP address</a>.</p><h4>Example workflow that I setup for this Response:</h4><p>The workflow below will guarantee that, in case of an attack where the identity is either an IAM User or an Assumed Role, that the identity will be invalidated automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xtO7wcgA0yF_6KV5Kz2i9w.png" /><figcaption>Response State Machine</figcaption></figure><p>You can find this sample Response defined as CloudFormation code in the same <a href="http://github.com/raphabot/s3-ransomware-simulator">S3 Ransomware Simulator repository</a>.</p><h3>Prevention</h3><p>Of course, better than remediating this kind of attack, is to prevent it in the first place. Perfect security is a pipe dream that we all chase, but there are some actions that you can take today to make your environment safer against this kind of threat. Here’s a list of some of them.</p><h4><strong>Restrict SSE-C Usage</strong></h4><p>The most effective action that you can take, in case your organization isn’t using SSE-C, is to block its usage at least in the most critical S3 Buckets. Using Amazon S3 condition keys, you can update your Bucket Policy adding something like the following:</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Id&quot;: &quot;PutObjectPolicy&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;RestrictSSECObjectUploads&quot;,<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:PutObject&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::my-important-bucket/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;Null&quot;: {<br>                    &quot;s3:x-amz-server-side-encryption-customer-algorithm&quot;: &quot;false&quot;<br>                }<br>            }<br>        }<br>    ]<br>}</pre><h4><strong>Restrict CopyObject</strong></h4><p>If your applications are not using the CopyObject action, it might be a good idea to block it in your most critical S3 Buckets. However, as pointed out by <a href="https://www.linkedin.com/in/kaojason/">Jason Kao</a>, one can’t simply block the CopyAction. But if you look closely to the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html">CopyObject API</a>, it is the same PUT http verb as the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a>. One of the main differences is the collection of x-amz-copy-source headers. So, if we craft our bucket policy to block any PutObject request that contains the x-amz-copy-source header, we are effectively blocking any CopyObject request.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Id&quot;: &quot;CopyObjectPolicy&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;RestrictCopyObject&quot;,<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:PutObject&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::my-important-bucket/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;Null&quot;: {<br>                    &quot;s3:x-amz-copy-source&quot;: &quot;false&quot;<br>                }<br>            }<br>        }<br>    ]<br>}</pre><h4><strong>Object Versioning</strong></h4><p>This is by far the easiest to implement, with the best result. It is, as well, the most expensive. Enabling Object Versioning in your must critical buckets will guarantee that, in case of a Ransomware attack, or even an accidental overwrite or deletion, you can still recover the original Object. Example on how to enable it using the AWS CLI:</p><pre>aws s3api put-bucket-versioning --bucket my-important-bucket --versioning-configuration Status=Enabled</pre><p>Now, in case the identity that the attacker is assuming has full access to the objects in the bucket, they can still delete the older versions using s3:DeleteObjectVersion. You might want to deny this action as well:</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Id&quot;: &quot;DeleteObjectVersionPolicy&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;RestrictDeleteObjectVersion&quot;,<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:DeleteObjectVersion&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::my-important-bucket/*&quot;<br>        }<br>    ]<br>}</pre><h4>Pretty please, avoid using hardcoded secrets</h4><p>This one is self explanatory and a core principle of proper cloud and application security: avoid using hardcoded secrets. Sooner or later, one way or another, hardcoded secrets always find a way to get in the wrong hands. Secret Scanning should be part of your CI/CD pipelines.</p><h3><strong>Conclusion</strong></h3><p>Although Ransomware is far from being a novel kind of attack, even in Cloud environments such as AWS, as the cloud usage ramps up, so does this kind of attack. As organizations move more and more of critical customer data to the cloud, while adoption techniques such as Workload Isolation to reduce blast radius, it’s more important than ever to have a full grasp of the environment’s posture.</p><p>Posture isn’t enough, however. Different teams will have different levels of maturity and you must be ready to detect and respond to this kind of event in near real time. Make sure you are listening to, and reacting to, your CloudTrail events. A good way to understand if you organization is ready for this, but also to get ready as well, is using the provided code to simulate, detect and respond to this kind of attack in your own AWS accounts.</p><p><em>Originally published at </em><a href="https://raphabot.com/articles/simulating-detecting-and-responding-s3-ransomware/"><em>https://raphabot.com</em></a><em> on April 21, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f85b2a97086" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Different Techniques for Vulnerability Prioritization]]></title>
            <link>https://raphabot.medium.com/understanding-different-techniques-for-vulnerability-prioritization-609cb0341d88?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/609cb0341d88</guid>
            <category><![CDATA[ca]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 03:40:16 GMT</pubDate>
            <atom:updated>2024-09-16T20:37:54.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bf0FsrH-PIdKE5k3VLFlpA.jpeg" /><figcaption>Let&#39;s shield those vulnerabilities!</figcaption></figure><p>In the <a href="https://raphabot.medium.com/a-rapidly-growing-problem-named-vulnerability-4d770244a9f2">last article</a>, we discussed how vulnerability is indeed a growing problem. More code, more CVEs, accelerated deployment speed are all contributors to the challenge of trying to protect your organization&#39;s code against bad actors. We also concluded that the strategy on how we approach vulnerability prioritization also needed to evolve.</p><p>There’s a silver lining: As much as vulnerability grew as a problem, possible tools and techniques to find, prioritize, and fix vulnerabilities also grew.</p><h3>Vulnerability prioritization evolution</h3><p>The Open Worldwide Application Security Project (OWASP), founded in 2001, is a nonprofit foundation that works to improve the security of software. Among many different projects, they maintain the <a href="https://owasp.org/www-project-juice-shop/">OWASP Juice Shop</a>, which probably is the most modern and sophisticated purposefully insecure web application that can be used for security research. We are going to use it for the examples below.</p><p>First, we want to understand what are, if any, the dependency vulnerabilities that are part of this application. For that job, there&#39;s no better tool than a Software Composition Analysis (SCA), that tries to detect publicly disclosed vulnerabilities contained within a project’s dependencies. There are multiple different SCA scanners in the market, both in commercial and open-source flavors. OWASP itself maintains the <a href="https://owasp.org/www-project-dependency-check/">Dependency Check</a>, a open-source SCA. Another great option that is commercial but has a free tier for open-source codebases is <a href="https://snyk.io/product/open-source-security-management/">Snyk Open Source</a>, which we will use here.</p><p>If you run a Snyk Open Source scan against juice-shop’s repository, at least as of 08/10/2024, you’d find the following:</p><ul><li>959 total dependencies. Despite the application having 72 direct dependencies, each of them might have their own dependencies — which are called transitive dependencies to the original app — and they also might bring vulnerabilities into the application.</li><li>174 vulnerable paths. To understand this, imagine you are pinpointing a given vulnerability in one of the dependencies. Draw a line from this dependency, crossing through this dependency&#39;s dependency and all the way to the actual application. You&#39;ll find 174 of these in the application.</li><li>77 known unique vulnerabilities. As you might&#39;ve guessed, since this number is lower than the number of vulnerable paths, there are vulnerabilities that repeat themselves in different paths, like the application depending on two different dependencies that depend on the same one vulnerable dependency. See the image below for a visual explanation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPrqK-EDvWvkYHsH7xLgYQ.png" /><figcaption>Example of two vulnerable paths that leads to the same unique vulnerability.</figcaption></figure><p>This is a purposefully vulnerable application, like it was mentioned before, so we are definitely expecting multiple vulnerabilities here. However, having a modern application vulnerable to 77 unique vulnerabilities isn’t unheard of, so let’s discuss how we could prioritize them.</p><h3>The usual way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*9_jkRAgRmapaJBwM.jpg" /><figcaption>The Mandalorian thinking that he actually knows the way.</figcaption></figure><p>The U.S. Department of Commerce’s National Institute of Standards and Technology (NIST) maintains the National Vulnerability Database (NVD). The NVD is synchronized with CVE such that any updates to the CVE List — explained in the <a href="https://raphabot.medium.com/a-rapidly-growing-problem-named-vulnerability-4d770244a9f2">previous article</a> — appear in the NVD, which augments the CVE List with additional enrichment.</p><p>One of the 77 unique vulnerabilities that were found by the SCA scan above, was the CVE-2023–37466. The NVD has <a href="https://nvd.nist.gov/vuln/detail/CVE-2023-37466">an entry</a> on this CVE, and it can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*nPaSjLYDx0ly2tQM" /><figcaption>NVD entry for the CVE-2023-37466</figcaption></figure><p>The traditional way to vulnerability prioritization has been to use the Common Vulnerability Scoring System (CVSS) score. This is because there&#39;s a well-defined and tested formula, revised regularly, of how that score is calculated, defining a qualitative measure of severity. So, the expectation is that an organization should handle a vulnerability with CVSS score 10 prior to one with score 9.9.</p><p>The NVD entry goes beyond CVSS score, though. The score is calculated using different metrics and data, for instance what the Attack Vector is, whether privileges are required to exploit the vulnerability, etc. For instance, one could prioritize vulnerabilities that have the Network as Attack Vector only if the application is, indeed, exposed in the network.</p><p>This is a basic way of looking at risk, instead of looking simply at vulnerability severity, since a network exploitable vulnerability in a network exposed application is riskier than the same vulnerability in a non-exposed application.</p><h3>Will it be exploited, though?</h3><p>Expanding the idea of looking at risk versus severity, how useful would it be if one could predict what the chances are of having any given vulnerability exploited if directly exposed to the internet? A lot, and that&#39;s exactly why the good folks at the global Forum of Incident Response and Security Teams (FIRST) do exactly that since 2021.</p><p>From their own <a href="https://www.first.org/epss/">definition</a>, the Exploit Prediction Scoring System (EPSS) is a data-driven effort for estimating the likelihood (probability) that a software vulnerability will be exploited in the wild. For any given CVE, a EPSS entry is provided and it contains:</p><ul><li>epss : the EPSS score representing the probability [0–1] of exploitation in the wild in the next 30 days (following score publication)</li><li>percentile : the percentile of the current score, the proportion of all scored vulnerabilities with the same or a lower EPSS score</li></ul><p>Access to this data is free and couldn’t be easier to access. In case you have a SCA tool, verify if this data isn&#39;t already there, since many of them, like Snyk, have this data. Or simply make a HTTP GET request to the EPSS’ API, no authentication required. Example:</p><pre>curl -s https://api.first.org/data/v1/epss\?cve\=CVE-2023-37466 | jq .</pre><pre>{<br>  &quot;status&quot;: &quot;OK&quot;,<br>  &quot;status-code&quot;: 200,<br>  &quot;version&quot;: &quot;1.0&quot;,<br>  &quot;access-control-allow-headers&quot;: &quot;x-requested-with&quot;,<br>  &quot;access&quot;: &quot;public&quot;,<br>  &quot;total&quot;: 1,<br>  &quot;offset&quot;: 0,<br>  &quot;limit&quot;: 100,<br>  &quot;data&quot;: [<br>    {<br>      &quot;cve&quot;: &quot;CVE-2023-37466&quot;,<br>-----&gt;&quot;epss&quot;: &quot;0.008380000&quot;,&lt;-----<br>-----&gt;&quot;percentile&quot;: &quot;0.824310000&quot;,&lt;-----<br>      &quot;date&quot;: &quot;2024-09-09&quot;<br>    }<br>  ]<br>}</pre><p>With that we can easily see that the CVE-2023–37466’s EPSS is 0.008380000, meaning that the probability of having this CVE exploited in the wild in the next 30 days is of only 0.838%.</p><p>Now let&#39;s make the exercise of plotting all vulnerabilities with CVE in a bidimensional scatterplot graphic, where the CVE is positioned according to its CVSS Score (x axis) and its EPPS Probability (y axis). Let&#39;s now draw a 45 degree line from (0,0), all the way to the top. The vulnerabilities closer to the top of this line can be considered riskier and should be prioritized first, because they have a high CVSS to EPPS combination, while vulnerabilities close to its bottom can be deprioritized. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w22Q5MAQI4Tkvk6-_70htA.png" /><figcaption>Graphical plot of EPSS Score compared to Base CVSS Score for juice-shop vulnerabilities that have a published CVE</figcaption></figure><p>In summary, EPSS is another excellent tool that the AppSec community can leverage in order to help prioritize vulnerabilities. In this case here, we can see that CVE-2019–10744, with a CVSS score of 9.1 and EPSS score of 02082, is risker than the CVE-2023–37466 discussed above, since it lands further away from the top of the line that we draw.</p><h3>Am I even running the vulnerable code?</h3><p>There’s another data point that has been gaining some traction recently on helping to prioritize vulnerability handling. Let’s pretend for a moment that we have a “math” package, version 1.0, where there’s a critical vulnerability on the “multiply” function that allows Code Injection. This means anyone running an application that depends on version 1.0 of this package would be running an application that depends on a vulnerable package. But is the application really vulnerable?</p><p>If said application indeed uses the vulnerable multiply function, this dependency should be updated as soon as possible to a non-vulnerable version. But what if the application never used the vulnerable multiply function in the first place? Although I particularly believe that this vulnerable dependency shouldn’t be ignored, since in the future the app developer might decide to leverage this vulnerable function without remembering or knowing that it is vulnerable, many believe this vulnerability should have its priority lowered when compared to an identical vulnerability that actually triggers vulnerable code, since it is less risky than the others. This concept is widely known as reachability.</p><p>See a representation of this concept below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MhOm0okO1VaXbCsK" /><figcaption>Representation of the Reachability concept.</figcaption></figure><p>In the example above, considering both vulnerabilities have the same CVE and EPSS, it makes more sense to invest time to fix the vulnerable dependency xyz 1.0 than fixing math 1.0, since the vulnerable multiply function isn’t reached by the application.</p><p>Although I couldn’t find an open source tool that enables anyone to do this kind of analysis easily, some commercial SCA scanners, Snyk’s included, can find reachable vulnerabilities and leverage this data to help its user prioritize vulnerability remediation.</p><h3>What about understanding which vulnerability to fix among different applications?</h3><p>So far we’ve discussed strategies of how to prioritize vulnerabilities amongst the same application. The reality is that one might be responsible for prioritizing vulnerability fixing between many different applications, some of which you may at first lack awareness of. How to prioritize them?</p><p>For this scenario let’s pretend a new high profile critical vulnerability was released, just like <a href="https://www.cisa.gov/news-events/cybersecurity-advisories/aa21-356a">log4shell</a> once was, and one is trying to figure out first, if their applications are affected, and second, what the order of priority should be when it comes to fixing it across multiple different applications.</p><h3>Dependency tracking</h3><p>The easiest way to figure out if an application is affected by a specific CVE, even without running it against any kind of scanner, is to know what dependencies the application has. There are many tools out there that one could leverage, including a properly named <a href="https://dependencytrack.org/">Dependency Track</a> from OWASP or, you guessed it, Snyk.</p><p>The simplest way to achieve that, is to make sure that you have a Software Bill of Materials (SBOM) of each one of the current builds of your projects. SBOM is a big hot topic on its own and it extrapolates the goal of this article to go over it in detail. What you should know right now is that a SBOM is, in the most simplistic definition, a document that keeps track of all dependencies that are part of a given application and their versions. So one could just check if the CVE’s affected dependency and versions are part of any of their applications SBOMs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1XUcevBFY2ivifxD3uIFw.png" /><figcaption>Graphical representation of a SBOM</figcaption></figure><h3>Application context that you didn’t know you had</h3><p>Now that one knows that applications are affected by this fictional CVE, how to prioritize among them? Unfortunately, the reality is that much of the workforce involved in protecting applications is unaware of their context. But maybe they might have access to more context than they realized at first.</p><p>It’s not rare to find organizations where the development team is using some kind of Internal Developer Portal (IDP), such as the CNCF’s <a href="https://backstage.io/">Backstage</a>, originally created by Spotify. Some other examples that you might be familiar with ServiceNow CMDB, Atlassian Compass, Datadog Service Catalog, Harness, OpsLevel, etc.</p><p>This kind of platform hosts interesting metadata that might be valuable for this assessment. See the example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bYZrrvpkzq_eMmcG" /><figcaption>Sample page for Backstage’s Service Catalog</figcaption></figure><p>From a glance we can see to which System an application belongs to, its owner, or if it’s in production and running. This is huge! A vulnerability in an application that is running in production and is part of some kind of Payment system, definitely is riskier than having the same vulnerability in an application that is still in staging, and belongs to some kind of a minor system.</p><p>If you are in charge of vulnerability prioritization in your organization, make sure you check with your Dev or SRE teams if your organization is already using some kind of IDP in order to help you do your prioritization job.</p><h3>Is it even in the wild?</h3><p>But deployed doesn’t necessarily mean public facing. Most likely, an application that is public facing will be in a riskier position than one at is internal facing only.</p><p>Although there’s an infinitude of ways, depending on the tech stack, to verify if an application is public facing, we can use Kubernetes as an example here. See below:</p><pre>$kubectl get ingress my-app<br>NAME HOSTS ADDRESS PORTS AGE<br>my-app * DNS-Name-Of-Your-ALB 80 15m</pre><pre>$curl DNS-Name-Of-Your-ALB<br>Hello World!</pre><p>This way we quickly checked that this application has an Application Load Balancer attached to it and is reachable from the internet, meaning it poses a higher risk than one that isn&#39;t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o1n3CbbeCOq_M1if6yo1wA.png" /><figcaption>Example of two applications, dependents on the same vulnerable dependency, while just one is exposed to the internet.</figcaption></figure><h3>Show me the Memory</h3><p>What if there are more than one critical applications that are in production and public facing, which one is in a riskier position then? An additional strategy might be to figure out if the vulnerable dependency is even loaded in memory.</p><p>This isn&#39;t trivial since to get this information on demand usually means instrumenting your runtime environment and/or your application. So, if you organization is using an AppSec platform like Snyk, or maybe a continuous profiling platform, you might be able to get this information to help your prioritization task.</p><h3>Conclusion</h3><p><a href="https://raphabot.medium.com/a-rapidly-growing-problem-named-vulnerability-4d770244a9f2">In the first article of this series</a>, I explained how my journey to answer if there actually were more published vulnerabilities today than ever before, led me to a resound yes as an answer. But I also mentioned how it triggered my curiosity on how modern high performing AppSec teams are handling this constant stream of new vulnerabilities.</p><p>In this article, we saw how the techniques to help prioritize vulnerabilities based on Risk also evolved over time. Tools like EPPS, Reachability and IDPs can and should be used to help identify where the highest risk lies in your organization so you can focus on what matters the most: protecting your customer data.</p><p>I hope you have learned as much as I did while I researched and wrote the two longest articles I&#39;ve ever written. Were you already aware of these tools? Which one do you use the most? Which one were the most surprising to you?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=609cb0341d88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Rapidly Growing Problem Named Vulnerability]]></title>
            <link>https://raphabot.medium.com/a-rapidly-growing-problem-named-vulnerability-4d770244a9f2?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d770244a9f2</guid>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 13:01:52 GMT</pubDate>
            <atom:updated>2024-08-29T13:01:52.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oqqBedxI2V4CXOGdIGK0EA.jpeg" /><figcaption>Hollywood representation of a developer/cybersecurity professional/hacker (although not wearing a hoodie, so maybe not?). Photo by Mikhail Nilov.</figcaption></figure><p>Talking to friends and practitioners in the space, a recurring topic is how it seems like the number of vulnerabilities we need to deal with is growing, and how challenging it has become to prioritize which of them to fix first. Although I agree with this premise, the reality is that we are only humans and maybe we are only under the impression that there are more vulnerabilities to deal with than ever. After all, we have also been busier than ever, and maybe we simply have less time to deal with this problem.</p><p>Throughout the research that lead to this article, I set out to find if this premise is really true. Are we really dealing with more vulnerabilities than ever? But finding out if this is indeed true isn&#39;t as satisfying as understanding the <em>why</em> behind this, so I also tried my best to justify the growth (or lack there of) vulnerabilities over time with actual data.</p><h3>Are we collectively generating more vulnerabilities?</h3><p>The first part of this research was a simple yes or no question: are we collectively generating more vulnerabilities? To answer this question, though, we need to get a bit in the weeds of the cybersecurity vulnerabilities. Are you familiar with the terms below? Feel free to skip to the next chart.</p><p>The first term we need to understand is of the <strong>CVE</strong>. The Common Vulnerabilities and Exposures (CVE) program, maintained by the MITRE Corporation and sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA), is a dictionary or glossary of vulnerabilities that have been identified for specific code bases, such as software applications or open libraries.</p><p>So, the <strong>CVE List</strong> is a list of all <strong>CVE IDs</strong>, and allows interested parties to acquire the details of vulnerabilities by referring to a unique identifier known as the CVE ID. It is important to note that not all vulnerabilities necessarily make their way into getting an assigned CVE ID for a variety of reasons, but the CVE List is by far the most recognized way to learn about cybersecurity vulnerabilities.</p><p>Thanks to the CVE program efforts, answering my original question turned out to be easier than I initially anticipated. They have a <a href="https://www.cve.org/About/Metrics">dedicated page for CVE metrics</a> that includes the number of publised CVE records. It&#39;s important to know that A CVE Record contains descriptive data, (i.e., a brief description and at least one reference) about a <a href="https://www.cve.org/ResourcesSupport/Glossary?activeTerm=glossaryVulnerability"><strong>vulnerability</strong></a> associated with a <a href="https://www.cve.org/ResourcesSupport/Glossary?activeTerm=glossaryCVEID"><strong>CVE ID</strong></a><strong>.</strong></p><p>With this free data in hands, I had it plotted in the chart below to help us visualize the number of published CVEs over time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ddcHyu7_zf97uHVcY3M0sA.png" /><figcaption>Graphical representation of the number of published CVEs from 2013 onwards, divided by quarter.</figcaption></figure><p>It doesn&#39;t take a lot of effort to see a clear pattern of new published CVE growth from 2017 onwards, so the hypothesis is clearly true. If we zoom in to the window of time from 2020 to 2023, we can see that the number of published CVEs grew over 57% on this period alone! To give us a better perspective on these numbers, in 2023 alone there were 79 new published CVE IDs a day on average. That’s over 3 new published vulnerabilities an hour!</p><h3>But why?</h3><p>This would have been a really lame article, and research, if it was only about confirming the hypothesis that we are generating more vulnerabilities than ever. I wanted to understand, and share with you, the <em>why</em> behind this growth. The reality is, though, that I can&#39;t, with 100% certainty, pinpoint reasons behind this growth.</p><p>This shouldn&#39;t stop us from speculating on some of the reasons, though. So my first hypothesis for this growth is simple: The growth on the number of vulnerabilities should be (as close to) directly proportional to the growth of lines of code developed. To prove this hypothesis, however, one needs to understand how much the codebase grew in the same period.</p><p>The challenge here is that there&#39;s no absolute way to know how much the global codebase grew in this period. We can extrapolate this information, though, using GitHub data, the most used SCM platform, as a way to approximate how much code was created.</p><p>Luckily for me, GitHub maintains a repository, called <a href="https://github.com/github/innovationgraph">innovationgraph</a>, that contains structured data files of public activity on GitHub itself. One of the metrics that is captured and shared with the public audience is the number of “Git push” over time. For the uninitiated, “git push” is the command a developer executes when submitting or removing code, to a remote git server, which is GitHub in this case. And although a growth on the number of “git push” doesn&#39;t mean a growth on “number of lines of code”, for this exercise, let&#39;s imagine that the average “lines of code” per “git push” hasn’t changed over time and it is positive.</p><p>With that in mind, let’s see visualize this data, plotted in the chart below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQ6IluFFABe_E04X-IvJEQ.png" /><figcaption>Graphical representation of the number of “git push” in GitHub from 2020 onwards.</figcaption></figure><p>As I expect, codebases in GitHub grew overtime. If we zoom in to the window of time from 2020 to 2023 again, we will see something interesting: the codebase grew virtually over 40% in this period, which is significantly lower than the increase of 57% of vulnerabilities for the same period. This goes against my hypothesis that the growth was (close to) directly proportional between vulnerabilities and codebase size. But why such a difference between growth rates?</p><p>Again, I can only speculate here. The cybersecurity discipline matured a lot in the past few years and we can look at this number with a positive spin, congratulating ourselves for collectively improving in detecting and disclosing vulnerabilities. Or, if we are the glass-half-empty-type, we could be lamenting on how the code quality, when it comes to security, has decreased.</p><p><em>Quick sidetrack:</em> I want to add a touch of personal opinion here. It&#39;s almost impossible to find content today that doesn&#39;t speak to Generative AI (GenAI), and this one won&#39;t be different. If lower quality code is indeed the reason why we saw a disparity between growth of vulnerabilities vs growth of &quot;git push&quot;, we can speculate on the impact of GenAI on the future of vulnerabilities. As you might know, GenAI is trained on existing content to generate new content, and developer’s copilots — GenAI agents purposefully built to generate code — are not different. So, if code quality is lower than ever, copilots will generate lower quality code as well. Worse: more code is then pushed to repositories, which will eventually lead to faster growth of (low quality) codebases and, as a consequence, of vulnerabilities.</p><h3>Deployment Frequency</h3><p>Vulnerable code isn&#39;t an actual vulnerability only because the codebase was changed. A vulnerability only exists when said vulnerable code is part of a new version of a software or open source library, so it needs to be deployed first. With that in mind, I decided to do research on modern deployment frequency to understand if that could also impact the number of vulnerabilities.</p><p>To help me understand how the deployment frequency changed in the last few years, I resorted to <a href="https://dora.dev/">DORA</a>, the DevOps Research and Assessment group. DORA has 4 Software delivery performance metrics that many organizations leverage to measure their own efficiency and maturity level when it comes to delivering value to their customers.</p><p>One of these metrics is the Deployment Frequency, or how often an organization can successfully deploy to production, exactly the data I need to answer the question I had in mind. Every year since 2014, with the exception of 2020, DORA released the Accelerate State of DevOps Report, that includes the results of a benchmark assessment of DevOps performance across hundreds of organizations, so this data can help us understand how they evolved over time.</p><p>Although organizations are divided by Elite, High, Medium or Low performance based on certain criteria, simply showing an evolution of the percentage of organizations spread across these tiers over time wouldn&#39;t be enough, as the criteria for each tier also evolved over time. Instead, I&#39;ve plotted a chart below that represents the percentage of organizations capable of deploying multiple times a week, over the years:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wk0c6SWYtfp9C-ISVkxv9Q.png" /><figcaption>Graphical representation of percentage of organizations deploy at least once a week from 2021 onwards.</figcaption></figure><p>As expected, despite a dip in 2022 that DORA theorizes can be a consequence of the pandemic, there was a growth from 2021 to 2023 of over 88% of the number of organizations deploying software more than once a week. This adds an increased dimension to the AppSec practitioner: they not only need to deal with more vulnerabilities than ever, and codebases larger than ever as we saw before, but they also need to deal with deployments faster than ever as well. So they have less time to assess the code quality in order to not slow down this fast deployment pipeline!</p><h3>But we have an increased workforce… Right?</h3><p>So far, we proved that the number of vulnerabilities grew, that there are more code changes to analyze than ever and that organizations are deploying to production on an increased rate. The impact of all these changes could be minimized, however, if we had more people working at protecting these applications.</p><p>Trying to get good data, however, on how much the Cyber Security job market grew, let alone the AppSec market did, in the last few years, proved itself as a tough question to answer. Getting this data for the American market, however, turned out to be easier. Using the website <a href="https://www.cyberseek.org/heatmap.html">CyberSeek</a> as reference, I captured the data and plotted the following chart, that includes both openings and filled positions in the Cyber Security job market in the USA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mj3cVyga9rTO2g_R_FDbbQ.png" /><figcaption>Graphical representation of the number of Cyber Security positions in the USA from 2020 onwards.</figcaption></figure><p>Unfortunetally, and as probably one would expect, the Cyber Security job market, at least in the US, only grew less than 10% from 2020 to 2023. Of course these aren&#39;t global numbers, but I believe it&#39;s a good representation of the global growth.</p><p>Nevertheless, that means that number of people working on the securing applications everywhere didn&#39;t grow as fast as the number of vulnerabilities.</p><h3>Conclusion</h3><p>When I set out to answer the question if there were more published vulnerabilities today than ever before, I must confess that I expected the answer to be &quot;of course yes&quot;. But I wanted to be sure. As we saw, that&#39;s exactly what happened. But we couldn&#39;t stop there, we had to understand the why.</p><p>As we saw, developers are pushing code more frequently than ever as well, while organizations are maturing their development processes to also deploy these changes in a frequency that just a few years ago would be unimaginable to most.</p><p>All this means that we need to be smarter. Trying to deal with this influx of vulnerabilities at the speed of DevOps doesn&#39;t allow us to use the same processes and tools that we have been using so far. In part 2 of this article, we will discuss how modern tools like SCA, EPPS and diverse techniques can help us minimize the impact of the growth of vulnerabilities and of deployment speed in our AppSec programs.</p><p>Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d770244a9f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get to know your AWS Managed Policies]]></title>
            <link>https://raphabot.medium.com/get-to-know-your-aws-managed-policies-83d0a8971b20?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/83d0a8971b20</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-iam]]></category>
            <category><![CDATA[iam-policy]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-managed-policies]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 01:36:49 GMT</pubDate>
            <atom:updated>2022-09-30T01:36:49.707Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understand what an AWS Managed Policy is and how a simple step can ensure you are using the appropriate one for your need</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aV48-pZsawAut6vqIjpqbg.png" /><figcaption>&quot;A studio photo of an IT professional wondering while facing their computer&quot; according to DALL-E</figcaption></figure><p>Have you ever googled <em>AWS managed policies list</em>? What about <em>AWSLambdaExecute statements</em>? Recently, once again, I found myself in a similar situation.</p><p>But let&#39;s start from the beginning.</p><h4>What is an AWS Managed Policy?</h4><p>From its <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html">documentation</a>:</p><blockquote>An <em>AWS managed policy</em> is a standalone policy that is created and administered by AWS. <em>Standalone policy</em> means that the policy has its own Amazon Resource Name (ARN) that includes the policy name. (…) AWS managed policies are designed to provide permissions for many common use cases. (…) AWS managed policies make it easier for you to assign appropriate permissions to users, groups, and roles than if you had to write the policies yourself.</blockquote><p>In short, it is a special kind of IAM Policy that is curated and maintained by AWS and enables you to move faster, focusing more on your code and less about permission, leaving the latter to the pros at AWS.</p><p>But how do you know if the service you are working with has a managed policy that you can use for your benefit?</p><h4>Service Specific Managed Policies</h4><p>Reading the documentation, of course! Let&#39;s say the service in question here is AWS Lambda. A quick google search reveals the &quot;Identity-based IAM policies for Lambda&quot; <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-identity-based.html">page</a>. There, as you can see below, three different managed policies are suggested:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oqgzm6QgTAoMe1sYu84qhQ.png" /></figure><p>Let&#39;s say you now need to use Amazon Polly so your awesome bot can have an Alexa-like voice. Again, a quick search will take you to <a href="https://docs.aws.amazon.com/polly/latest/dg/security_iam_id-based-policy-examples.html">its documentation</a>, which lists two managed policies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aG2wi-w-nUbHvRW_gBrp_Q.png" /></figure><p>Let&#39;s move to something more complex and powerful, like theAWS Systems Manager, a service so comprehensive that it almost feels like multiple services in one. Googling will show you there are multiple SSM related AWS Managed Policies to use. What are the statements of <strong>AmazonSSMPatchAssociation </strong>for instance?</p><h4>You don&#39;t need to exercise your Google-fu</h4><p>If you know what managed policy you need more information on, you are good: an AWS CLI is all you need. And a bit of copying and paste.</p><p>First you run aws iam get-policy --policy-arn arn:aws:iam::aws:policy/AmazonSSMPatchAssociation. See the below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99d6e5f109362cee8fafa84233592060/href">https://medium.com/media/99d6e5f109362cee8fafa84233592060/href</a></iframe><p>Take note of the DefaultVersionId value, v1 in this example. Now, we run aws iam get-policy-version --policy-arn arn:aws:iam::aws:policy/AmazonSSMPatchAssociation --version-id v1:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc78ab0940f86db63f8bddf9a7104111/href">https://medium.com/media/bc78ab0940f86db63f8bddf9a7104111/href</a></iframe><p>Now we have what we were looking for, the Managed Policy statements. With that information in hand, we can make an informed decision aboutthis Policy matches the use case requirements.</p><h3>Pro Tip</h3><p>If you do that enough, this can quickly become a tedious process. So let&#39;s fix that. Below you can find a Bash function that takes an AWS Managed Policy name as a parameter and outputs all the information that you might need.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b1862401295e64c52edfc94046b9643/href">https://medium.com/media/6b1862401295e64c52edfc94046b9643/href</a></iframe><p>Another possible solution is to get access to all (currently) 973 AWS Managed Policies. The GitHub user <a href="https://github.com/gene1wood">Gene Wood</a> was nice enough to write a <a href="https://gist.github.com/gene1wood/55b358748be3c314f956">gist</a> with that list and the code he used to generate it. He also provided us with his code on how he generated it.</p><p>There is a problem, though. AWS is always releasing new services and features and this list was last updated almost 3 years ago. How can one have an always up-to-date list of all AWS Managed Policies and all of its statements?</p><h4>Search No More</h4><p>So I don&#39;t go over this pain again, and so others can also avoid it, I hacked together a simple website that, once a day, updates istself to make sure you have an accessible and updated list of all AWS Managed Policies right from your browser.</p><p>Introducing… <a href="https://awsmanagedpolicies.io">awsmanagedpolicies.io</a>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KXgEojzdcy1xpgSEr3HVqA.png" /></figure><p><a href="https://awsmanagedpolicies.io">awsmanagedpolicies.io</a> is a simple-to-use, always up-to-date, accessible site that lists all of the AWS Managed Policies in a simple way, with a simple-but-it-works search bar to filter down the list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kr65_mm_xCu0RRu2kjUKNg.png" /></figure><p>If you click any of the entries, it expands to show you the definition of said AWS Managed Policy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7uwzXezgjGj57UJWjlgLqA.png" /></figure><p>If you just need a JSON file that always has the most recent list of AWS Managed Policies and its definitions you can bookmark this <a href="https://awsmanagedpolicies.io/aws-managed-policies.json">link</a> instead!</p><h4>Architecture</h4><p>Of course, this website is 100% built on top of AWS and 100% Serverless! Its infrastructure was defined using CDK (TypeScript), and it contains, among other things, a lambda to fetch the latest AWS Managed Policies, an S3 Bucket to host the files, and a CloudFront distribution to serve the content to you.</p><p>As soon as I publish its code on GitHub and write an article on how was it to develop the site and how it works, I&#39;ll update this article with the links.</p><h3>Conclusion</h3><p>AWS Managed Policies are a great way to kick start your newest project. However, always make sure you are using the appropriate one. The best way to do it is verifying its statements via CLI or through the website <a href="https://awsmanagedpolicies.io">awsmangedpolicies.io</a>.</p><h4>Full Disclosure</h4><p>I decided to finally buy the domain, finalize the website, and write this article a few days ago. I started this project a year and half ago, give or take. Little did I know that today, there is an amazing solution to this problem, created by the AWS Hero <a href="https://aws.amazon.com/developer/community/heroes/ian-mckay/">Ian Mckay</a>, called <a href="https://aws.permissions.cloud">aws.permissions.cloud</a>.</p><p>I highly recommend going to his site if you need more information than just a list of the AWS Managed Policies and their definitions, but also metrics like how many AWS Managed Policies are there, if a policy might expose a resource to the public, etc.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83d0a8971b20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Hit AWS Step Functions Limitations…]]></title>
            <link>https://medium.com/better-programming/how-to-hit-aws-step-functions-limitations-b4c413da10e4?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4c413da10e4</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[step-functions]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Fri, 03 Jun 2022 13:36:15 GMT</pubDate>
            <atom:updated>2023-05-23T19:14:23.291Z</atom:updated>
            <content:encoded><![CDATA[<h4>…and how to overcome them.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AeimeawVViv4wk1aPIpZQ.jpeg" /></figure><p>This is part two of a two-part series of my learnings as a first-time user of AWS Step Functions. You can find the part one <a href="https://raphabot.medium.com/how-to-use-and-not-use-aws-step-functions-9fe6a93fa59e?source=friends_link&amp;sk=b2a202d0ff9d3a08e30a8b5c68925b07">here</a>.</p><h4>TL;DR</h4><p>I was able to implement a better architecture for my application and make it work. Until it didn&#39;t with buckets that had enough objects because I wrote a bad recursion. Fixing that, I realized AWS Step Functions and Lambda have yet another limitation that I wasn&#39;t aware of. But I got it fixed.</p><p>Curious? Keep reading.</p><h4>Introduction</h4><p>After hearing the feedback of a few readers from the last article, and finally having some spare time on hand, I finally set myself to try and implement a proper solution for my challenge. As a refresher, I had a lambda that would run for too long and, as a consequence, would time out fairly often depending on the input. It was a prime candidate for me to implement the same logic using AWS Step Functions — and a great excuse to finally use the service.</p><h4>Revisiting the Proposed Architecture</h4><p>What I had in mind by the end of the last article was to create an architecture similar to the one below, where I have 2 different workflows in AWS Step Functions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*NrZO152vfhyqveObHnEHqQ.png" /><figcaption>The architecture proposed in the previous article.</figcaption></figure><p>The first one, list all objects inside a bucket. Then, for every hundred objects, it would invoke the second workflow. Then, the second workflow would generate a pre-signed URL for each of the objects in the input array, and push it to a queue.</p><p>However, when I started to implement it, I decided to go with a different approach. There would still be two Workflows, but they would work slightly differently than originally proposed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*r3F9n72cpGDe8csuqORzPw.png" /><figcaption>First Workflow: Starter</figcaption></figure><p>Above you can see the first workflow. It is quite simple, actually. I call it the Starter workflow, since it’s the first one to run, and all it does is list all keys in a bucket. Then it starts the second workflow using this array with all keys as input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*9EBwGSSiqfG57odm8RgA9w.png" /><figcaption>Second Workflow: The loop.</figcaption></figure><p>This is where things get interesting. To avoid running into the previous problem of reaching the maximum number of historical events (see the <a href="https://raphabot.medium.com/how-to-use-and-not-use-aws-step-functions-9fe6a93fa59e?source=friends_link&amp;sk=b2a202d0ff9d3a08e30a8b5c68925b07">first article</a>). The first step of this Workflow is to select the (up to) first 500 keys in the original array because I know I won’t run into this problem with that many keys from previous tests.</p><p>Then, in parallel, two distinct logics are executed. On the left side of the diagram, for each of the up to 500 keys, we have exactly what we had before: a lambda that takes the key generates a pre-signed URL, and pushes it to a queue. On the right side, there is a Choice State that checks if the original array, minus the 500 keys that are being processed, still has any keys left. If there isn’t, that’s pretty much it. However, if there are, it will execute this second workflow all over again for the remaining keys. All that means this won’t ever hit the historical events limit and, as a bonus, there is a lot of concurrency going on, speeding up the process.</p><p>After some time trying to implement the two new workflows, I went over some challenges, such as getting the Choice State wrong and getting the workflow to <strong>always</strong> call itself again, getting the recursion of the State Machine into an infinite loop. But, after some coding, and a few more mistakes, I got it done.</p><h4>I did it! Or did I?</h4><p>That was it. I did it. I was excited that I finally did it. I right away sent my code to <a href="https://medium.com/@devsecguy">Felipe</a>, a friend that has a big interest in this, to have him test it in his account, so I can be sure I won&#39;t run into a new take on the old classic: &quot;But it runs on my AWS account!&quot;</p><p>But I did. It didn&#39;t work in his account.</p><p>I knew there were more objects in the bucket he used for testing the code than I had on mine, but I couldn’t understand why it would not work. After all, my new Step Functions filters just the first 500 keys to work with and that was the only issue I found beforehand. When troubleshooting the execution, I realized the second workflow was never triggered, so the problem was in my simple lambda to list all the keys.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b62bba791fe1f2410d718920df990123/href">https://medium.com/media/b62bba791fe1f2410d718920df990123/href</a></iframe><p>The code is fairly straightforward, but I did something wrong here. I used recursion poorly. As I mentioned in the previous article, each API call returns a page with a thousand objects. If I need more, I need to make the same call, passing the previous call’s NextContinuationToken as the ContinuationToken parameter. So I was calling the function over and over again, stacking them on each other and… for a bucket with enough objects, using all the memory allocated to my Lambda function, which was blocking it from moving along.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/41a7ffdf6e86b62799fa0a7ab1b27161/href">https://medium.com/media/41a7ffdf6e86b62799fa0a7ab1b27161/href</a></iframe><p>After changing the original code to the above, I removed the recursion and Felipe tested it again. And this time it didn&#39;t fail! At least not because the function was using all the memory available…</p><h4><strong>Yet another limitation</strong></h4><p>There I was finding yet another limitation. Both <a href="https://aws.amazon.com/about-aws/whats-new/2020/09/aws-step-functions-increases-payload-size-to-256kb/">Step Functions</a> and <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html">Lambda</a> (for asynchronous requests) have a limit of 256Kb for their payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-Gmcu-39vD1burVb00ajlw.jpeg" /><figcaption>This payload is too big for this lambda function</figcaption></figure><p>The array of keys generated by the Function had so many keys that it was bigger than 256KB, breaking the continuity of the workflow. Again, just like all of my challenges so far, that’s on me. RTFM.</p><p>AWS has a recommendation for Step Functions that require passing large payloads around. Just don’t. Instead, <a href="https://docs.aws.amazon.com/step-functions/latest/dg/avoid-exec-failures.html">AWS recommends using S3</a> to save the payload and pass the object arn around for the next step in the workflow to read the payload from there. I quickly changed my code to use this approach and, finally, the code works as expected!</p><h3>Conclusion</h3><p>I learned so much getting this code to a state that I am comfortable sharing it with my peers, but I also wasted a good amount of time just because I decided to do it instead of first reading at least a bit of the service documentation.</p><p>I still highly recommend using AWS Step Functions IF you are comfortable with these limitations and the workarounds to make your code work and maintain it long-term. I also recommend reading its <a href="https://docs.aws.amazon.com/step-functions/latest/dg/sfn-best-practices.html">best practices</a> before you attempt writing your first line of code. Also, as I was writing this article, AWS released a <a href="https://catalog.workshops.aws/stepfunctions/en-US/">Step Functions workshop</a> that looks really promising.</p><p>Are you feeling more comfortable with AWS Step Functions after this 2 part series? Are you ready to start using it or do you think you should just use Lambda? Let me know in the comments session!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4c413da10e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/how-to-hit-aws-step-functions-limitations-b4c413da10e4">How to Hit AWS Step Functions Limitations…</a> was originally published in <a href="https://betterprogramming.pub">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use, and NOT use, AWS Step Functions]]></title>
            <link>https://awstip.com/how-to-use-and-not-use-aws-step-functions-9fe6a93fa59e?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe6a93fa59e</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-step-functions]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[challenge]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Fri, 20 May 2022 02:59:50 GMT</pubDate>
            <atom:updated>2022-07-22T22:10:05.822Z</atom:updated>
            <content:encoded><![CDATA[<h4>TL;DR</h4><p>I had a problem with a Lambda Function timing out and decided to give AWS Functions a spin to solve my problem. I found an incredible service, but also hit some limitations, that you might hit one day as well.</p><p>Curious? Keep reading.</p><h4>Introduction</h4><p>Just recently I found the perfect excuse to finally try out Step Functions beyond running some kind of Hello World. Trend Micro, the company that I work for, has a pretty interesting solution called Cloud One File Storage Security, or FSS for short. This is a technology that scans S3 objects for malware as soon as they hit the bucket. Then, it allows you to do anything with that scan result downstream, from tagging as malicious to promoting the clean files to a different bucket. In summary, a great security tool for a builder to have in hand when there is a need to answer about compliance.</p><p>However, many customers aren&#39;t builders and just want to answer a simple, yet hard-to-answer question: &quot;Is there any malware in my S3 buckets right now?&quot;. The usual answer has been &quot;Simple! Move/copy all your objects from one bucket to another, so a scan is triggered and an answer is given.&quot;. Sure, it works, but it&#39;s far from great. Then we have a problem: <strong>how to scan every single object in a bucket without asking the customer to move objects around?</strong></p><h4>My original approach</h4><p>FSS works in a really neat way, and you can read more about its architecture in its <a href="https://cloudone.trendmicro.com/docs/file-storage-security/arch-overview-aws/">public docs</a>. The key part to understand is that there is an AWS Lambda Function that keeps listening for S3:ObjectCreated in a specific bucket. Whenever an object is uploaded to this bucket, triggering said event, the function is invoked, creating a <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html">pre signed URL</a> for the new object and sending it to a &quot;Scan queue&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*b9gFFKL0V6Y10OSWEfnPwA.png" /><figcaption>Oversimplified FSS Architecture</figcaption></figure><p>So my solution to the problem was darn simple: let me write some code that loops through all the objects in the bucket and, for each, it pretty much does the same thing: creates a pre signed URL and pushes it to the SQS queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*ebbNgKMZUrnM_Lx6ElizZw.png" /></figure><p>Problem solved, <em>it worked beautifully</em>. however, some users started to report that many files would remain unscanned. After quick troubleshooting, it was easy to find the issue. It turns out the function was timing out, despite setting the function timeout to 15 minutes, AWS Lambda&#39;s highest limit. The process of generating a pre signed URL and pushing a message to the queue takes a few seconds per object, and when there are a few hundreds of them, it&#39;s easy math to see that 15 minutes aren&#39;t enough.</p><h4>Rearchitecting for AWS Step Functions</h4><p>If you are not familiar with AWS Step Functions, it &quot;<em>is a low-code, </em><strong><em>visual</em></strong><em> </em><strong><em>workflow service</em></strong><em> that developers use to build </em><strong><em>distributed applications</em></strong><em>, </em><strong><em>automate</em></strong><em> IT and business processes, and </em><strong><em>build</em></strong><em> data and machine learning </em><strong><em>pipelines</em></strong><em> using AWS services. </em><strong><em>Workflows</em></strong><em> manage failures, retries, </em><strong><em>parallelization</em></strong><em>, </em><strong><em>service integrations</em></strong><em>, and observability so developers can focus on higher-value business logic.</em>&quot;, all <a href="https://aws.amazon.com/step-functions/">according to AWS itself</a>. The highlighted parts were on me, exactly to highlight how perfect this service would be for my use case. I can decouple the logic of my one lambda that often times out, first listing the bucket objects and <em>then</em> distributing the result of that to parallel function executions that will, each, generate a pre signed URL for one object and send it to the queue.</p><p>It gets better. Relatively recently, AWS Step Functions released a pretty neat feature, the possibility of integrating directly to other services <strong>without writing any code</strong>. I can have my workflow list all the objects in the bucket and return me an array, again, all without writing any code.</p><p>After dragging a few blocks and trimming down my code to work for just one object, a process that took me just a few minutes, my new application was ready. I was in awe of how easy it was.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*kONKWgO_vDZtnMBLbYuerw.png" /><figcaption>The Workflow for my new bucket scanner.</figcaption></figure><p>To my surprise, it just worked. And it was fast, way faster than what I had previously. But the title of this article is about how to also NOT use AWS Step Functions, so you can imagine where this is going… I had a problem.</p><p>This time, to take no chances, I tested my code not with a few hundred objects, but with thousands instead. If you are familiar with AWS APIs, or pretty much any API for that matter, you must be familiar with the concept of pagination (if you are not, there is <a href="https://medium.com/@JohanneA/api-101-lowering-the-load-with-pagination-969e5e00cd08">this easy to read article</a> by developer <a href="https://www.linkedin.com/in/johanne-andersen-3aaa8a135/">Johanne Andersen</a>), and calling the S3 API through a Workflow is no different -it first returns the first page (duh), which is limited to 1k objects. The problem is the fact that <strong>there is no way to paginate further using the service</strong>! Meaning, that in my case, I was able to start a scan for only the first thousand objects, nothing else. After some research, I found out that even AWS Hero <a href="https://www.linkedin.com/in/benbridts/">Ben Bridts</a> <a href="https://twitter.com/benbridts/status/1453243318180188174">added support for pagination in his wishlist for the service</a>, so I&#39;m not the only one missing the feature.</p><h4>Dropping Direct Service Integration</h4><p>AWS Step Functions was so easy to work with, and a big improvement from my original implementation, that I decided to stick with it, changing the approach slightly. Instead of using the integrated API call provided by the service, I came to the brilliant idea of writing my own lambda function to just return the list of objects, paginating through all of them. AWS&#39; SDK is nice enough that automates the pagination on my behalf, making writing this code fairly easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*okp2gJOlbfYHCTsw5mCJtg.png" /><figcaption>Second attempt.</figcaption></figure><p>Again, it was surprisingly easy to change my workflow to work this way. And, right away, I could see that the first step was returning the bucket&#39;s entire list of objects. <em>It is going to work</em>. A few thousands of objects into the &quot;For each object&quot; map, the workflow stopped with a fail:</p><pre>The execution reached the maximum number of history events (25000).</pre><p><em>What does that even mean?</em> It looks like, each workflow execution has a <strong>hard quota</strong> of 25 thousand entries in the execution history, and there is no escaping that. At least not an escape that is as simple as using AWS Step Functions itself. The <a href="https://docs.aws.amazon.com/step-functions/latest/dg/bp-history-limit.html">documentation</a> suggests implementing a pattern that uses an AWS Lambda function that can start a new execution of the state machine to split ongoing work across multiple workflow executions. So I can&#39;t go beyond the few thousand objects without rearchitecting the workflow.</p><h4>Conclusion</h4><p>AWS Step Functions is a brilliant, easy-to-use, low learning curve service and the fact that I went over challenges that I had aren&#39;t an indication that I don&#39;t recommend its usage, because I do. I started using it before first trying to understand its limitations and hit some of them, but even then I drastically improved the readability, performance, and overall capability of my code in a short amount of time.</p><p>By the way, If you are as curious as I am and want to know how I solved this problem, the answer is that I haven&#39;t yet. Whenever I have some throughput, the architecture that I want to follow looks similar to the one below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*NrZO152vfhyqveObHnEHqQ.png" /><figcaption>Propose Workflows to solve the original problem</figcaption></figure><p>I believe the proposed architecture would avoid both the pagination and historical events limitations. In the meantime, however, to make sure Trend customers can run a full scan of their buckets, I wrote a Python script that runs locally on their computer, really similar to the first AWS Function flow that I presented.</p><p>Have you ever had a similar challenge? Have you ever used AWS Step Functions or are you a guru already? What do you think of my proposed solution? I&#39;d love to hear more!</p><p><em>Note:</em> About not being able to paginate over the API results using the AWS Step Functions service integrations, the cloud engineer <a href="https://www.linkedin.com/in/thomas-laue-51585b199/">Thomas Laue</a> <a href="https://twitter.com/th_laue/status/1521921916952629248?s=20&amp;t=lzUci7BRK_00USF3tz6VUg">pointed me</a> to a <a href="https://www.linkedin.com/in/steven-smiley/">Steven Smiley</a> <a href="https://dev.to/stevensmiley/handling-paginated-api-responses-in-aws-step-functions-1emf?utm_source=newsletter&amp;utm_medium=email&amp;utm_content=offbynone&amp;utm_campaign=Off-by-none:%20Issue%20%23181">article</a> that goes over how to handle the pagination inside of the workflow.</p><h4>Update</h4><p>I published a follow up to this story right <a href="https://raphabot.medium.com/how-to-hit-aws-step-functions-limitations-b4c413da10e4">here</a>, where I go over the new approach and other limits that I hit in AWS Step Functions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe6a93fa59e" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/how-to-use-and-not-use-aws-step-functions-9fe6a93fa59e">How to use, and NOT use, AWS Step Functions</a> was originally published in <a href="https://awstip.com">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Tips to Kick Start Your Cloud Career]]></title>
            <link>https://raphabot.medium.com/10-tips-to-kick-start-your-cloud-career-ebedcc58be08?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebedcc58be08</guid>
            <category><![CDATA[community]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[community-cloud]]></category>
            <category><![CDATA[career-development]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 21:01:25 GMT</pubDate>
            <atom:updated>2021-06-14T21:01:25.379Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Skycrafters insights on how to start your cloud career sooner than later</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogBi_ZuGEMf9vWWe6epsPQ.png" /><figcaption>The cloud career winding road</figcaption></figure><p>Are you ready to join the Cloud Computing market? It doesn&#39;t matter if you are new to IT, or if you are coming from the datacenter world, here you can find a few tips that I put together. You don&#39;t need to trust me though, as this is a compilation of a chunk of the collective knowledge of the Skycrafters community — and more details on what Skycrafters is, later, because being aware of it is a great tip on its own.</p><h3>1 — How Certifications are Perceived 👀</h3><p>Of course, first, we are going to debate certification. After all, it usually is a common target for those new to a space to get to learn more about it.</p><p>There is a long debate in our forum about <a href="https://community.skycrafters.io/t/certifications/87">whether or not you should pursue certification</a> as part of your cloud career roadmap. Based in the discussion, it’ s clear that holding a certification doesn’t necessarily show that you are really knowledgeable in the content on itself, but it for sure shows eagerness to learn. It’s common sense that certifications are no substitute to hands-on experience, but the goal of achieving one might be a great way to motivate yourself to learn a new skill — and also a great way to open doors.</p><p>Keep in mind that a certification won’t necessarily make your resume shine brighter than others, but it might actually be a requirement for the role. Watch out, though. If you start to collect certifications, don’t share them all publicly, like in an email signature or LinkedIn, as it might come off as bragging!</p><h3>2- Preparing yourself for the Certification Exam 📚</h3><p>No we go to step 2. Once you have decided to pursue a certification, you’ll have countless hours of study ahead of you and a training will come in hand to give some structure around it. An interesting question, also <a href="https://community.skycrafters.io/t/is-online-training-a-good-option/225">previously discussed by Skycrafters</a>, if if there is any difference between taking your training in person or online. With some parts of the world slowly going back to business as usual (as much as possible), in person learning is now, once again, a possibility. But remote training is always available, no matter where you are! Which one works best for you? Let’s go over some of the pros and cons of each.</p><h3>Online 💻</h3><p><strong>Pros👍:</strong></p><ul><li>Being able to playback content faster or slower depending on familiarity with the topic</li><li>Easier, since it can be done from anywhere</li><li>Sometimes, free</li></ul><p><strong>Cons👎:</strong></p><ul><li>Easy to have your mind wandering to something else (after all, your Slack and phone are right there!)</li><li>The loneliness of not having someone to discuss the coursework with on a daily basis</li></ul><h3>In Person 👩‍🏫</h3><p><strong>Pros👍:</strong></p><ul><li>Closeness to other people to exchange ideas and thoughts</li><li>A live instructor to consult with in real time</li></ul><p><strong>Cons👎:</strong></p><ul><li>Harder to deal with boring topics/classes</li><li>Usually more expensive</li></ul><p>Which one is the best? This is a personal choice based on how you value each of the bullet points above. I’d personally pick in person training anytime, because I get easily distrac… Sorry, I was checking my phone. Where were we again?</p><h3>3- Be aware of vendor lock-in in the Cloud 🔒</h3><p>I personally think this tipo really interesting. As someone that is learning a new technology, especially if you are aiming at a particular certification, it’s easy to get 100% focused in just one Cloud Service Provider for a while, like AWS for instance, and that’s fine. Most cloud concepts are interchangeable between providers. To prove the point, you can even check official Azure documentation <a href="https://docs.microsoft.com/en-us/azure/architecture/aws-professional/services">on how their services compare to AWS’</a>.</p><p>Just make sure you don’t ignore that there are other options in the market, which have the potential to perform better for particular use cases than your provider of choice. Companies know that, which leads us to the next tip…</p><h3>4- The dream of cloud-agnostic 💭</h3><p>Cloud-agnostic. You are going to hear this term a lot over your cloud career. However, the story isn’t as simple as most like to paint. Vendor lock-in is a true challenge that the <a href="https://community.skycrafters.io/t/vendor-lock-in-and-the-cloud/146">Skycrafters community has been discussing</a>, and, to many, it’s simply a pipe dream. A dream because a truly cloud-agnostic environment would be able to run on any provider’s environment, or even locally to your computer/data center/cloud. A true cloud-agnostic architecture has the potential to enable organizations to pursue lower costs, faster time to market, access to state-of-the-art technologies and avoidance of the issue mentioned in the previous tip, lock-in. However, there are benefits beyond the technical, like a “get out of jail card” in case your current vendor becomes a competitor in your space with a brand new service release.</p><p>Skycrafters consider It a dream, however, because it can be expensive — in different ways — to run and operate such a particular workload. If you try to escape from using Amazon SQS, for instance, you might want to leverage open-source solutions like RabbitMQ, which is awesome! However, now you and your team need to deploy and maintain a new stack of the platform that isn’t directly delivering value to your customers. Cloud computing is all about taking the most of the <a href="https://aws.amazon.com/compliance/shared-responsibility-model/">Shared Responsibility Model</a>, and running your own infrastructure services isn’t the way to maximize it.</p><h3>5- Kubernetes to the rescue? ⛴</h3><p>Kubernetes is viewed as a way to minimize vendor lock in through its open architecture. It can take servers, no matter if running on AWS, Azure, GCP, on premises, etc., and transform them in computing capacity for this big cluster running spread across all of them. But it isn’t a bed of roses either, according to those that have experience on it. Running it yourself can be really painful, and exactly why most providers also offer their own flavor of Kubernetes-as-a-Service. But wouldn’t using it make you go back to the lock-in stage? Don’t use it just because it’s a hot topic, as many do. If you ever learn and use it, make sure it’s a solution that tackles your pains and solve your challenge.</p><p>The goal here is to make clear you understand you shouldn’t create a vendor–lock-in situation for yourself. Make sure you don’t just understand how to use your provider of choice services, but also the reasoning behind it and its concepts.</p><h3>6- Infrastructure as Code 📄</h3><p>Now that you dominated all the cloud knowledge you were seeking and learned all the cool stuff that your cloud provider of choice has to offer (this was a joke, you won’t ever know it all and that’s fine!), you also need to learn that you rarely are going to use its dashboard to build anything for real. The dashboard is great for labs, tests, demos or to learn something new, but not for production environment. Production environment requires predictability, agility, consistency, minimization of risk and reproducibility. If you try a thousand times to create a simple S3 bucket in AWS via its dashboard, it’s almost guaranteed that you are going to make a mistake at least once and, even if you nailed it, it would take you a lot of time. Hence, Infrastructure as Code(IaC).</p><p>IaC is a way to describe your infrastructure as, you guessed it, code. As much as software is defined in lines of code, so is the infrastructure. You can write code that can define a thousand different S3 buckets and, as you execute it, you would reliable and quickly have a thousand buckets. No mistakes made.</p><p>To give you an better idea on what an IaC would look like, here’s a quick example:</p><pre>Resources: <br>  S3Bucket: <br>    Type: &#39;AWS::S3::Bucket&#39; <br>    Properties: <br>      BucketName: MY-REALLY-COOL-BUCKET</pre><p>As <a href="https://community.skycrafters.io/t/the-state-of-azure-iac/163?u=raphabot">our members previously discussed</a>, there are a lot of different IaC flavors, some native, some open-source, some multi-cloud. To name a few that you might want to check out, we have:</p><ul><li>CloudFormation — AWS Native and YAML/JSON based</li><li>Azure Resource Manager(ARM) — Azure native and it has its own DSL (Domain-Specific Language)</li><li>Terraform — Open-source, multi-cloud and it uses its own DSL</li><li>CDK — Newer AWS native offering that is open-source and you can code using your favorite programming language</li><li>Bicep– Newer Azure native offering that is open-source and has its own DSL</li><li>Pulumi — New open-source offering, that is multi-cloud and can code using your favorite programming language</li></ul><p>And since IaC is easily replicable, you can take your time to build one really well crafted and documented template and reuse it across your projects, organization, and even publicly share with other members of the community! Which brings us to the next tip…</p><h3>7- Best practices in the cloud ✅</h3><p>This is another great <a href="https://community.skycrafters.io/t/understanding-best-practices-when-building-in-the-cloud/181">topic our members are discussing</a>. Building confidently in the cloud can be challenging. Often, we use a technology and find out later that we could have been using it better. There are hundreds of different ways to build in the cloud using the providers’ services. And, despite the default configuration for many of them being “good enough”, “good enough” often times doesn’t cut it.</p><p>That’s exactly why many providers offer their set of best practices, usually called Well Architected Framework, or WAF for short. Taking AWS as example here, <a href="https://aws.amazon.com/architecture/well-architected/">their WAF</a> is divided in five pillars: Cost Optimization, Operational Excellence, Security, Performance and Reliability. Each pillar has their own set of white papers that explain thoroughly how to achieve the state-of-the-art usage of their services, while understanding the balance between the five pillars.</p><p>As it can take a while to build well-architected architectures for your projects, the combination of WAF with IaC is really powerful. Whenever you write your own IaC templates that build well-architected architectures, you can reuse them across your applications, saving time and bringing your environment to the forefront of what the cloud providers can offer.</p><h3>8- Hybrid Cloud ☁️</h3><p>Hybrid cloud is a really hot topic right next to multi-cloud that our <a href="https://community.skycrafters.io/t/hybrid-cloud-adoption/242?u=raphabot">community is debating</a>. First, let’s take NIST’s definition for it:</p><blockquote>The cloud infrastructure is a composition of two or more distinct cloud infrastructures (private, community, or public) that remain unique entities, but are bound together by standardized or proprietary technology that enables data and application portability (e.g., cloud bursting for load balancing between clouds).</blockquote><p>Although NIST’s cloud computing definition is taken as the de facto way to describe it, the hybrid cloud approach is mostly used when there is a combination of one or more public providers <strong>and</strong> a private cloud to support an organization IT needs.</p><p>This is particularly interesting for organizations that have restrictions on how they process certain types of data, like banks. This allows them to leverage the public cloud to easily and cheaply scale as needed while maintaining the costumer’s data local to their data center.</p><p>It’s important to note, however, that being able to pull this kind of scenario off is really challenging, since it can be particularly hard to separate the data access through Identity Access Management across clouds. Also, dedicated links between the provider data center and your organization can be necessary because of the latency introduced by internet access, and they can be quite expensive.</p><h3>9- Complement your studies with Podcasts 🎧</h3><p>This is probably the easiest and funniest tip. You probably can’t spend the entire day studying, at least I’m sure I can’t. At some point you are going to find yourself doing something manual and boring that doesn’t take much of your brain power. Riding the subway or driving a car to the office (remember those?) is a good example, but it might also be cleaning your place or mowing the lawn, it doesn’t matter. This is the perfect time to expand your cloud skills by listening to a good podcast. <a href="https://community.skycrafters.io/t/what-podcasts-have-you-been-listening-to/235">Our members have compiled a good set of podcasts</a> that I’m happy to share with you here:</p><ul><li>Screaming in the Cloud, by Corey Quinn</li><li>The Idealcast with Gene Kim</li><li>Talking Serverless, by Ryan Jones</li><li>The New Stack Makers, by The New Stack</li><li>Mik + One, by Dr. Mik Kersten</li><li>Girls In Tech podcast</li><li>Blinkist</li><li>Cloud Security Podcast</li></ul><p>Keep in mind that not all of them are necessarily cloud related, but they might help you develop other skills and ares of expertise to help you in your cloud career. After all, technical ins’t binary and the cloud space isn’t just for those in the far–right spectrum of it.</p><h3>10- Skycrafters are here to help❤️</h3><p>Cloud computing can get challenging really quickly, but it can also be exciting and fun. Especially, when you have a number of peers to work and innovate with. It doesn’t matter if you are a seasoned cloud practitioner, or if you are just starting out, <a href="https://community.skycrafters.io">Skycrafters</a> can be a place for you to network, find answers quickly and bounce ideas off other members while learning in the process.</p><p>Skycrafters is home of great curated content, amazing open-source code to use or contribute to, and a safe place where I hope you can grow your cloud career and skills.</p><p>What are you waiting for? Skycrafters is 100% free, no gimmicks, and joining it can be a stepping stone for your cloud career and those around you.</p><p><em>A version of this post was originally posted at: </em><a href="https://skycrafters.io/blog/2021/06/01/kick-starting-your-cloud-career/"><em>https://skycrafters.io/blog/2021/06/01/kick-starting-your-cloud-career/</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebedcc58be08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon AppFlow — How to Leverage It]]></title>
            <link>https://raphabot.medium.com/amazon-appflow-how-to-leverage-it-e2b4555ce258?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2b4555ce258</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-one]]></category>
            <category><![CDATA[flow-apps]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 03:47:54 GMT</pubDate>
            <atom:updated>2020-04-29T13:46:49.562Z</atom:updated>
            <content:encoded><![CDATA[<h3>Extra! Extra! Amazon AppFlow is Released</h3><h4>Have you heard about Amazon AppFlow? It’s a brand new service from AWS that allows you to easily integrate SaaS applications such as SalesForce and Marketo to AWS services, such as S3 or Snowflake.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*S2yFxapYZqnickjGrfXD7Q.png" /><figcaption>Look: Amazon AppFlow logo!</figcaption></figure><p>Yet another day, yet another new AWS release. Even on challenging times with the current Covid-19 pandemic still slowing the global economy down, AWS shows that it is on full-throttle mode and released a new service last week called Amazon AppFlow.</p><h3>What is it?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Lgc4OFMRg5BqTN9m.png" /><figcaption>Quick summary on how Amazon AppFlow works.</figcaption></figure><p>Pretty much paraphrasing the announcement, Amazon AppFlow is a fully managed integration service that enables you to securely transfer data between Software-as-a-Service (SaaS) applications and AWS services, in just a few clicks. As pretty much everything else on AWS, with AppFlow, you can run data flows at nearly any scale at the frequency you choose, paying just for flow run and data processed, with no upfront charges. For those that are security-aware (if you aren&#39;t, you should!), AppFlow automatically encrypts data in motion.</p><h3>…and what does it mean?</h3><p>It means 0-time invested to learn both the source&#39;s and destination&#39;s API. With a few clicks you can, for instance, backup all customer support cases from SalesForce to S3 on a weekly basis or daily push a list of new Leads from Marketo to AWS SnowFlake, allowing your team to quickly understand your leads behavior, all with no coding required.</p><p>But since I said that you should be security-aware, you might be thinking… &quot;Can I leverage that for security purposes?&quot; Yes! You can leverage this non-security related service to help you with your security.</p><h3>Using it for Security</h3><p>Trend Micro is the only Security vendor to be an AppFlow launch partner, which allows AWS and Trend Micro Cloud One customers to create AppFlow flows using Workload Security data as input, easily moving data from this security service to different destinations.</p><p>OK. AppFlow looks cool. The SalesForce and Marketo examples look cool. Having a security vendor like Trend Micro being a launch partner also looks cool. But how to use it?</p><h3>Let&#39;s get our hands dirty</h3><p>Of course, being the technical-curious person that I am, reading the release notes and examples are definitely not enough. I need to get my hands dirty. So, feel free to follow me on this journey.</p><h4>Creating our First Flow</h4><p>First, of course, let&#39;s hit the AppFlow dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7Lct6J_4l4xUfIrUbFiNA.png" /><figcaption>Amazon AppFlow dashboard</figcaption></figure><p>If we click the bright orange &quot;Create flow&quot; button, we will be taken to the first step on creating our first flow. For this flow, I decided the name would be &quot;CloudOneWorkloadSecurity-Computers&quot; and I moved to the next step, without setting any of the optional settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0a80Ntq8OIP7JGroQXrHpA.png" /><figcaption>Step 1. Really easy so far.</figcaption></figure><p>On Step 2 we can see exactly where AppFlow shines. I picked Trend Micro as Source and all it requires to be able to fetch data from Cloud One is an API secret. Again, no coding required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*WtjGBBHdt2aTS96P8EE3mg.png" /><figcaption>Did you expect to see my API secret here?</figcaption></figure><p>As soon as I add my API secret, AppFlow presented me with the different object options that it can retrieve from Cloud One. For launch, only &quot;Computers&quot; and &quot;Policies&quot; are available, as you can see below, but we should expect to see more options later down the road.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fucB4y8raJWNjD7I5BOkNw.png" /><figcaption>Object options</figcaption></figure><p>Then I picked &quot;Amazon S3&quot; as my destination, deciding on my bucket and a prefix to the objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZAuVuWDIlne_F3FzYW0H3w.png" /><figcaption>Step 2. Still easy!</figcaption></figure><p>Now we move to Step 3. Clicking on the drop-down &quot;Choose source fields&quot;, we can decide on which fields we care about for this flow. I clicked first on &quot;Map all fields directly&quot;, but because Cloud One is so thorough, I quickly realized it had way more information than I needed for this use case. So I selected only the 9 fields that I care about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJTxSohL4neg3P4tfGZiUQ.png" /><figcaption>1, 2, 3… 9 fields!</figcaption></figure><p>On the following step, I could pick to run the flow on demand or to set a schedule for it. I decided, for this example, to run it daily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_EHHbcp3F6L6C2BNZV3wQ.png" /><figcaption>Step 4. I can&#39;t believe it is that easy.</figcaption></figure><p>And that&#39;s it. The flow is ready to be used. And so I did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITEcY6ldkDXaIr02QH_pqA.png" /><figcaption>Done!</figcaption></figure><p>In a little bit over 10 seconds, AppFlow fetched my Computers info from Cloud One Workload Security and dumped to a S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7etR9cd1_U-qJTNxIdmOQ.png" /><figcaption>Details on the flow execution.</figcaption></figure><p>Clicking the &quot;View data&quot; link, it takes me straight to the bucket, where I can see the lonely file there. Downloading it shows me exactly what I expected, information taken straight from Cloud One.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SWsX3LqAnZuk3b9gKPV7OQ.png" /><figcaption>Data straight from Cloud One</figcaption></figure><h3>Houston, we have a problem…</h3><p>There is a problem with that, though… There isn&#39;t a ton of value on this flow on itself, plus, my hands didn&#39;t get that dirty. If you just wanted to know what AppFlow is and how to use it, the article ends here for you. Thanks for stopping by! If you, like myself, like to get your hands dirty, let&#39;s move to the next stage.</p><h3>Working with the data</h3><p>After the daily run of this flow, I want to work with the generated data — automatically, as soon as it hits the S3 bucket. The idea is to go trough the generated data, process it and write to another bucket. For this example, I decided to daily generate a JSON compatible array of computers that the current state is different from &quot;active&quot;, which means they probably have some kind of connectivity issues with the Cloud One manager. The final result is something similar to the diagram below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2auubHKrE0cq0wsvnoIS3g.png" /><figcaption>The diagram below.</figcaption></figure><p>Before we go any further, it&#39;s important to note that the project — which has its code available on <a href="https://github.com/raphabot/AppFlowWorkloadSecurityDemo">my GitHub</a> — has its infrastructure built using AWS CDK (Typescript), while the Lambda code was built using JavaScript. If you are not familiar with CDK, I highly recommend the <a href="https://cdkworkshop.com/">CDK Workshop</a> documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yFZehxeYxr3SJcNtLkPzA.png" /><figcaption>CDK stack code.</figcaption></figure><p>The code above describes the project infrastructure, generating a CloudFormation stack with a destination S3 bucket, a Lambda function and the proper permissions. Since I wanted to trigger this Lambda as soon as the source bucket received the data, I tried for a while to add this trigger to the code with no success; until I remembered, of course, that I wouldn&#39;t be able to do it — CloudFormation doesn&#39;t support adding event triggers to existing buckets.</p><p>After creating the infrastructure, I went ahead and coded the last missing piece: the Lambda itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NBjhm_Hjj2yBEMgCJ2T80g.png" /><figcaption>The Lambda function code</figcaption></figure><p>The code is pretty straight forward. First, it downloads the newly added data to the Lambda execution environment. Then, it works the data. Since the original file has a JSON-described computer per line instead of an array of objects, I trimmed the file (to remove any white spaces from the end of it) and split it into an array of strings. Since each string represents an object, I mapped the array to return the objects that each string represents and, then, filtered out all objects where the state is active, since they are not relevant for us. Finally, all the non-active computers were written to the destination bucket.</p><p>After deploying the above stack, the last step is to manually connect the source bucket to it. Go to the bucket properties, click on Events and create a &quot;All object create events&quot; notification to it. Make sure to select the newly created Lambda to receive the notification. Now, for every AppFlow run, this lambda will also be triggered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdOu59rFyh6zVugmcQ_acw.png" /><figcaption>Bucket Events.</figcaption></figure><p>If you run the flow manually again to test the environment, you should see a new file on your new bucket, listing only the Cloud One computers that currently aren&#39;t on &quot;active&quot; state.</p><h3><strong>Resources:</strong></h3><p>[1] <a href="https://aws.amazon.com/new/">https://aws.amazon.com/new/</a></p><p>[2] <a href="https://aws.amazon.com/blogs/aws/new-announcing-amazon-appflow/">https://aws.amazon.com/blogs/aws/new-announcing-amazon-appflow/</a></p><p><a href="https://docs.aws.amazon.com/appflow/latest/userguide/what-is-appflow.html">[3] https://docs.aws.amazon.com/appflow/latest/userguide/what-is-appflow.html</a></p><p>[4] <a href="https://blog.trendmicro.com/trend-micro-integrates-with-amazon-appflow/">https://blog.trendmicro.com/trend-micro-integrates-with-amazon-appflow/</a></p><p>[5] <a href="https://github.com/raphabot/AppFlowWorkloadSecurityDemo">https://github.com/raphabot/AppFlowWorkloadSecurityDemo</a></p><p>[6] <a href="https://cdkworkshop.com">https://cdkworkshop.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2b4555ce258" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shift Well-Architecture Left. By Extension, Security Will Follow]]></title>
            <link>https://raphabot.medium.com/shift-well-architecture-left-by-extension-security-will-follow-9012168b56e8?source=rss-94534226a645------2</link>
            <guid isPermaLink="false">https://medium.com/p/9012168b56e8</guid>
            <category><![CDATA[cloud-misconfiguration]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[compliance]]></category>
            <category><![CDATA[well-architected]]></category>
            <category><![CDATA[shiftleft]]></category>
            <dc:creator><![CDATA[Raphael Bottino]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 16:58:14 GMT</pubDate>
            <atom:updated>2020-04-13T22:04:11.428Z</atom:updated>
            <content:encoded><![CDATA[<h4>A story on how Infrastructure as Code can be your ally on Well-Architecting and securing your Cloud environment</h4><p>Using Infrastructure as Code(IaC for short) is the norm in the Cloud. CloudFormation, CDK, Terraform, Serverless Framework, ARM… the options are endless! And they are so many just because IaC makes total sense! It allows Architects and DevOps engineers to version the application infrastructure as much as the developers are already versioning the code. So any bad change, no matter if on the application code or infrastructure, can be easily inspected or, even better, rolled back.</p><p>For the rest of this article, let&#39;s use CloudFormation as reference. And, if you are new to IaC, check how to create a new S3 bucket on AWS as code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f635e6744cf32313846ab1fd7762bcf/href">https://medium.com/media/3f635e6744cf32313846ab1fd7762bcf/href</a></iframe><p>Pretty simple, right? And you can easily create as many buckets as you need using the above template (if you plan to do so, remove the BucketName line, since names are globally unique on S3!). For sure, way simpler and less prone to human error than clicking a bunch of buttons on AWS console or running commands on CLI.</p><h3>Well, it&#39;s not that simple…</h3><p>Although this is a functional and useful CloudFormation template, following correctly all its rules, it doesn&#39;t follow the rules of something bigger and more important: The AWS Well-Architected Framework. This amazing tool is a set of whitepapers describing how to architect on top of AWS, from 5 different views, called Pillars: Security, Cost Optimization, Operational Excellence, Reliability and Performance Efficiency. As you can see from the pillar names, an architecture that follows it will be more secure, cheaper, easier to operate, more reliable and with better performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vS0Y6Et8JFI7UcbaEZGKcg.png" /><figcaption>The 5 Well-Architect Framework Pillars</figcaption></figure><p>Among others, this template will generate a S3 bucket that doesn&#39;t have encryption enabled, doesn&#39;t enforce said encryption and doesn&#39;t log any kind of access to it–all recommended by the Well-Architected Framework. Even worse, these misconfigurations are really hard to catch in production and not visibly alerted by AWS. Even the great security tools provided by them such as Trusted Advisor or Security Hub won&#39;t give an easy-to-spot list of buckets with those misconfigurations. Not for nothing Gartner states that 95% of cloud security failures will be the customer’s fault¹.</p><p>The DevOps movement brought to the masses a methodology of failing fast, which is not exactly compatible with the above scenario where a failure many times is just found out whenever unencrypted data is leaked or the access log is required. The question is, then, how to improve it? Spoiler alert: the answer lies on the IaC itself :)</p><h3>Shifting Left</h3><p>Even before making sure a CloudFormation template is following AWS&#39; own best practices, the first obvious requirement is to make sure that the template is valid. A fantastic open-source tool called cfn-lint is made available by AWS on GitHub² and can be easily adopted on any CI/CD pipeline, failing the build if the template is not valid, saving precious time. To shorten the feedback loop even further and fail even faster, the same tool can be adopted on the developer IDE³ as an extension so the template can be validated as it is coded. Pretty cool, right? But it still doesn&#39;t help us with the misconfiguration problem that we created with that really simple template in the beginning of this post.</p><p>Conformity⁴ provides, among other capabilities, an API endpoint to scan CloudFormation templates against the Well-Architected Framework, and that&#39;s exactly how I know that template is not adhering to its best practices. This API can be implemented on your pipeline, just like the cfn-lint. However, I wanted to move this check further left, just like the cfn-lint extension I mentioned before.</p><h3>The Cloud Conformity Template Scanner Extension</h3><p>With that challenge in mind, but also with the need for scanning my templates for misconfigurations fast myself, I came up with a Visual Studio Code extension that, leveraging Conformity&#39;s API, allows the developer to scan the template as it is coded. The Extension can be found <a href="https://marketplace.visualstudio.com/items?itemName=raphaelbottino.cc-template-scanner">here</a>⁵ or searching for &quot;Conformity&quot; on your IDE.</p><p>After installing it, scanning a template is as easy as running a command on VS Code. Below it is running for our template example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZlhTtWHwnAiRIU_kxE1Y8w.gif" /></figure><p>This tool allows anyone to shift misconfiguration and compliance checking as left as possible, right on developers&#39; hands. To use the extension, you&#39;ll need a Conformity API key. If you don&#39;t have one and want to try it out, Conformity provides a 14-day free trial, no credit card required. If you like it but feels that this time period is not enough for you, let me know and I&#39;ll try to make it available to you.</p><h3>But… What about my bucket template?</h3><p>Oh, by the way, if you are wondering how a S3 bucket CloudFormation template looks like when following the best practices, take a look:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e74aa265a60d66b8e8f2a0b2cac208f/href">https://medium.com/media/4e74aa265a60d66b8e8f2a0b2cac208f/href</a></iframe><p>Not as simple, right? That&#39;s exactly why this kind of tool is really powerful, allowing developers to learn as they code and organizations to fail the deployment of any resource that goes against the AWS recommendations.</p><h3>References</h3><p>[1] <a href="https://www.gartner.com/smarterwithgartner/why-cloud-security-is-everyones-business">https://www.gartner.com/smarterwithgartner/why-cloud-security-is-everyones-business</a></p><p>[2] <a href="https://github.com/aws-cloudformation/cfn-python-lint">https://github.com/aws-cloudformation/cfn-python-lint</a></p><p>[3] <a href="https://marketplace.visualstudio.com/items?itemName=kddejong.vscode-cfn-lint">https://marketplace.visualstudio.com/items?itemName=kddejong.vscode-cfn-lint</a></p><p>[4] <a href="https://www.cloudconformity.com/">https://www.cloudconformity.com/</a></p><p>[5] <a href="https://marketplace.visualstudio.com/items?itemName=raphaelbottino.cc-template-scanner">https://marketplace.visualstudio.com/items?itemName=raphaelbottino.cc-template-scanner</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9012168b56e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>