<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Forms API - Preventing Users to Submit without API Key in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395288#M39084</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/155042"&gt;@rawsly&lt;/a&gt;&amp;nbsp;- This official PHP package for HS is my go to...&amp;nbsp;&lt;A href="https://github.com/HubSpot/hubspot-php" target="_blank" rel="noopener"&gt;https://github.com/HubSpot/hubspot-php&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I use this composer package in my Laravel apps and accomplish just this by setting the API key in a &lt;STRONG&gt;.env&lt;/STRONG&gt; file.&lt;/P&gt;
&lt;P&gt;Laravel also ships with CSRF protection which means the postman requests should be invalidated if the request wasn't generated from your server with the session signed token. Since postman can't generate those CSRF tokens, you might try that approach.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://laravel.com/docs/8.x/csrf" target="_blank" rel="noopener"&gt;https://laravel.com/docs/8.x/csrf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, CSRF should work seamlessly with your react front-end... I use them in vue all the time, as long as the form is sitting on the same server that is generating the token &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;If this answer helped, please, mark as solved &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;tim@belch.io | &lt;A href="https://forms.belch.io" target="_blank" rel="noopener"&gt;forms.belch.io&lt;/A&gt; | Design your own Beautiful HubSpot Forms; No coding necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drop by and say Hi to me &lt;A href="http://slack.belch.io/" target="_blank" rel="noopener"&gt;on slack&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 08:21:00 GMT</pubDate>
    <dc:creator>tjoyce</dc:creator>
    <dc:date>2020-12-22T08:21:00Z</dc:date>
    <item>
      <title>Forms API - Preventing Users to Submit without API Key</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395077#M39051</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have built a custom form with React.js for Forms using Forms API. However, I could not find any information about how to prevent user to send a post request without an API key. In the end, user is able to fill a form and send a multiple request without any security clearance. What I want to achieve is to embed my API key with PHP in the backend part of the form, so that users will not be able to send a post request with 3rd party applications like "Postman".&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 10:47:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395077#M39051</guid>
      <dc:creator>rawsly</dc:creator>
      <dc:date>2020-12-21T10:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Forms API - Preventing Users to Submit without API Key</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395225#M39075</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/155042"&gt;@rawsly&lt;/a&gt; this is an interesting question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Curious to underdstand more.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt; basically knows everything about everything so I will add him to the convo as well &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 20:58:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395225#M39075</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2020-12-21T20:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Forms API - Preventing Users to Submit without API Key</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395288#M39084</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/155042"&gt;@rawsly&lt;/a&gt;&amp;nbsp;- This official PHP package for HS is my go to...&amp;nbsp;&lt;A href="https://github.com/HubSpot/hubspot-php" target="_blank" rel="noopener"&gt;https://github.com/HubSpot/hubspot-php&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I use this composer package in my Laravel apps and accomplish just this by setting the API key in a &lt;STRONG&gt;.env&lt;/STRONG&gt; file.&lt;/P&gt;
&lt;P&gt;Laravel also ships with CSRF protection which means the postman requests should be invalidated if the request wasn't generated from your server with the session signed token. Since postman can't generate those CSRF tokens, you might try that approach.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://laravel.com/docs/8.x/csrf" target="_blank" rel="noopener"&gt;https://laravel.com/docs/8.x/csrf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, CSRF should work seamlessly with your react front-end... I use them in vue all the time, as long as the form is sitting on the same server that is generating the token &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;If this answer helped, please, mark as solved &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;tim@belch.io | &lt;A href="https://forms.belch.io" target="_blank" rel="noopener"&gt;forms.belch.io&lt;/A&gt; | Design your own Beautiful HubSpot Forms; No coding necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drop by and say Hi to me &lt;A href="http://slack.belch.io/" target="_blank" rel="noopener"&gt;on slack&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 08:21:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395288#M39084</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2020-12-22T08:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Forms API - Preventing Users to Submit without API Key</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395457#M39105</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I am using Wordpress as backend. But it is not relevant I guess. In the end, I will probably be able to hide my API key with no problem. My question is that "Is there a specific reason why &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;Forms API Submit Form Data&lt;/A&gt; does not require an authentication?".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean what happens if a malicious user tries to send a request to this public API repeatedly? Is there a way to stop the user besides that using reCaptcha to protect the form?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 23:31:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395457#M39105</guid>
      <dc:creator>rawsly</dc:creator>
      <dc:date>2020-12-22T23:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Forms API - Preventing Users to Submit without API Key</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395495#M39109</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/155042"&gt;@rawsly&lt;/a&gt;&amp;nbsp;- The ReCaptcha is basically it..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see your concern and the question however, HS is no different than any other form on the internet.&lt;/P&gt;
&lt;P&gt;I can take any form that submits with JS and drop it into postman, grab the exposed front-end key (if it exists) and make as many postman requests as I like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some mitigation steps that can be taken are&lt;/P&gt;
&lt;P&gt;1. Force request origins from only known domains&lt;/P&gt;
&lt;P&gt;2. CSRF tokens&lt;/P&gt;
&lt;P&gt;3. ReCaptcha&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You raise a good question though, and I think white list domains similar to how Google App Engine does it would be a really nice feature that I haven't seen in HS yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I think you're left with building your own security which would mean... Show no reminents of HS form submission in your front-end, sanitize the data when it hits your WP API as best you can, then submit the data through the HS API... and make sure you are doing front end and back end validation. You can also make sure the form submission origin is from your own domain white list...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would leave a lot of guessing that would have to happen for an attacker to figure out the HS API endpoint to submit your form&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;If this answer helped, please, mark as solved &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;tim@belch.io | &lt;A href="https://forms.belch.io" target="_blank" rel="noopener"&gt;forms.belch.io&lt;/A&gt; | Design your own Beautiful HubSpot Forms; No coding necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drop by and say Hi to me &lt;A href="http://slack.belch.io/" target="_blank" rel="noopener"&gt;on slack&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 08:54:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Forms-API-Preventing-Users-to-Submit-without-API-Key/m-p/395495#M39109</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2020-12-23T08:54:57Z</dc:date>
    </item>
  </channel>
</rss>

