Netlify honeypot attribute missing on deployment - netlify

I have a django website that I'm using the django_distill app to generate a static site which I'm deplying to netlify. I've decided to add a bot protection field to a form (https://docs.netlify.com/forms/spam-filters/#honeypot-field ). When I run the site locally I see
<form data-netlify="true" name="consultdocs" netlify-honeypot="BOTFIELD" action="/contact/" id="form" method="post" novalidate="novalidate"> <input type="hidden" name="csrfmiddlewaretoken" value="rdKh4K2zu9T96aEUO9exSv3QCAm5w">
<input id="id_BOTFIELD" name="BOTFIELD" type="hidden">
....
When I deploy to netlify:
<form name="consultdocs" action="/contact/" id="form" method="post" novalidate="novalidate"><input type="hidden" name="form-name" value="consultdocs"> <input type="hidden" name="csrfmiddlewaretoken" value="GNnbYgQu6vLduSpWEswAVXfEx">
<input id="id_BOTFIELD" name="BOTFIELD" type="hidden">
....
I no longer see the :
netlify-honeypot="BOTFIELD"
attribute. Does netlify remove this?

In short: Yes, netlify removes this field.
I thought initially it's because of the missing data-prefix but netflify removes it independently if it's used with data-netlify="true" data-netlify-honeypot="BOTFIELD OR just netlify="true" netlify-honeypot="BOTFIELD.
I did a quick isolation test to ensure django is not doing some magic. So I simply used two static html files and pushed them to netlify:
https://gallant-edison-bf9c5f.netlify.com/index.html (w/o data attribute)
https://gallant-edison-bf9c5f.netlify.com/index2.html (w/ data attribute)
In both cases it disappears. You can check the respective source code for both files here:
https://github.com/christoph-kluge/netlify-example
I assume that netlify is parsing your HTML code during deployment and is adjusting it. Additionally netflify already checks if a specific post is a potential bot and drops those requests for you. So they need to do something with those fields.
Hope this answers your question.

Related

How to download a file through an API which provides streams on client side?

In my app, I need to download a large zip file and my server(NodeJs) is providing zip using streams to the client but when the file created is too large I am getting network failed error after downloading some amount of file. Here is my sample client code:
<form method="post" action="somewhere" >
<input type="text" name="resources[]" value="resource1"/>
<input type="text" name="resources[]" value="resource2"/>
<input type="text" name="resources[]" value="resource3"/>
<input type="submit" value="post request"/>
</form>
Also I after some research I found that it might be possible that the client is unable to consume the streams properly. There I get to know about FileSaver.
Should I try it or there is something wrong on my client or server?
Here is my server sample: DownloadServer

Moneris - Setting up a Test Hosting Pay Page

I'm trying to make a fix to a moneris website, but I have to change the mode of moneris to test to test the changes before pushing in production.
I'm trying the code on the example page as is and got an error. "Invalid store credentials."
<FORM METHOD="POST" ACTION= https://esqa.moneris.com/HPPDP/index.php >
<INPUT TYPE="HIDDEN" NAME="ps_store_id" VALUE="AF4Fs1024">
<INPUT TYPE="HIDDEN" NAME="hpp_key" VALUE="Hsjh4GSr4g">
<INPUT TYPE="HIDDEN" NAME="charge_total" VALUE="1.00">
<!--MORE OPTIONAL VARIABLES CAN BE DEFINED HERE -->
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to Secure Page">
</FORM>
So if this is not how you can make a test payment to test the process, how can you?
PS: Seems there's no moneris tag.
You need to goto the developers page of Moneris and create a test environment first Developer Page
After creating the test store you'll need to input the store id and hp key in the values of the form you posted.

How to submit xml data to a web site?

I am using a third party to process transactions. They have an api that says XML content should submitted via an HTTP POST variable named “XML”.
I know how to create the xml, but not sure how to post it to their site. They have a destination url. Can you tell me how to do the Post to their site?
You need to carefully check. Usually you just post XML to an URL. However in this case (indicated by the variable name) it seems that a (typically only used for html forms) form post is needed.
The easiest way is to create a html form with that one field, something like this:
<form method="post" action="http://their url" name="payload">
<input type="hidden" id="XML" name="XML" />
</form>
Then you can fill the field with your XML and do a payload.submit()
Let us know how it goes

Cannot track the user securely who made the purchase in PayPal IPN

I am building a website which utilizes paypal payment system and I came up with one security challenge issue:
I have the following form from paypal IPN:
<form class="form-horizontal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ABCDEFEGDEDS">
<input type="hidden" name="on0" value="Balance">
<label>Amount</label>
<select class="form-control" name="os0" id="deposit_paypal">
<option value="1000">$1000.00 USD</option>
<option value="2000">$2000.00 USD</option>
</select>
<input type="hidden" name="custom" value="<?php echo $user->id; ?>">
<input type="image" src="https://www.paypalobjects.com/ru_RU/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
I wanted to know which user has made the transaction. Searching the internet, I've found that I can create a custom field as I did above. The reason I track the user is I should add balance to his virtual account after purchase completed.
But the problem is: What if malicious code(javascript malware) just changes the user id in the custome form field to 4?
The balance will be added to that user which has the id of 4 not previous one.
Ok. One would recommend me inserting the form data to db before sending to paypal for later comparison.
Second problem arises. What if the user just exits the paypal page without completing the order after pressing the submit button? This is something I cannot track since paypal does not belong to me and it opens in other page.
Please, any other solution to these issues? I want some best practice where I can track securely which user has made the purchase through paypal IPN.
You could store the data in your database within a temp table, then once the IPN completes you can move it over to the permanent table. Set up a cron job or scheduled task to go through your system every 24 hours or so and delete any records that have not completed in that time.

"Cannot POST /dialog/authorize/decision" while implementing the OAuthorize example

I'm implementing OAuth 1.0a with the OAuthorize library. I'm following the example provided by the library.
I'm hosting my app at Heroku. Using the test client I'm able to GET a request token, and use it to /dialog/authorize:
Hi Bob Smith!
Samplr is requesting access to your account.
Do you approve?
When I press Allow, I get a Cannot POST /dialog/authorize/decision.
I've registered the endpoint in app.js:
app.post('/dialog/authorize/decision', oauth.userDecision);
Either I am missing something silly from the OAuthorize example or there is a fault in the way I'm handling the transaction.
dialog.ejs:
<form action="/dialog/authorize/decision" method="post">
<input name="transaction_id" type="hidden" value="<%= transactionID %>">
<div>
<input type="submit" value="Allow" id="allow">
<input type="submit" value="Deny" name="cancel" id="deny">
</div>
</form>
For me, the issue was that I didn't provide a proper callbackURL in server.userAuthorization callback.
see https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/db/accessTokens.js#L10 and https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/oauth.js#L152

Resources