<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chad Sigler</title>
    <description>The latest articles on DEV Community by Chad Sigler (@chadtsigler).</description>
    <link>https://dev.to/chadtsigler</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F247221%2Ff084979a-5df5-483c-9711-e4a71336584f.jpg</url>
      <title>DEV Community: Chad Sigler</title>
      <link>https://dev.to/chadtsigler</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chadtsigler"/>
    <language>en</language>
    <item>
      <title>Secure Ninja Forms in Wordpress</title>
      <dc:creator>Chad Sigler</dc:creator>
      <pubDate>Wed, 29 Jan 2020 22:25:19 +0000</pubDate>
      <link>https://dev.to/chadtsigler/secure-ninja-forms-in-wordpress-3m2m</link>
      <guid>https://dev.to/chadtsigler/secure-ninja-forms-in-wordpress-3m2m</guid>
      <description>&lt;p&gt;Secure WordPress Ninja Form Submissions using the Virtru SDK&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A5hyVNHSCji0o6sre" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A5hyVNHSCji0o6sre"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@webaroo?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Webaroo.com.au&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome back to the Virtru Technology Blog! Today I will be sharing an idea that came from our digital marketer, Osman Sheikh (&lt;a href="https://twitter.com/Osmanify" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;| &lt;a href="https://medium.com/@osmnshkh" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;). For our 2nd Annual &lt;a href="https://www.virtru.com/blog/virtru-hackathon-2019/." rel="noopener noreferrer"&gt;Virtru Hackathon&lt;/a&gt;, he suggested using the &lt;a href="https://developer.virtru.com" rel="noopener noreferrer"&gt;Virtru Developer Platform&lt;/a&gt; to encrypt content on Ninja Forms, a popular WordPress plugin. In his own words:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As a digital marketer for Virtru, I have a love-hate relationship with &lt;a href="https://wordpress.com/" rel="noopener noreferrer"&gt;Wordpress&lt;/a&gt;. I have fond memories of building my first website on Wordpress.com, then moving to a self-hosted version after I managed to convince my parents that this whole internet thing wasn’t a fad. Since then I’ve built everything from personal websites to blogs to eCommerce sites for employers. I’ve also built plugins to enhance WordPress functionality.&lt;/p&gt;

&lt;p&gt;The reason I love Wordpress is the same reason I hate it. It’s an easy-to-use platform where marketers and developers alike can build simple websites in no time at all. It’s simplicity also means that plugins are required for any advanced functionality. While Wordpress is pretty secure out of the box, plugins can be created and published by anyone rendering your site and the data you collect insecure. Additionally, plugin overload can result in a bloated, slow and insecure site.&lt;/p&gt;

&lt;p&gt;We should build a simple solution in JavaScript that encrypts data collected by Ninja Form’s Wordpress plugin before it is exposed to insecure plugins or multi-tenant servers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Protect Form Data at Creation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the most common WordPress attack vectors is form plugins. Most of them leave you exposed because they all have the same level of access, resulting in open season on the data collected by your site and its forms. Healthcare companies or nonprofits (with minimal IT resources) that want to collect customer data online without risking data loss, compliance violations, or site performance are limited in their options today.&lt;/p&gt;

