Secure Coding Checklist
Secure Coding Checklist
System Name:
Date of Acceptance:
Input Validation
Conduct all data validation on a trusted system (e.g., The server)
Identify all data sources and classify them into trusted and untrusted. Validate all data
from untrusted sources (e.g., Databases, file streams, etc.)
All validation failures should result in input rejection
Validate all client provided data before processing, including all parameters, URLs and
HTTP header content (e.g., Cookie names and values). Be sure to include automated post
backs from JavaScript, Flash or other embedded code
Verify that header values in both requests and responses contain only ASCII characters
Validate data from redirects (An attacker may submit malicious content directly to the
target of the redirect, thus circumventing application logic and any validation performed
before the redirect)
Validate for expected data types
Validate data range
Validate data length
Output Encoding
Conduct all encoding on a trusted system (e.g., The server)
Contextually output encode all data returned to the client that originated outside the
application's trust boundary. HTML entity encoding is one example, but does not work in
all cases
Encode all characters unless they are known to be safe for the intended interpreter
Contextually sanitize all output of un-trusted data to queries for SQL, XML, and LDAP
Sanitize all output of un-trusted data to operating system commands
Authentication and Password Management
Require authentication for all pages and resources, except those specifically intended to
be public
All authentication controls must be enforced on a trusted system (e.g., The server)
Establish and utilize standard, tested, authentication services whenever possible
Use a centralized implementation for all authentication controls, including libraries that
call external authentication services
Segregate authentication logic from the resource being requested and use redirection to
and from the centralized authentication control
Validate the authentication data only on completion of all data input, especially for
sequential authentication implementations
1
Secure Coding Checklist
2
Secure Coding Checklist
Data Protection
Implement least privilege, restrict users to only the functionality, data and system
information that is required to perform their tasks
Protect all cached or temporary copies of sensitive data stored on the server from
unauthorized access and purge those temporary working files a soon as they are no
longer required.
Encrypt highly sensitive stored information, like authentication verification data, even on
the server side. Always use well vetted algorithms.
Do not store passwords, connection strings or other sensitive information in clear text or
in any noncryptographically secure manner on the client side. This includes embedding in
insecure formats like: MS view state, Adobe flash or compiled code
Do not include sensitive information in HTTP GET request parameters
Communication Security
Implement encryption for the transmission of all sensitive information. This should
include TLS for protecting the connection and may be supplemented by discrete
encryption of sensitive files or non-HTTP based connections
TLS certificates should be valid and have the correct domain name, not be expired, and be
installed with intermediate certificates when required
Utilize TLS connections for all content requiring authenticated access and for all other
sensitive information
Utilize TLS for connections to external systems that involve sensitive information or
functions
Database Configuration
Use strongly typed parameterized queries
The application should use the lowest possible level of privilege when accessing the
database
Use secure credentials for database access
Remove or change all default database administrative passwords. Utilize strong
passwords/phrases or implement multi-factor authentication
Disable any default accounts that are not required to support business requirements
The application should connect to the database with different credentials for every trust
distinction (e.g., user, read-only user, guest, administrators)
Timescales and Expected Outcomes
Has a cutover plan for the new or changed system been created?
Has the warranty/early life support period for the system been agreed?
Have the expected outcomes of the new or changed system been fully defined?
3
Secure Coding Checklist
Capacity Management
Configuration Management
Problem Management
Financial Management
Supplier Management
Technology Changes
Have any technology changes (hardware, software, network etc.) included in the new or
changed system been highlighted?
Is each technology component under maintenance?
Service Levels
Are service levels for the system defined and agreed?
Has the risk of service levels not being met been assessed and mitigated?
Communication
4
Secure Coding Checklist
Have all relevant parties been consulted/informed about the planned transition?
Have the main contacts for the operational system been defined?