Code Acceptance Checklist in .NET
- .NET
- Validation
- Dot Net Security
- Log and Exception Handling
- Others
Note: Please mark "Y" for implementing, "N" for not implementing standards, and "-" for the section that is not applicable.
.NET
- Assemblies must have a strong name. (Dynamically generated ASP.NET Web page assemblies cannot currently have a strong name.)
- You use delay signing as a way to protect and restrict the private key that is used in the strong name and signing process.
- Assemblies include declarative security attributes (with SecurityAction.RequestMinimum) to specify minimum permission requirements.
- Highly privileged assemblies are separated from lower privileged assemblies.
- If an assembly is to be used in a partial-trust environment (for example, it is called from a partial-trust web application), then privileged code is in a separate assembly.
- You rely on a native configuration file to support the application instead of changing the configuration to the Web.config.
- You use .NET Framework 2.0, 3.0, or 3.5.
- You use a single .NET Framework version. You do not mix multiple versions.
- Your code is 64 bit compatible.
- You avoid hard coding strings and labels. You use resource or language files instead.
Validation
- Data is validated for type, length, format, and range.
- Input validation is applied at all identified entry points (including form fields, querystrings, cookies, HTTP headers, and Web Service parameters).
- Security does not rely on client-side validation. Instead, validation is done on the server-side.
- The ASP.NET validateRequest option is enabled, if possible.
.Net Security
- The application uses an inclusion list (known, valid, and safe input) rather than an exclusion list (rejecting known malicious or dangerous input).
- Plain text passwords are not present in Web.config, Machine.config, or any files that contain configuration settings. Utilities such as Aspnet_setreg.exe and Trustee or the identity setting in AppPool on IIS 6.0 or IIS 7.0 are used to encrypt credentials.
- Sensitive data is not stored in cookies.
- If cookies contain sensitive data, they are marked secure.
- Session state is strong, unpredictable, and protected from unauthorized access or replay attacks.
- Session lifetime is limited to 30 minutes maximum of inactivity.
- Session identifiers are not passed in the URL and the ASP.NET feature, cookieless session, is not used.
- The session state service is disabled if not used.
- The application consistently uses standardized input validation such as RegEx throughout.
- The application does not log sensitive data in cleartext.
- Sensitive data is not stored in unencrypted, hidden form fields or query strings. It is maintained by using server-side state management.
- SSL, IPSEC with encryption, or application-layer encryption prior to transmittal is used to protect sensitive data during transmission.
- Sensitive data is not cached. Output caching is off by default.
- Sensitive data that is transferred via e-mail uses S/MIME encryption or Information Rights Management (IRM), depending upon the intended recipient.
- Input surfaces in Web parts and other customizations include boundary checks, input data integrity checks, and appropriate exception handling to protect from cross-site scripting and SQL injection.
- All user input is encoded with IOSec when displayed to clients.
- Character encoding is set by the server (ISO-8859-1 is recommended).
- If you display or download user-uploaded documents then you must append the X-Content-Type-Options: nosniff. HTTP response header when returning the document.If the document does not need to render in the browser, you must send two additional HTTP response headers to prevent this. The following are the HTTP response headers to send:
- X-Download-Options: noopen, Content-Disposition: attachment

Dinesh BeniwalPosted Oct 24, 2014, 1:23 AM
Great Sagar