&lt;p&gt;The goal of this project is to extend the &lt;a href="https://ninjaforms.com/" rel="noopener noreferrer"&gt;Ninja Forms&lt;/a&gt; extension using the &lt;a href="https://docs.developer.virtru.com/js/latest/" rel="noopener noreferrer"&gt;Virtru JavaScript SDK&lt;/a&gt; to encrypt the form data. The data should be encrypted client-side and the submitter should be the owner. This ensures the data is never exposed server-side to insecure plugins or &lt;a href="https://ninjaforms.com/docs/ninja-forms-secure/" rel="noopener noreferrer"&gt;multi-tenant servers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Requirements&lt;/li&gt;
&lt;li&gt;Features&lt;/li&gt;
&lt;li&gt;Installation&lt;/li&gt;
&lt;li&gt;End-User Experience&lt;/li&gt;
&lt;li&gt;Admin Management&lt;/li&gt;
&lt;li&gt;Authentication and Authorization&lt;/li&gt;
&lt;li&gt;Code&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Requirements &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The latest version of &lt;a href="https://wordpress.com" rel="noopener noreferrer"&gt;WordPress&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ninjaforms.com/docs/add-on-manager/" rel="noopener noreferrer"&gt;Ninja Forms Plugin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/virtru/wordpress-ninjaforms-secure" rel="noopener noreferrer"&gt;Virtru Ninja Forms Plugin Extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Email assigned to “WordPress Site Administrator”&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Features &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  User Features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Virtru Encrypted Form submissions&lt;/li&gt;
&lt;li&gt;Site admin added to encryption policies&lt;/li&gt;
&lt;li&gt;Virtru Policy Manage Page&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Admin Features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Admin Authentication&lt;/li&gt;
&lt;li&gt;View Virtru Encrypted Data&lt;/li&gt;
&lt;li&gt;View Virtru Encryption Policy&lt;/li&gt;
&lt;li&gt;View Encryption Policy Admin&lt;/li&gt;
&lt;li&gt;Encrypted Export&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Installation &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://virtruprivacy.wistia.com/medias/td2j6qwufy?wvideo=td2j6qwufy" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fembedwistia-a.akamaihd.net%2Fdeliveries%2F4969251828b71c47f7c4d496e6736d4480ab4ef9.jpg%3Fimage_play_button_size%3D2x%26image_crop_resized%3D960x540%26image_play_button%3D1%26image_play_button_color%3D54bbffe0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Install
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Log in to WordPress as the Admin&lt;/li&gt;
&lt;li&gt;Install and Activate Ninja Forms&lt;/li&gt;
&lt;li&gt;Install and Activate Virtru for Ninja Forms&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Secure Form
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Create a Ninja Form&lt;/li&gt;
&lt;li&gt;Add Ninja Form to a Post&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  End-User Experience &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://virtruprivacy.wistia.com/medias/h4h9il9a29?wvideo=h4h9il9a29" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fembedwistia-a.akamaihd.net%2Fdeliveries%2Ff51ed4e4553cb2e976c961d0c585a9249c8fdd65.jpg%3Fimage_play_button_size%3D2x%26image_crop_resized%3D960x709%26image_play_button%3D1%26image_play_button_color%3D54bbffe0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Form Usage
&lt;/h4&gt;

&lt;p&gt;The user experience of Virtru + Ninja Forms is unchanged until the user clicks the submit button. When the user clicks submit, the data is caught by the Virtru extension. Virtru requires the data owner (form submitter) to authenticate the first time a user submits data. Once the data is encrypted, it is passed back to Ninja Forms for final processing and storage. The data is never left unencrypted on a server. When the submission is complete, the user is notified and offered a link to the policy management area.&lt;/p&gt;

&lt;h4&gt;
  
  
  Policy Management
&lt;/h4&gt;

&lt;p&gt;The Policy Management area of the Virtru extension allows a user to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Users to a policy&lt;/li&gt;
&lt;li&gt;Remove Users from a policy&lt;/li&gt;
&lt;li&gt;Revoke policy&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Admin Management &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://virtruprivacy.wistia.com/medias/kicr4oo9js?wvideo=kicr4oo9js" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fembedwistia-a.akamaihd.net%2Fdeliveries%2Fb9aeeb110d477e03a89dbf8e1cfabcc06d2a874c.jpg%3Fimage_play_button_size%3D2x%26image_crop_resized%3D960x540%26image_play_button%3D1%26image_play_button_color%3D54bbffe0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Authenticate
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;em&gt;NF Virtru Plugin&lt;/em&gt; tab&lt;/li&gt;
&lt;li&gt;Follow steps to activate&lt;/li&gt;
&lt;li&gt;The admin can view Virtru Encrypted submitted data&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  View Submissions
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Ninja Forms Tab&lt;/li&gt;
&lt;li&gt;Navigate to the Submissions Area&lt;/li&gt;
&lt;li&gt;Select the appropriate form&lt;/li&gt;
&lt;li&gt;Click Edit on the appropriate record&lt;/li&gt;
&lt;li&gt;Click Decrypt to view the unencrypted submissions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication and Authorization &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Why Authenticate?
&lt;/h4&gt;

&lt;p&gt;The Virtru encryption policy controls who has access to the keys and policy ownership requires authentication. All policies are owned by the policy creator, the submitter. This means the submitter alone has access to add and remove people from the policy. To be active in the Virtru system, a user must be authenticated to ensure they are who they say they are.&lt;/p&gt;

&lt;h4&gt;
  
  
  Who Owns the Data?
&lt;/h4&gt;

