Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add section of containerization to secure coding guidelines

Oliver Günthercc4afd1da1ad
diff --git a/docs/development/concepts/secure-coding/README.md b/docs/development/concepts/secure-coding/README.md
index d6fa6d85c10..2476ed994e6 100644
--- a/docs/development/concepts/secure-coding/README.md
+++ b/docs/development/concepts/secure-coding/README.md
@@ -209,6 +209,45 @@ As OpenProject may handle and distribute sensitive user data, attack vectors suc
+## Logging and Error Handling
+
+Inconsiderate use of error handling, logging, and monitoring mechanisms of a web frameworks can lead to the following risks and impacts.
+
+**Risks and Impacts**
+
+- *Information Disclosure:* Improper error handling may reveal sensitive information or internal details about the application's infrastructure. Resulting consequences are Exposure of sensitive data, such as database errors or stack traces, which can aid attackers in planning further attacks.
+- *Data Leakage:* Inadequate logging and error handling can inadvertently log sensitive user data or credentials. This may result in unauthorized access to user data, privacy violations, and compliance breaches.
+- *Log Injection Attacks:* Lack of input validation on log entries can expose the application to log injection attacks where attackers manipulate log entries to inject malicious code or content. Resulting impacts are Malicious code execution, log manipulation, and potential system compromise.
+
+**Guidelines**
+
+- Implement proper exception handling to catch and handle unexpected errors. Log the exceptions for further analysis.
+- The application should fail in a secure manner. If an error occurs, the system should revert to a safe state that doesn't expose sensitive information or functionality.
+- Use generic error messages for end users to prevent information leakage. Avoid exposing stack traces, database error messages, or any detailed system information. If providing summaries or error reports to users, make sure no sensitive data or system information is included.
+- Scrub and filter user data being logged or output in error messages to prevent data leakage.
+- Only log necessary information. Avoid logging sensitive data such as passwords, payment information, or Personally Identifiable Information (PII).
+- Log data in a standard format to make parsing, auditing, and monitoring of that information easy.
+- Ensure that actions are aborted in case of errors
+
+
+
+**Usage at OpenProject**
+
+- Exception handlers catch all StandardErrors whenever your controller inherits from ApplicationController
+- Exception responses are disconnected from the actual errors and provide user-friendly messages without error details
+- Database transaction wrapping for any actions is wrapped in the [BaseContracted services](https://github.com/opf/openproject/blob/dev/app/services/base_services/base_contracted.rb#L54). Transactions are automatically rolled back in [Rails when exceptions occur](https://api.rubyonrails.org/v5.0.1/classes/ActiveRecord/Transactions/ClassMethods.html).
+- OpenProject uses a LogRage formatter for flexible, yet easily parseable formats
+
+
+
+**References**
+
+https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html
+
+https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
+
+
+
## External dependencies
OpenProject includes a number of external dependencies both in Ruby as well as in the JavaScript ecosystem. Regardless of the selection of these dependencies, maintaining and keeping the dependencies up-to-date is a critical part of the security of the application. We have seen a lot of attacks surface in the past years originating from either outdated or manipulated dependencies.
@@ -240,39 +279,41 @@ https://cheatsheetseries.owasp.org/cheatsheets/Vulnerable_Dependency_Management_
-## Logging and Error Handling
-
-Inconsiderate use of error handling, logging, and monitoring mechanisms of a web frameworks can lead to the following risks and impacts.
+## Packaging and containerization
-**Risks and Impacts**
+Packaging and containerization are critical artefacts in the delivery pipeline of OpenProject. They encapsulate the application and its environment, ensuring consistent operation across different systems and infrastructures. These artefacts need to provide a secure and stable default for maintaining and upgrading OpenProject.
-- *Information Disclosure:* Improper error handling may reveal sensitive information or internal details about the application's infrastructure. Resulting consequences are Exposure of sensitive data, such as database errors or stack traces, which can aid attackers in planning further attacks.
-- *Data Leakage:* Inadequate logging and error handling can inadvertently log sensitive user data or credentials. This may result in unauthorized access to user data, privacy violations, and compliance breaches.
-- *Log Injection Attacks:* Lack of input validation on log entries can expose the application to log injection attacks where attackers manipulate log entries to inject malicious code or content. Resulting impacts are Malicious code execution, log manipulation, and potential system compromise.
+Properly managed packaging and containerization pipelines ensure smooth installations, upgrades, and scaling, enhancing the deployment process and - as a result - the overall user experience. This section highlights risks connected to improper containerization or packaging as well as our main objectives and best practices to provide a secure, efficient, and reliable software delivery process.
-**Guidelines**
+OpenProject provides several installation mechanisms:
-- Implement proper exception handling to catch and handle unexpected errors. Log the exceptions for further analysis.
-- The application should fail in a secure manner. If an error occurs, the system should revert to a safe state that doesn't expose sensitive information or functionality.
-- Use generic error messages for end users to prevent information leakage. Avoid exposing stack traces, database error messages, or any detailed system information. If providing summaries or error reports to users, make sure no sensitive data or system information is included.
-- Scrub and filter user data being logged or output in error messages to prevent data leakage.
-- Only log necessary information. Avoid logging sensitive data such as passwords, payment information, or Personally Identifiable Information (PII).
-- Log data in a standard format to make parsing, auditing, and monitoring of that information easy.
-- Ensure that actions are aborted in case of errors
+- [Packaged installations](https://www.openproject.org/docs/installation-and-operations/installation/packaged/) using the distribution's package manager for dependency control
+- [Slim and all-in-one docker images](https://www.openproject.org/docs/installation-and-operations/installation/docker/) for manual operation with docker
+- [OpenProject helm chart](https://www.openproject.org/docs/installation-and-operations/installation/helm-chart/) , as a "package" for kubernetes clusters
-**Usage at OpenProject**
+
-- Exception handlers catch all StandardErrors whenever your controller inherits from ApplicationController
-- Exception responses are disconnected from the actual errors and provide user-friendly messages without error details
-- Database transaction wrapping for any actions is wrapped in the [BaseContracted services](https://github.com/opf/openproject/blob/dev/app/services/base_services/base_contracted.rb#L54). Transactions are automatically rolled back in [Rails when exceptions occur](https://api.rubyonrails.org/v5.0.1/classes/ActiveRecord/Transactions/ClassMethods.html).
-- OpenProject uses a LogRage formatter for flexible, yet easily parseable formats
+**Risks and Impact**
+- *Security Vulnerabilities*: Containers may inherit vulnerabilities from base images or packages.
+- *Update Management*: Inability to provide an easy and fast upgrade may lead to installations remaining outdated and as a result, vulnerable to known exploits.
+- *Configuration Drift*: Variations in configurations across different environments can lead to unexpected behaviors. They also make documentation of these variations harder, and lead to confusion for administrators and users.
+- *Resource Utilization*: Inefficient containerization can lead to excessive resource usage or an unstable software.
+- *Dependency conflicts*: Heterogenous installations may result in dependency conflicts or incompatibilities when using packages for installations.
+- *Orchestration Complexity*: With more dependencies and services, deployments add complexity that can introduce errors in service discovery, networking, and persistence.
+- *Compliance and Compatibility*: Ensuring that packaging and containerization meet known regulatory compliance requirements and are compatible with commonly used platforms.
-**References**
-https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html
+**Guidelines**
-https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
+- *Use Immutable Tags*: Provide specific, immutable tags for Docker images and fixed packaged versions to ensure consistency and provide clear upgrade paths instead of automatically pulling the latest image
+- *Scan for Vulnerabilities*: Regularly scan container images for vulnerabilities and promptly update them. On top of statical code analysis for code and dependencies (see above), OpenProject uses Snyk and Docker scout for its public docker images to be informed of which vulnerabilities exist in the base images.
+- *Minimal base Images*: Use minimal base images for Docker containers to reduce the attack surface. OpenProject currently uses a `ruby-${version}-${debianversion}` image as its base.
+- *Configuration Management*: Ensure configuration management is consistent between deployments. OpenProject provides an interface to ENV-based configuration for packages and Docker to ensure both can be configured similarly. Where necessary, different configuration mechanisms are documented for the different installation mechanisms.
+- *Resource Limits*: Set resource limits and requests in container definitions to prevent resource contention. The packaged installation provides a set of default scaling services. The OpenProject helm-charts define limits and resource requirements in the helm values.
+- *Monitor and Logging*: Implement robust monitoring and logging to track the health and performance of containers. [OpenProject provides individually pluggable health checks for various services as well as flexible logging](https://www.openproject.org/docs/installation-and-operations/operation/monitoring/).
+- *Continuous Integration/Continuous Deployment (CI/CD)*: Automate the building, testing, and deployment of containers using CI/CD pipelines. OpenProject builds `dev` containers and packages for every change to the core application.
+- *Documentation*: Maintain comprehensive documentation for installation and configuration processes across different mechanisms. OpenProject documents all changes as part of the standard development workflow. Documentation is released together with OpenProject to ensure consistency. [The documentation workflow is part of the product development handbook.](../../product-development-handbook/)