views:

125

answers:

3

Need to submit some CC data from the View to the Controller where it will be processed, can I just POST it or is there some common way of securing the data in transit?

+11  A: 

Post the data using SSL.

Here's a good resource on setting up SSL with IIS and ASP.NET.

Rex M
does that just mean specifying https:// within the the url I am POSTing to (assuming SSL cert is installed on IIS)
shogun
@Ryan you should load the form under https as well, and post in the same protocol.
Rex M
@Ryan - HTTP is a cleartext protocol... everything you do with it can be intercepted at any node it passes through on the internet. HTTPS is the only secure solution.
womp
Note that this is independent of MVC! Always use SSL when posting sensitive data - and only post sensitive data when necessary!
mgroves
A: 

I haven't read about the implementation of the ASP.net-MVC. However, i believe that you have mixed up the terminology.

The MVC Pattern would be evaluated on the server end. [So there is little need to do security checks between the components (unless they are exposed outside the program)]

I believe that many people get the impression that you are talking about HTTP POSTS after a form submission (as opposed to HTTP GETs)

monksy
+1  A: 

Posting with SSL like Rex M mentioned is definitely the first step. You should probably make the page where they are typing their credit card number SSL as well. This will give your users the green URL of comfort.

You should also include protection against CSRF attacks. Use the anti-forgery token.

Also, you should use the PRG (Post, Redirect, Get) pattern to make sure that the credit card numbers aren't submitted twice. After the post, don't just render a different view, send a redirect so their browser does a GET against another URL - probably your confirmation page.

You'll run into a few ASP.NET MVC specific things:

  1. If you have some http pages and some https pages, how will you code the links to the https pages from the http pages. You can hard code them, but you'll have to hard code the domain and protocol. You can't just use <%= Html.ActionLink(... see this SO question for more details.

  2. You'll want to make sure you can't hit your controllers when you are not using SSL. This will help you catch any errors, and ensure that no one uses http instead of https. See the [RequireSsl] attribute in the futures assembly. Here's a blog post about it from Adam Salvo

Lance Fisher