&lt;p&gt;For this implementation, the form submitter owns the data. This means that the submitter can always revoke their data via the policy management page. The data owner can also add and remove people from the policy.&lt;/p&gt;

&lt;h4&gt;
  
  
  Who Can Access the Data?
&lt;/h4&gt;

&lt;p&gt;To ensure the data submitted can be used by the site, the site “Administration Email Address” is added to the security policy. The Administration Email Address is the email address located under &lt;strong&gt;&lt;em&gt;Settings -&amp;gt; General.&lt;/em&gt;&lt;/strong&gt; The Administration Email Address can only view the data and cannot modify the policy. In the extension’s current state, the exported data stays encrypted. The only time the Site Admin can view the unencrypted data is from the record edit area of Ninja Forms.&lt;/p&gt;

&lt;h4&gt;
  
  
  Who Accessed the Data?
&lt;/h4&gt;

&lt;p&gt;The &lt;a href="https://developer.virtru.com/docs/architecture#section-audit-access-over-time" rel="noopener noreferrer"&gt;Virtru Audit Log&lt;/a&gt; tracks all access and modifications to the Virtru Policy giving the data owner complete visibility. This information enables the data owner to take action by adding or removing users and revoking access to the policy.&lt;/p&gt;

&lt;h3&gt;
  
  
  To the Code &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Form Submission Hook
&lt;/h4&gt;

