Authenticating in Email HTML Form - html

I'm building a web service for internal use and one feature I would like to implement is having users be able to fill out HTML forms and submit from email so that they don't necessarily have to go to the web page to use its functionality. The problem is that the web page requires authentication via nginx so a simple redirect won't work. Accessing the email account requires authenticating into Okta which is also the same creds that will get you into nginx, so is it possible to somehow pass along that information to the form?
The web page is running on flask, just in case that's important.

In short the answer is no. In most modern day mailing services such as gmail the mail will be counted as spam because you are trying to gather "sensitive" information(even if its something as simple as a name)
Trying to gather information through email is a security risk and you should do so only through your secure server

Related

Form Submission Cloudflare Pages and Worker

I am trying to develop a personal website, currently my hurdle is form submission and contact page management. How do I do a form submit on a personal site hosted on cloudflare pages to a serverless function on cloudflare workers with integration to slack or a webhook. It just doesn't seem to make sense, Do you have anything in mind???:)
Using a Cloudflare worker for form submission won't be too different from any other server side language.
The general idea is, you have an HTML form, and your target will be a URL. For Cloudflare workers, you'll probably want to set a route so you can use your own domain (e.g. mysite.com/form-submit).
Inside the worker's code, you'll be able to examine the incoming request, and execute whatever code you'd like. In your case, making an additional HTTP call to a slack webhook. This example may help with that -
https://developers.cloudflare.com/workers/examples/post-json

Securing an iFrame form

For our ASP.NET application we have an API which users can use to send data from their website forms (e.g. a sign-up form) directly to our application.
To use this, obviously some programming is required to connect their forms to our API. Some users (or their website developers) find this too difficult. So the idea is to provide a standard webform which can be included in their website using an iFrame. The webform should be unique per user, specified by using an ID or key in the URL or in a hidden field. For example, they can link their iFrame to an URL like https://myapplication.com/webform/CustomerID-1001
My question is how can we secure this webform? For the API we use an API-key, but that is used only serverside. Since the suggested webform is hosted in our application, the user cannot set anything serverside. So how can we prevent a malicious website visitor from copying the entire form (including the complete URL or hidden fields) from a valid user's website and using it in an iFrame on their own malicious website? (or at least stop the form from working in this case)
Do you have any suggestions about securing such a webform?

Posible pitfalls when switching from Gmail smtp to Gmail rest api

Google offers two systems for accessing Gmail. IMAP and SMTP and a the Gmail rest api Gmail - Scope for SMTP is https://mail.google.com/. However with Gmail rest API, just the required scope (like send, modify) can be used.
What are the main differences between the implementation of these two for sending an email? I've been using SMTP to send the mails without any issues but since that involves having a bigger scope for OAuth2, I want to know if there are any possible risks involved in moving to the API approach.
Users.messages: send says there's a restriction on attachment size.
This method supports an /upload URI and accepts uploaded media with
the following characteristics:
Maximum file size: 35MB Accepted Media MIME types: message/rfc822
Are there any other differences that I should know about if I start using Gmail APIs instead of using SMTP connection for OAuth2.
Also, what is the reasoning behind providing full access as the only possible scope for SMTP/IMAP?
Note: I only requirement is the ability to send emails.
Using SMTP you are directly accessing the mail server located at mail.google.com. SMTP servers have been around since the 60's they don't have the ability to limit what access you have. When you log in you have full access to do what ever the mail server in question is capable of. To login to the SMTP server you need the login (most often email address) and password of the account you wish to access. Drawback to using the SMTP to connect to Gmail is that if the user changed the password you would then loose access. This day in age it is also considered by most to be bad practice for third party developers to be storing a users login and password in your system. For example: I would never give any application access to my login and password to Google. How could you ever prove to me that your system is secure? If your hacked so am I.
Now on to Oauth2. Oauth came about sometime around 2005 when people wanted to be able to access APIs without having to do something stupid like
http://awsom.api.com?login=xxx&password=XXX
If memory services it was originally created for the twitter API developers wanted to be able to access their users twitter account without having to store their login in and password. Again the main problem with this was the developer in question would then have full access to a users twitter account and if the user or the developer changed the password things would break.
So they created OAuth. The main features with OAuth are:
You can limit access you give an application: (readonly, read write)
Password change does not affect access
No sharing account credentials with developers of third party apps
So the main point for me as a developer using Oauth with any Google API would be not having to store the login and password of my users and not being affected by a password change. My users would probably say not having to share their login with me and being able to give my application limited access to their account.
Now back to Gmail. Google made a change about two months ago any refresh token(oauth2) that was created using a Gmail scope will automatically expire when the user changes their password. To my knowledge this is only Gmail. so that removes point number two from the features of oauth.
Which should you use is really up to you, assuming you need to be able to send emails. Then limiting access to read only in your application isn't something you need (point one). However in my opinion from a security standpoint I would never ask my users to give me their login and password and would always choose oauth2. Yes SMTP works, will Google shut it down, probably not users have always been given access to the direct SMTP server of their email provider its how applications like outlook work.
as for OAuth support with SMTP unfortunately I haven't done much research into that guess I need to read RFC 4422 . If you can use OAuth with SMTP servers then again I guess the question would have to come down to speed is it faster to access the SMTP server or the REST API server? I can really think of no differences. Attachments with the Rest API can be tricky. I may do a bit more digging on the subject.

