<?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: Anton Molleda</title>
    <description>The latest articles on DEV Community by Anton Molleda (@molant).</description>
    <link>https://dev.to/molant</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%2F7573%2F606594.png</url>
      <title>DEV Community: Anton Molleda</title>
      <link>https://dev.to/molant</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/molant"/>
    <language>en</language>
    <item>
      <title>webhint can now analyze password protected sites</title>
      <dc:creator>Anton Molleda</dc:creator>
      <pubDate>Wed, 25 Sep 2019 14:29:22 +0000</pubDate>
      <link>https://dev.to/webhint/webhint-can-now-analyze-password-protected-sites-2p4i</link>
      <guid>https://dev.to/webhint/webhint-can-now-analyze-password-protected-sites-2p4i</guid>
      <description>&lt;h3&gt;
  
  
  Analyzing password-protected sites with webhint
&lt;/h3&gt;

&lt;p&gt;Two of the most requested features the team has received are to run webhint in browsers other than Chrome and the ability to analyze password-protected websites. Up until recently that was not possible, but things have changed!&lt;/p&gt;

&lt;p&gt;The newest versions of webhint come with the new connector-puppeteer that allows webhint to talk to any browser that implements the subset of the debugging protocol used by &lt;a href="http://pptr.dev" rel="noopener noreferrer"&gt;puppeteer&lt;/a&gt;. Right now, that is any modern Chromium-based browser, but &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1545057" rel="noopener noreferrer"&gt;Firefox will support it in the near future as well&lt;/a&gt; 👏.&lt;/p&gt;

&lt;p&gt;This new package comes with some nice features. For example, it will automatically search for a valid Chromium-based executable. If you have multiple installed, the priority is Chrome &amp;gt; Chromium &amp;gt; Edge.&lt;/p&gt;

&lt;p&gt;If you want to specify one, you have two options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use the browser option and one of the shortcuts:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "connector": {
    "name": "puppeteer",
    "options": {
      "browser": "Chrome|Chromium|Edge"
    }
  },
  ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Specify the executable path directly via puppeteer-options:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "connector": {
    "name": "puppeteer",
    "options": {
      "puppeteer-options": {
        "executablePath": "path/to/browser"
      }
    }
  },
  ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The connector supports more configurations (check all of them on &lt;a href="https://webhint.io/docs/user-guide/connectors/connector-puppeteer/" rel="noopener noreferrer"&gt;this page&lt;/a&gt;), but probably the most exciting one is the possibility to analyze password-protected sites 🕵🏽‍♀️.&lt;/p&gt;

&lt;h3&gt;
  
  
  You can now analyze password-protected sites with webhint
&lt;/h3&gt;

&lt;p&gt;This has been one of the most requested features, and while there were some hacks to make it work sometimes, the experience was far from ideal.&lt;/p&gt;

&lt;p&gt;It has taken us more time than expected, but support for this feature has finally landed and we couldn’t be more excited! 🎉&lt;/p&gt;

&lt;p&gt;To test it, you will need to provide the user, password, input selectors, and submit input selector in your &lt;a href="https://webhint.io/docs/user-guide/configuring-webhint/summary/" rel="noopener noreferrer"&gt;.hintrc file&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;{
    "connector": {
        "name": "puppeteer",
        "options": {
            "auth": {
                "user": {
                    "selector": "string",
                    "value": "string"
                },
                "password": {
                    "selector": "string",
                    "value": "string"
                },
                "submit": {
                    "selector": "string"
                }
            }
        }
    },
    ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;webhint will:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to your target URL (&lt;a href="https://example.com" rel="noopener noreferrer"&gt;https://example.com&lt;/a&gt;)/secured) that should redirect to a login page (&lt;a href="https://example.com/login" rel="noopener noreferrer"&gt;https://example.com/login&lt;/a&gt;),&lt;/li&gt;
&lt;li&gt;Use the information provided in the auth property to fill the form and submit it, and&lt;/li&gt;
&lt;li&gt;Analyze the page that appears after the navigation of submitting the form (&lt;a href="https://example.com/secured" rel="noopener noreferrer"&gt;https://example.com/secured&lt;/a&gt;).&lt;/li&gt;
&lt;/ol&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%2F720%2F1%2Ab4LW4Qq3h9HyWY9_pAli-Q.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%2Fcdn-images-1.medium.com%2Fmax%2F720%2F1%2Ab4LW4Qq3h9HyWY9_pAli-Q.png"&gt;&lt;/a&gt;GitHub’s login form&lt;/p&gt;

&lt;p&gt;If your website uses Basic HTTP Auth, that is supported, too! The fields user and password should be a string only:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "connector": {
        "name": "puppeteer",
        "options": {
            "auth": {
                "user": "string",
                "password": "string"
            }
        }
    },
    ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  How do I integrate auth in CI without writing the credentials?
&lt;/h4&gt;

&lt;p&gt;As we all know, storing your credentials in plain text files is not a good idea. To solve this issue, you can use environment variables. Starting with webhint v5.1.0 you can pass specific configurations via environment variables. For example:&lt;/p&gt;

&lt;p&gt;webhint_connector_options_auth_user_value=johndoe&lt;/p&gt;

&lt;p&gt;webhint_connector_options_auth_password_value=P@ssw0rd!&lt;/p&gt;

&lt;p&gt;gets transformed into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "connector": {
        "options": {
            "auth": {
                "user": {                    
                    "value": "string"
                },
                "password": {                  
                    "value": "string"
                }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is then merged with the contents of your .hintrc file. (For this particular case, your .hintrc file should have the selectors.)&lt;/p&gt;

&lt;p&gt;Properties defined in your .hintrc file have higher priority than those in your environment variables in case of duplicates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&amp;amp;tabs=yaml%2Cbatch#secret-variables" rel="noopener noreferrer"&gt;Azure Pipelines has the concept of secrets&lt;/a&gt;, &lt;a href="https://docs.travis-ci.com/user/environment-variables/#defining-encrypted-variables-in-travisyml" rel="noopener noreferrer"&gt;Travis CI has encrypted environment variables&lt;/a&gt;, and other CI systems have similar features, so make sure to use them to not leak any information!&lt;/p&gt;

&lt;h4&gt;
  
  
  How can I run a quick test?
&lt;/h4&gt;

&lt;p&gt;The fastest way would be to create a .hintrc file similar to the ones above and run webhint via npx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx hint https://mysecuresite.com/secure/page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see your browser open, authenticate, and navigate to the final URL.&lt;/p&gt;

&lt;h3&gt;
  
  
  We want your feedback!
&lt;/h3&gt;

&lt;p&gt;Please let us know what you think of this new feature and in what ways we can improve. You can share your thoughts in this post, &lt;a href="https://github.com/webhintio/hint/issues/new/choose" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, &lt;a href="https://twitter.com/webhintio" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://gitter.im/webhintio/Lobby" rel="noopener noreferrer"&gt;Gitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you! 🙏&lt;/p&gt;




</description>
      <category>chrome</category>
      <category>ci</category>
      <category>authentication</category>
      <category>webhint</category>
    </item>
  </channel>
</rss>
