Unit 2
Unit 2
Unit 2
DEPLOYMENT
Web Applications Security:
Securing web applications is a critical aspect of software development and
deployment. The goal is to protect the application and its users from various security
threats and vulnerabilities. Here are key practices for secure development and
deployment of web applications:
1. Input Validation:
Validate and sanitize all user inputs to prevent injection attacks (e.g.,
SQL injection, cross-site scripting).
Use parameterized queries to prevent SQL injection.
2. Authentication and Authorization:
Implement strong authentication mechanisms, including multi-factor
authentication when possible.
Follow the principle of least privilege for user permissions.
Regularly review and update access controls.
3. Session Management:
Use secure and random session IDs.
Implement session timeout and reauthentication for sensitive actions.
Store session data securely, preferably on the server side.
4. Cross-Site Request Forgery (CSRF) Protection:
Include anti-CSRF tokens in forms.
Ensure that state-changing requests require proper authentication.
5. Cross-Origin Resource Sharing (CORS):
Implement proper CORS policies to control which domains can access
resources.
Avoid overly permissive CORS configurations.
6. Security Headers:
Utilize security headers like Content Security Policy (CSP), Strict-
Transport-Security (HSTS), and X-Content-Type-Options.
7. File Upload Security:
Validate file types and enforce size limits.
Store uploaded files in a secure location outside the web root.
8. Error Handling:
Provide custom error pages to avoid leaking sensitive information.
Log errors securely without exposing sensitive data.
9. Code Reviews and Static Analysis:
Regularly conduct code reviews to identify security vulnerabilities.
Use static analysis tools to scan code for potential security issues.
10. Dependency Management:
Keep all dependencies up-to-date to patch known vulnerabilities.
Use a secure package manager and regularly audit dependencies.
Security Testing:
1. Penetration Testing:
Purpose: To identify vulnerabilities and weaknesses in the application
or network.
Method: Ethical hackers simulate real-world attacks to uncover security
issues.
Frequency: Conduct regular penetration tests, especially after major
updates or changes.
2. Vulnerability Scanning:
Purpose: Automated tools scan systems for known vulnerabilities.
Method: Regularly scan networks, applications, and systems for known
security issues.
Frequency: Implement continuous scanning to detect and address
vulnerabilities promptly.
3. Code Review:
Purpose: Identifying security vulnerabilities in the source code.
Method: Manual or automated review of the application's source code.
Frequency: Regularly integrate code reviews into the development
process.
4. Security Audits:
Purpose: Comprehensive review of security policies, configurations,
and practices.
Method: Evaluate all aspects of security, including physical security,
policies, and procedures.
Frequency: Conduct periodic security audits to ensure ongoing
compliance and effectiveness.
5. Security Automation:
Purpose: Automating security tests and checks.
Method: Use tools for automated security testing, such as static
analysis tools, dynamic analysis tools, and security scanning tools.
Frequency: Integrate automation into the development and testing
pipeline.
6. Compliance Testing:
Purpose: Ensure compliance with relevant security standards and
regulations.
Method: Evaluate the system against specific compliance
requirements.
Frequency: Regularly assess and update compliance measures.
In this article
1. Training
2. Requirements
3. Design
4. Implementation
Show 3 more
Microsoft SDL consists of seven components including five core phases and two
supporting security activities. The five core phases are requirements, design,
implementation, verification, and release. Each of these phases contains mandatory
checks and approvals to ensure all security and privacy requirements and best
practices are properly addressed. The two supporting security activities, training and
response, are conducted before and after the core phases respectively to ensure
they're properly implemented, and software remains secure after deployment.
Training
Developers and engineers must also participate in role specific training to keep them
informed on security basics and recent trends in secure development. All full-time
employees, interns, contingent staff, subcontractors, and third parties are also
encouraged and provided with the opportunity to seek advanced security and
privacy training.
Requirements
Every product, service, and feature Microsoft develops starts with clearly defined
security and privacy requirements; they're the foundation of secure applications and
inform their design. Development teams define these requirements based on factors
such as the type of data the product will handle, known threats, best practices,
regulations and industry requirements, and lessons learned from previous incidents.
Once defined, the requirements are clearly defined, documented, and tracked.
Design
Once the security, privacy, and functional requirements have been defined, the
design of the software can begin. As a part of the design process, threat models are
created to help identify, categorize, and rate potential threats according to risk.
Threat models must be maintained and updated throughout the lifecycle of each
product as changes are made to the software.
The threat modeling process begins by defining the different components of a
product and how they interact with each other in key functional scenarios, such as
authentication. Data Flow Diagrams (DFDs) are created to visually represent key data
flow interactions, data types, ports, and protocols used. DFDs are used to identify
and prioritize threats for mitigation that are added to the product's security
requirements.
Developers are required to use Microsoft's Threat Modeling Tool for all threat
models, which enables the team to:
Before any product is released, all threat models are reviewed for accuracy and
completeness, including mitigation for unacceptable risks.
Implementation
Implementation begins with developers writing code according to the plan they
created in the previous two phases. Microsoft provides developers with a suite of
secure development tools to effectively implement all the security, privacy, and
function requirements of the software they design. These tools include compilers,
secure development environments, and built-in security checks.
Verification
Before any written code can be released, several checks and approvals are required
to verify that the code conforms to SDL, meets design requirements, and is free of
coding errors. SDL requires that manual reviews are conducted by a reviewer
separate from the personnel the developed the code. Separation of duties is an
important control in this step to ensure no code can be written and released by the
same person leading to potential accidental or malicious harm.
Various automated checks are also required and are built into the commit pipeline to
analyze code during check-in and when builds are compiled. The security checks
used at Microsoft fall into the following categories:
Static code analysis: Analyzes source code for potential security flaws,
including the presence of credentials in code.
Binary analysis: Assesses vulnerabilities at the binary code level to confirm
code is production ready.
Credential and secret scanner: Identify possible instances of credential and
secret exposure in source code and configuration files.
Encryption scanning: Validates encryption best practices in source code and
code execution.
Fuzz testing: Use malformed and unexpected data to exercise APIs and parsers
to check for vulnerabilities and validate error handling.
Configuration validation: Analyzes the configuration of production systems
against security standards and best practices.
Component Governance (CG): Open-source software detection and checking
of version, vulnerability, and legal obligations.
If the manual reviewer or automated tools find any issues in the code, the submitter
will be notified, and they're required to make the necessary changes before
submitting it for review again.
After passing all required security tests and reviews, builds aren't immediately
released to all customers. Builds are systematically and gradually released to larger
and larger groups, referred to as rings, in what is called a safe deployment process
(SDP). The SDP rings are defined as follows:
Builds remain in each of these rings for an appropriate number of days with high
load periods, except for Ring 3 since the build has been appropriately tested for
stability in the earlier rings.
Our mission is to provide an effective and measurable way for you to analyze and
improve your secure development lifecycle. SAMM supports the complete
software lifecycle and is technology and process agnostic. We built SAMM to
be evolutive and risk-driven in nature, as there is no single recipe that works for
all organizations.
Check out the OWASP SAMM v2 model online:
The monthly call is on each 2nd Wednesday of the month at 21h30 CET /
3:30pm ET.
Register through our SAMM MeetUp to join the Zoom call.
The call is open for everybody interested in SAMM or who wants to work
on SAMM.
As of my last knowledge update in January 2022, the Software Assurance Maturity Model
(SAMM) is an open framework maintained by the Open Web Application Security Project
(OWASP). SAMM provides an effective and measurable way for all types of organizations to
analyze and improve their software security posture.
1. Governance:
Objective: Establish and maintain the appropriate level of software security
governance.
Activities: Define and implement policies, roles, responsibilities, and processes to
support software security.
2. Construction:
Objective: Ensure that security activities are integrated into the software
development process.
Activities: Apply security practices during the development phase, including
requirements, design, coding, and testing.
3. Verification:
Objective: Implement security practices to confirm that software is secure and
meets requirements.
Activities: Conduct security testing, code review, and use automated tools to
verify the security of the software.
4. Deployment:
Objective: Develop and implement strategies to deploy software securely.
Activities: Ensure secure configuration, perform secure deployment, and monitor
security during deployment.
5. Operations:
Objective: Manage and respond to software security issues in deployed software.
Activities: Establish incident response and management processes, conduct
regular security operations, and monitor for security incidents.
6. Continuous Improvement:
Objective: Continuously improve the software security process.
Activities: Collect and analyze metrics, conduct retrospectives, and refine security
practices based on lessons learned.
SAMM Levels:
SAMM defines three maturity levels for each of the six domains mentioned above:
1. Level 1 - Initial:
Description: The organization has started considering software security.
Characteristics: Reactive, ad-hoc practices, and minimal security measures.
2. Level 2 - Defined:
Description: Security activities are defined and documented.
Characteristics: Basic processes in place, some level of consistency.
3. Level 3 - Consistent:
Description: Security practices are consistently applied across the organization.
Characteristics: Well-defined and consistent processes, proactive measures.
4. Level 4 - Managed:
Description: The organization actively manages and measures its security
practices.
Characteristics: Metrics-driven, continuous improvement, proactive security
measures.
5. Level 5 - Optimizing:
Description: Continuous optimization and improvement of security practices.
Characteristics: Continuous feedback loops, adaptive and innovative security
measures.
SAMM Implementation:
Organizations can use SAMM to assess their current state and define a roadmap for improving
their software security practices. The model provides guidance on activities and practices at each
maturity level, allowing organizations to incrementally enhance their software security posture.
Benefits:
For the most recent and detailed information on SAMM, please check the OWASP website or
other authoritative sources. The field of software security evolves, and updates or changes may
have occurred since my last knowledge update.