<?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: Jonathan BROSSARD</title>
    <description>The latest articles on DEV Community by Jonathan BROSSARD (@monisnapjonathan).</description>
    <link>https://dev.to/monisnapjonathan</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%2F162089%2F865c9afd-ad9b-4b99-a68e-e7bf8e1c0252.png</url>
      <title>DEV Community: Jonathan BROSSARD</title>
      <link>https://dev.to/monisnapjonathan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/monisnapjonathan"/>
    <language>en</language>
    <item>
      <title>Hide your f🤬🤬king API keys and credentials from versioned code</title>
      <dc:creator>Jonathan BROSSARD</dc:creator>
      <pubDate>Fri, 24 Jan 2020 11:09:02 +0000</pubDate>
      <link>https://dev.to/monisnap/hide-your-f-king-api-keys-and-credentials-from-versioned-code-183p</link>
      <guid>https://dev.to/monisnap/hide-your-f-king-api-keys-and-credentials-from-versioned-code-183p</guid>
      <description>&lt;p&gt;As a developer, you deal every day with API keys, passwords, credentials, tokens etc... and you &lt;strong&gt;do NOT&lt;/strong&gt; want to share them. &lt;/p&gt;

&lt;p&gt;Here are the different ways to handle them : &lt;/p&gt;

&lt;p&gt;1 - A versioned settings file with secrets in it. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;If you do that, please continue to read this post, internets need that.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/d10dMmzqCYqQ0/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/d10dMmzqCYqQ0/giphy.gif" width="400" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 - A non versioned settings file. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;Better ! But when you'll onboard developers, it will be funny to check how you'll send them these values.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/B37cYPCruqwwg/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/B37cYPCruqwwg/giphy.gif" width="200" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3 - Environments variables (the classic &lt;strong&gt;&lt;em&gt;.env&lt;/em&gt;&lt;/strong&gt;) ! &lt;br&gt;
&lt;strong&gt;&lt;em&gt;Yeah ! Even better. Once again, how your future team members will have their own, by copy pasting yours ?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/5wWf7H89PisM6An8UAU/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/5wWf7H89PisM6An8UAU/giphy.gif" width="443" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4 - Store your secret into a secret management service !!!&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Yeah ! OK, let's see how to do so&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/lMVNl6XxTvXgs/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/lMVNl6XxTvXgs/giphy.gif" width="320" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several secrets management tools, but, I'll talk about the one I know best, because this is the one we're using at &lt;a href="https://www.monisnap.com"&gt;Monisnap&lt;/a&gt; : &lt;strong&gt;AWS Secret Manager&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is AWS Secret Manager ?
&lt;/h3&gt;

&lt;p&gt;AWS Secrets Manager is a secrets management service which enables you to easily rotate, manage, and retrieve credentials, API keys, or other secrets. &lt;br&gt;
Using Secrets Manager, you can secure, audit, and manage secrets used to access your resources.  &lt;/p&gt;

&lt;p&gt;You'll now be able to share your code (every file, every line), without any fear. Indeed, in your code, there will only be specific strings which describes your secrets, but not the secrets values themself.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before Secrets Manager&lt;/th&gt;
&lt;th&gt;After Secrets Manager&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;db-name.cluster-cifkjshyfli1p.eu-west-2.rds.amazonaws.com.&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DB_HOST&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;username&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DB_USER&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;password&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DB_PASSWORD&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;AWS Secrets Manager automatically &lt;strong&gt;rotates&lt;/strong&gt; your secrets. Your teammates or anyone else who clone/fork your code &lt;strong&gt;can have access without any knowledge&lt;/strong&gt; on what are the secrets values. &lt;/p&gt;

&lt;p&gt;You only need to manage ACL via AWS IAM.&lt;/p&gt;

&lt;p&gt;And so, for instance, your seniors developers can have access through their IAM roles and create/edit/update/delete new secrets, and interns can't.&lt;/p&gt;
&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;p&gt;For every AWS Cloud based infrastructure, all you need to do is to grant access to the secrets.&lt;/p&gt;

&lt;p&gt;Our MicroServices infrastructure is built on Serverless lambdas functions, so we just have to add the rights IAM roles to our lambdas.&lt;/p&gt;

&lt;p&gt;Also, you can easily split them by environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;aws&lt;/span&gt;
  &lt;span class="nx"&gt;runtime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;nodejs10&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;
  &lt;span class="nx"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nl"&gt;region&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;eu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;west&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;

  &lt;span class="nx"&gt;iamRoleStatements&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Role&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;using&lt;/span&gt; &lt;span class="nx"&gt;AWS&lt;/span&gt; &lt;span class="nx"&gt;Secret&lt;/span&gt; &lt;span class="nx"&gt;Manager&lt;/span&gt;
    &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;Effect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Allow&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secretsmanager:GetSecretValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;Resource&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
        &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;self&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;jarvisAdminPassword&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;self&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;

  &lt;span class="nl"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nl"&gt;JARVIS_ADMIN_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;self&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;jarvisAdminPassword&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;self&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;