&lt;p&gt;To encrypt the form data, we must intercept the request prior to Ninja Forms storing the form data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$.ajaxSetup({
        beforeSend: ajaxBeforeSend
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once caught, the settings object is inspected for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nf_ajax_submit&lt;/li&gt;
&lt;li&gt;isEncrypted: false&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the settings match, then the data object is encrypted and passed back to Ninja Forms for storage. The encryption flow operates as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authenticate against Virtru&lt;/li&gt;
&lt;li&gt;Create Virtru client&lt;/li&gt;
&lt;li&gt;Create encrypt options&lt;/li&gt;
&lt;li&gt;Encrypt&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;p&gt;I decided to leverage the Virtru Auth Widget to ensure authentication against the Virtru SaaS worked as expected and with minimal effort. Using the Virtru Auth Widget was as easy as adding a couple of lines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wp\_enqueue\_script(‘auth-widget’, ‘https://sdk.virtru.com/js/latest/auth-widget/index.js', array(), false, true);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can use the Auth widget. We need to create an element in the DOM where we will mount the widget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div id=”[UNIQUE\_ID]”&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then run code for the widget mounting&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Virtru.AuthWidget(‘[UNIQUE\_ID]’, {OPTIONS});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the second parameter, we can pass the options object. We pass in the &lt;em&gt;afterAuth&lt;/em&gt; method. This method will be triggered after the user successfully authenticates with Virtru.&lt;/p&gt;

&lt;h4&gt;
  
  
  Decrypt Form Data
&lt;/h4&gt;

&lt;p&gt;When an admin opens a submission we can detect encrypted parts by the custom span we added during encryption. We use a similar flow for encryption:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authenticate against Virtru&lt;/li&gt;
&lt;li&gt;Create Virtru client&lt;/li&gt;
&lt;li&gt;Create decrypt options&lt;/li&gt;
&lt;li&gt;Decrypt&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ninja Forms plugin initializes Backbone during the work. So we can use Backbone listeners to detect rendering forms view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jQuery(document).ready(($) =&amp;gt; {
    const nfRadio = Backbone.Radio;
    const radioChannel = nfRadio.channel( 'file\_upload' );
    const uploadController = Marionette.Object.extend({
        initialize: function () {
            this.listenTo(radioChannel, 'render:view',
                this.updateFileUpload);
        },
        updateFileUpload: function (view) {
            const $file = $( view.el ).find( '.nf-element' );
            $file.fileupload({
                submit: function(e, data) {
                    if (!data.isEncrypted) {
                        e.preventDefault();
                        [MOUNT\_ENCRYPT\_APP]
                    }
                }
            });
        }
    });
    new uploadController();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Encrypt Form Data
&lt;/h4&gt;

&lt;p&gt;Encryption looks very similar to decryption except that we return an HTML file. Why HTML? It’s simple to share across different platforms and easy for anyone to open in the &lt;a href="https://secure.virtru.com/secure-reader" rel="noopener noreferrer"&gt;Virtru Secure Reader&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const encryptedBuffer = await encryptedData.toBuffer();
const blobFile = new Blob([encryptedBuffer], {type: ‘text/html’});
const File = new File([blobFile], `${file.name}.tdf.html`, {type: “text/html”});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Manage Policy
&lt;/h3&gt;

&lt;p&gt;To make this extension useful for users and admins alike, we created a policy management page for both parties. We used React to build the policy management page. It includes the following functionality:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Encrypting data&lt;/li&gt;
&lt;li&gt;Decrypting data&lt;/li&gt;
&lt;li&gt;Adding/removing users&lt;/li&gt;
&lt;li&gt;Downloading files&lt;/li&gt;
&lt;li&gt;Revoking policy&lt;/li&gt;
&lt;li&gt;Audit log
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const policy = await client.fetchPolicy(policyId);
const updatedPolicy = policy.builder()
    .addUsersWithAccess(recipientEmail)
    .build();
await client.updatePolicy(newPolicy);
await client.revokePolicy(policyId);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Integrations always look easy from the outside, until you dig in. Starting with a fantastic Extension, Ninja Forms was the way to go. Leveraging their great documentation and large active community made the integration as painless as possible. The encryption portion was super easy as the widgets and encrypt/decrypt calls are very straight forward. By using this Virtru &lt;a href="https://github.com/virtru/wordpress-ninjaforms-secure" rel="noopener noreferrer"&gt;project&lt;/a&gt;, WordPress Administrators can secure their client’s most sensitive data with confidence.&lt;/p&gt;




</description>
      <category>wordpressplugins</category>
      <category>virtru</category>
      <category>encryption</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Lock Your Door and Close Your Windows</title>
      <dc:creator>Chad Sigler</dc:creator>
      <pubDate>Wed, 23 Oct 2019 20:51:00 +0000</pubDate>
      <link>https://dev.to/chadtsigler/lock-your-door-and-close-your-windows-390c</link>
      <guid>https://dev.to/chadtsigler/lock-your-door-and-close-your-windows-390c</guid>
      <description>&lt;p&gt;&lt;em&gt;Securing Application Data in S3 using the Virtru SDK&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F7654%2F0%2Av1Peoa713_68Nps0" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F7654%2F0%2Av1Peoa713_68Nps0" title="Photo by Fanny Rascle on Unsplash" alt="Photo by Fanny Rascle on Unsplash"&gt;&lt;/a&gt;&lt;br&gt;
Photo by Fanny Rascle on Unsplash&lt;/p&gt;

&lt;p&gt;Hello and welcome to this, my first blog post. This topic is near and dear to my heart, from my personal experiences with data leakage from human error. Let’s dive into protecting application data using the Virtru SDK.&lt;/p&gt;
&lt;h1&gt;
  
  
  A Common Customer Concern
&lt;/h1&gt;

&lt;p&gt;Many of our customers develop custom applications that store, receive, or share sensitive data, they have concerns that AWS and S3 are a possible large surface area of attack. The larger the application and the more teams involved, the more chances for errors to be introduced. The errors may be as minuscule as misspellings in the UI, up to a configuration error on the S3 bucket. While the misspelling of a label won’t necessarily result in data loss, an S3 bucket misconfiguration can be both damaging and expensive, which was the case for companies like &lt;a href="https://www.securityweek.com/magecart-hackers-infect-17000-domains-insecure-s3-buckets" rel="noopener noreferrer"&gt;British Airways&lt;/a&gt; and TicketMaster. Many of our developer end users express concern about maintaining security and control of their data while working in a cloud environment. I recently worked with Sam, a full-stack developer at a web service company, to help secure their data throughout the data lifecycle.&lt;/p&gt;
&lt;h1&gt;
  
  
  Business Problem
&lt;/h1&gt;

&lt;p&gt;Sam was tasked with gathering customer information in an online form, including what would be considered personally-identifying information (PII). He has control over the application and to some extent the environment in which the application runs.&lt;/p&gt;

&lt;p&gt;Sam’s corporate business requirements included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using server/services provisioned by the Corporate Hosting Team&lt;/li&gt;
&lt;li&gt;Using S3 for client application data managed by the Corporate Storage Team&lt;/li&gt;
&lt;li&gt;Web application with a Javascript frontend and Python backend&lt;/li&gt;
&lt;li&gt;Standard development timeline (too short!)
Ensuring the security of his client’s data is now at the top of his list of personal requirements for the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, Sam noted the following personal requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure customer data is secure&lt;/li&gt;
&lt;li&gt;Minimize integration headaches&lt;/li&gt;
&lt;li&gt;Make the approach repeatable&lt;/li&gt;
&lt;li&gt;Boto for the S3 integration&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Minimizing Security Risk
&lt;/h1&gt;

&lt;p&gt;Sam’s company requires the use of TLS and &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html" rel="noopener noreferrer"&gt;"at rest encryption"&lt;/a&gt; in the S3 buckets. As the developer, he does not have control over the S3 bucket ACL and encryption keys. AWS offers native security features that his client utilizes but Sam would like to add a layer of data protection to ensure that his customer’s confidence and trust are not betrayed.&lt;/p&gt;

&lt;p&gt;The Virtru SDK provides Sam the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SaaS Infrastructure — Completely managed&lt;/li&gt;
&lt;li&gt;Key Management — Completely managed&lt;/li&gt;
&lt;li&gt;Access Control — Simple policy interface to add and remove access&lt;/li&gt;
&lt;li&gt;Audit Logs — Access to all actions taken on secured files&lt;/li&gt;
&lt;li&gt;Easy Integration — Few lines of code to get it running&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Using Virtru SDK with S3
&lt;/h1&gt;

&lt;p&gt;Per the company business policy, Sam is required to use &lt;a href="https://github.com/boto/boto3" rel="noopener noreferrer"&gt;Boto3&lt;/a&gt; to perform any S3 calls as it has been approved by their security team. Sam was able to add Virtru to his application by simply replacing his calls to &lt;a href="https://github.com/boto/boto3" rel="noopener noreferrer"&gt;Boto3&lt;/a&gt; with &lt;a href="https://github.com/virtru/virtru-sdk-python-samples/tree/master/virtru-boto3" rel="noopener noreferrer"&gt;Virtru Boto3&lt;/a&gt;. It was done with very little effort because the Virtru Boto3 wrapper code is open source and the calls were straight-forward and available on &lt;a href="https://github.com/virtru/virtru-sdk-python-sample/tree/master/virtru-boto3" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;
  
  
  Examples
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/virtru/virtru-sdk-python-samples/tree/master/virtru-boto3" rel="noopener noreferrer"&gt;Virtru Boto3 Github Repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upload and Encrypt&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;virtru_upload_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;local_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                   &lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                   &lt;span class="n"&gt;s3_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                   &lt;span class="n"&gt;is_virtru_encrypt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                   &lt;span class="n"&gt;virtru_owner&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;virtru_owner&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Download and Decrypt&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;virtru_download_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                     &lt;span class="n"&gt;s3_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                     &lt;span class="n"&gt;local_file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                     &lt;span class="n"&gt;virtru_owner&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Adding Policy Controls
&lt;/h1&gt;

&lt;p&gt;Sam or another designated administrator can manage Virtru encrypted files and policies in the future by storing attributes in their application database.&lt;br&gt;
Fields Stored:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Virtru Policy Id
Once these attributes are stored, Sam can:&lt;/li&gt;
&lt;li&gt;Revoke access to the policies; reverse that revocation if needed.&lt;/li&gt;
&lt;li&gt;View audit records associated with a file&lt;/li&gt;
&lt;li&gt;Add and remove users from the policy&lt;/li&gt;
&lt;li&gt;Add and remove auto-expiration from the policy&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Security Incident Response
&lt;/h1&gt;

&lt;p&gt;The Security Team reached out to Sam about a potential security incident. Some of the corporate S3 buckets were not configured correctly, which led to possible data exposure. One of the exposed buckets contained the data from Sam’s application. Sam was able to revoke access to all files until the security team researched the incident and gave the ‘all clear’. Because Sam was able to provide the security team with an audit log showing who tried to access the file and when; the security team was assured that there were no decrypt requests.&lt;/p&gt;

&lt;h1&gt;
  
  
  About Me
&lt;/h1&gt;

&lt;p&gt;As a software engineer at Virtru, I am part of a team that works with customers to discover and develop new use cases for our Data Privacy Platform and recently released SDKs. Our developer platform is built on our SaaS Key and Policy Infrastructure to support data security using the open standard &lt;a href="https://developer.virtru.com/docs/tdf-overview" rel="noopener noreferrer"&gt;TDF3&lt;/a&gt;, audit, and control.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>virtru</category>
    </item>
  </channel>
</rss>