Post to Node.js Server from Within HTML e-mail

I am writing a simple mailing application, however I am not yet aware of the full capabilities of HTML editing within the mailing world.
I would like to give the website administrator the choice to accept or to refuse a reservation by sending him an overview of the reservation. Below in the mail I had 2 buttons in mind, accept & refuse.
I tried using a form within the HTML e-mail but almost every mailing client blocks this out.
Is there another method to do a http post command to let's say myserver.com/accept or myserver.com/refuse from within an e-mail without having to open an additional webpage?
If not, what is the best way to achieve such things?
This is a pretty relevant article: https://www.sitepoint.com/forms-in-email/
Basically he concludes that support is not reliable so you should not use forms in emails which I agree with.
Since you say you want to give this choice to a website administrator I think you probably want some sort of authentication. So I could see it working something like this...
Send the admin an email containing two links mysite.com/reservations/:reservation_id/accept and mysite.com/reservations/:reservation_id/refuse.
Admin clicks on one of the links
Link opens in the browser and your site(controller -> ReservationService) accepts or refuses based on the id and action in the url
You will have a few things to consider, such as authentication(I assume you already have this since you have the notion of website admin?), authorization(can this admin accept or deny the reservation?), does the reservation exist, has the admin already accepted or denied the reservation, etc.

Provide email certificate in html mailto link

I would like to know if it's possible to provide an email certificate (signed by a recognised CA) so the user clicking on the mailto link can send encrypted email to the owner of the cert ?
hello#gmail.com
Is there any way to do that using the mailto link or using some JS ? Given the mailto link is handled by a local email client, should be possible ?
If there is no direct way to do this, how to make it?
One option is a web form for message sending, served via HTTPS. The server-side handler of the form would compose an encrypted mail on the server and then send it via SMTP. This provides almost the same level of security as direct encryption (given that your server is secure). Unfortunately there's no other simple way to do what you want. Of course, you can put a link for your .cer file download and tell the user to download the .cer file and use it to compose an encrypted mail, but how would you deal with GMail users and mobile users? Web form is more flexible and easier to use for the sender.
You can look up what you according to the current specification can do with a mailto URL in RFC 2368. You'll see that it only refers to the construction of the mail text and headers, not their encoding or encryption. There may be extensions for some mail clients, but that's not something one should generally count on.
Furthermore, Web mail users generally will have problems with such links anyways. Thus, for a solution that has to be usable by anyone, a scheme counting on some client side program is not a good choice.
Thus, some Web form as mentioned by #Eugene accessable only via https would best serve your requirements.