&lt;span class="nl"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nl"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;${opt:stage, self:provider.stage}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

  &lt;span class="nx"&gt;jarvisAdminPassword&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nx"&gt;local&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;local_jarvis_admin_password_secrets_key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="nx"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev_jarvis_admin_password_secrets_key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="nx"&gt;staging&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;staging_jarvis_admin_password_secrets_key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="nx"&gt;prod&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prod_jarvis_admin_password_secrets_key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An extra cool thing about secrets: if you need to update your database accesses, an API key or any secret value you can just update the secret value into your Secret Manager, and every services that are using it will be automatically updated :) &lt;/p&gt;

&lt;p&gt;Hope it helps !&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Bye bye Postman ! Let's share your REST API calls in team, easily !</title>
      <dc:creator>Jonathan BROSSARD</dc:creator>
      <pubDate>Fri, 10 Jan 2020 10:56:48 +0000</pubDate>
      <link>https://dev.to/monisnap/bye-bye-postman-let-s-share-your-rest-api-calls-in-team-easily-h6l</link>
      <guid>https://dev.to/monisnap/bye-bye-postman-let-s-share-your-rest-api-calls-in-team-easily-h6l</guid>
      <description>&lt;p&gt;As developer, we are using tools to make REST API calls &lt;em&gt;(Postman, Insomnia, PostWoman...)&lt;/em&gt;, and these tools are very usefull.&lt;/p&gt;

&lt;h2&gt;
  
  
  The limits
&lt;/h2&gt;

&lt;p&gt;Make calls to test an API is fine, but if you want to edit, version, or simply share it with your team ... it's not very handy.&lt;/p&gt;

&lt;p&gt;Indeed, you can use Postman paid plans for instance, but it means that you need to pay, and it means that all your team needs to use Postman, again one more tool... &lt;/p&gt;

&lt;h2&gt;
  
  
  Do you know &lt;strong&gt;REST Client&lt;/strong&gt; ?
&lt;/h2&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F452qob0efqpz249wrvnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F452qob0efqpz249wrvnm.png" title="Logo REST Client VS Code Extension" alt="Logo REST Client VS Code Extension"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=humao.rest-client" rel="noopener noreferrer"&gt;REST Client&lt;/a&gt;* is a &lt;strong&gt;VS Code extension&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;It will let you to send HTTP requests and view responses &lt;strong&gt;into VS Code&lt;/strong&gt;. And only based on a text file, which can easily be &lt;strong&gt;versioned&lt;/strong&gt; among your repository. 🙏&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros
&lt;/h2&gt;

&lt;p&gt;The main advantage is to be able to version and share your API calls. &lt;/p&gt;

&lt;p&gt;If you're working on an internal API, you may want to share how to test a new endpoint with your colleagues. &lt;/p&gt;

&lt;p&gt;REST Client is a good easy way to do it !&lt;/p&gt;

&lt;p&gt;Another good point is simplicity. All you need to do/have, is &lt;strong&gt;ONE file&lt;/strong&gt;. Also, if you jump between projects and do not remember how works an API/Service on which you did not work since a while, just look at this file ! &lt;/p&gt;

&lt;h2&gt;
  
  
  Cons
&lt;/h2&gt;

&lt;p&gt;You have to use VS Code... but for a lot of known reasons among internets, you are using Emacs, VI, or VS Code 😄&lt;/p&gt;

&lt;h3&gt;
  
  
  What's next ?
&lt;/h3&gt;

&lt;p&gt;Here is how to begin.&lt;/p&gt;

&lt;h3&gt;
  
  
  The file
&lt;/h3&gt;

&lt;p&gt;Only create a file with .http extension, for instance doc.http&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And then, VS Code will show you the file as :&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3ssx618zejysxau11b20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3ssx618zejysxau11b20.png" alt="doc.http preview into VS Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And by clicking on &lt;strong&gt;"Send Request"&lt;/strong&gt;, a new tab with all request response details will be opened.&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ffqamilfzz042c6vgvl5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ffqamilfzz042c6vgvl5s.png" alt="doc.http response preview into VS Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Go further
&lt;/h3&gt;

&lt;p&gt;You may also use environment variables to easily switch between you env and avoid any api-key or token manually update in the file, or url update etc...&lt;/p&gt;

&lt;p&gt;Here is how to use environment variables, just like that : &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Here, I created 4 environments : local, dev, staging, production.&lt;/p&gt;

&lt;p&gt;These 4 environments have their own host and token variables, with their specific values. &lt;br&gt;
But they also share a variable, named &lt;code&gt;partnerUniqueToken&lt;/code&gt; (don't ask me why ... too many partners don't have several env...).&lt;/p&gt;

&lt;p&gt;Hope it helps !&lt;/p&gt;

&lt;h6&gt;
  
  
  Big up to &lt;a href="https://dev.to/monisnapjulien"&gt;Julien&lt;/a&gt; who discovered this extension !
&lt;/h6&gt;

</description>
      <category>vscode</category>
      <category>rest</category>
      <category>postman</category>
    </item>
  </channel>
</rss>
