|
1 | 1 | # Runtime Security |
2 | 2 |
|
3 | | -### 1. Apply Security Patches Regularly |
| 3 | +## Apply security patches regularly |
4 | 4 |
|
5 | | -* **VSCode Plugin**: Always use the latest release for `WSO2 Integrator: BI` and `Ballerina` VSCode plugin. |
6 | | -* **Ballerina:** Use the latest patch release of the relevant Ballerina distribution version. |
| 5 | +Keeping all software components up to date is a critical part of maintaining runtime security. Security patches often address newly discovered vulnerabilities that attackers can exploit if left unpatched. |
7 | 6 |
|
8 | | -> Community users are encouraged to use the latest product versions to receive all resolved security issues. |
| 7 | +| Category | Guidelines | |
| 8 | +|-----------|-------------| |
| 9 | +| **WSO2 Integrator: BI** | Always use the latest stable release of [Visual Studio Code](https://code.visualstudio.com/).<br><br>Keep [WSO2 Integrator: BI](https://marketplace.visualstudio.com/items?itemName=WSO2.ballerina-integrator) and [Ballerina](https://marketplace.visualstudio.com/items?itemName=WSO2.ballerina) extensions updated to ensure compatibility with the latest security and functionality enhancements. | |
| 10 | +| **Ballerina Distribution** | Use the latest patch release of the relevant [Ballerina distribution](https://ballerina.io/downloads/) to ensure runtime and library-level vulnerabilities are fixed.<br><br>Follow Ballerina and WSO2 product release notifications to stay informed about new security advisories. | |
| 11 | +| **Operating System and Dependencies** | Regularly apply security updates to the host operating system, *container base images*, and *runtime dependencies* (e.g., database clients, third-party libraries).<br><br>If deploying via Docker, track and update base image versions (e.g., `ubuntu`, `alpine`, or `ballerina`) to the latest stable, patched releases.| |
| 12 | +| **Automation and CI/CD Integration** | Integrate automated patch verification and dependency vulnerability scanning into CI/CD pipelines.<br><br>Use dependency management tools (e.g., *Dependabot*, *Renovate*) to receive automated pull requests for new patches.<br><br>Maintain a rollback plan and a staging environment to safely test patches before deploying to production. | |
| 13 | +| **Community and Security Feeds** | Follow [WSO2 Security Docs](https://security.docs.wso2.com/en/latest/) for timely notifications of vulnerabilities and fixes. | |
9 | 14 |
|
10 | | -> Subscribe to the official security mailing lists and follow WSO2/Ballerina release announcements. |
| 15 | +## Use keystores and truststores correctly |
11 | 16 |
|
12 | | -* **OS and Dependencies:** Keep the operating system, container base images, Java (JDK/JRE), and database clients updated with security patches. |
13 | | -* **Automation:** Integrate patch checks into CI/CD pipelines and maintain a rollback plan for emergency patches. |
14 | | - |
15 | | -### 2. Use Keystores and Truststores Correctly |
16 | | - |
17 | | -* Configure BI and the generated Ballerina services to use **separate keystores** for service certificates and **truststores** for trusted CAs. |
| 17 | +* Configure BI and the generated Ballerina services to use separate keystores for service certificates and truststores for trusted CAs. |
18 | 18 | * Use strong passwords and store them securely (e.g., as Kubernetes secrets or environment variables). |
19 | | -* Always replace default keystore files shipped with samples. |
| 19 | +* Always replace the default keystore files shipped with samples. |
20 | 20 |
|
21 | | -### 3. Manage Secrets Securely |
| 21 | +## Manage secrets securely |
22 | 22 |
|
23 | 23 | * Never hardcode passwords, tokens, or keys in source code, configuration files, or repositories. |
24 | | - |
25 | 24 | * Use platform-specific secret management systems such as: |
26 | | - * **Kubernetes Secrets** |
27 | | - * **HashiCorp Vault** |
28 | | - * **AWS Secrets Manager** or similar cloud stores. |
29 | | -* Pass secrets into BI runtime via configuration values. |
| 25 | + * Kubernetes Secrets |
| 26 | + * HashiCorp Vault |
| 27 | + * AWS Secrets Manager or similar cloud stores. |
| 28 | +* Pass secrets into the BI runtime via configuration values. |
30 | 29 |
|
31 | | -### 4. Change Default Ports and Credentials |
| 30 | +## Change default ports and credentials |
32 | 31 |
|
33 | | -* Change all **default listener ports** used by BI components and generated Ballerina services. |
| 32 | +* Change all default listener ports used by BI components and generated Ballerina services. |
34 | 33 | Example: modify configurations or `Config.toml` to run on custom, non-standard ports. |
35 | 34 | * Disable unused ports and protocols to minimize the attack surface. |
36 | 35 | * Replace any default credentials used by admin or management consoles. |
37 | 36 |
|
38 | | -### 5. Secure Communication with External Services |
| 37 | +## Secure communication with external services |
39 | 38 |
|
40 | 39 | When BI connects to external systems such as user stores, databases, or other APIs: |
41 | 40 |
|
42 | | -* Always enable **TLS/SSL** for data-in-transit protection. |
| 41 | +* Always enable TLS/SSL for data-in-transit protection. |
43 | 42 | * Validate external service certificates using the truststore. |
44 | 43 | * Verify hostnames and certificate chains to avoid man-in-the-middle attacks. |
45 | 44 | * Restrict outbound network access to only approved endpoints. |
46 | 45 |
|
47 | | ---- |
48 | | - |
49 | | -### 6. Use Least-Privilege Credentials for DBs and User Stores |
| 46 | +## Use least-privilege credentials for DBs and user stores |
50 | 47 |
|
51 | 48 | * Never connect to databases, LDAP, or user stores using `root` or administrator credentials. |
52 | 49 | * Create dedicated application-level accounts with only the minimal privileges required: |
53 | 50 | * Read/write on specific schemas or tables. |
54 | 51 | * No administrative permissions (e.g., `DROP DATABASE`, `GRANT ALL`). |
55 | 52 | * Rotate credentials periodically and disable accounts no longer in use. |
56 | 53 |
|
57 | | -### 7. Strengthen TLS Security |
| 54 | +## Strengthen TLS security |
58 | 55 |
|
59 | | -* Enforce **TLS 1.2 or TLS 1.3** for all HTTPS and secure socket communications. |
| 56 | +* Enforce TLS 1.2 or TLS 1.3 for all HTTPS and secure socket communications. |
60 | 57 | * Disable older or insecure protocol versions (e.g., TLS 1.0/1.1, SSLv3). |
61 | | -* Require strong cipher suites only (see below). |
| 58 | +* Require strong cipher suites only (Refer to [Use cipher suites](#use-cipher-suites)). |
62 | 59 |
|
63 | | -### 8. Use Cipher Suites |
| 60 | +## Use cipher suites |
64 | 61 |
|
65 | | -* Configure Ballerina to use secure cipher suites see [Ballerina Crypto](https://central.ballerina.io/ballerina/crypto/latest) for more details. |
| 62 | +* Configure Ballerina to use secure cipher suites. Refer to [Ballerina Crypto](https://central.ballerina.io/ballerina/crypto/latest) for more details. |
66 | 63 | * Periodically review cipher configurations against current security standards (NIST, OWASP). |
67 | 64 |
|
68 | | -### 9. Logging and Monitoring |
| 65 | +## Logging and monitoring |
69 | 66 |
|
70 | 67 | * Comprehensive logs and telemetry, when correlated with access controls and alerting, enhance the ability to identify unauthorized usage or data exfiltration attempts in production environments. |
71 | 68 | * Integrate with standardized observability tools (e.g., Prometheus, Jaeger, ELK Stack) so that you can unify your security-monitoring posture across BI deployment models. |
72 | 69 |
|
73 | 70 | Follow the below guides to configure logging and observability. |
| 71 | + |
74 | 72 | * [Configure Logging](https://ballerina.io/spec/log/#3-configure-logging) |
75 | | -* [Observability in BI](https://bi.docs.wso2.com/observability-and-monitoring/overview/) |
| 73 | +* [Observability in BI](/observability-and-monitoring/overview) |
76 | 74 |
|
77 | | -### 10. Prevent Log Forging |
| 75 | +## Prevent log forging |
78 | 76 |
|
79 | 77 | * Sanitize all user-provided data before writing to logs. |
80 | 78 | * Configure the logging framework to escape newline and control characters. |
81 | 79 | * Use structured logging where possible to make parsing safer. |
82 | 80 | * Restrict log file write permissions to the BI runtime user only. |
83 | 81 |
|
84 | | -### 11. Set Secure JVM Parameters |
| 82 | +## Set secure JVM parameters |
85 | 83 |
|
86 | 84 | Since Ballerina runs on the JVM, tune the JVM for security and stability: |
87 | 85 |
|
88 | | -* Use a **supported JDK version** with the latest security patches. |
| 86 | +* Use a supported JDK version with the latest security patches. |
89 | 87 | * Limit heap size and enable garbage-collection logs for troubleshooting. |
90 | 88 | * Run BI under a non-root user with limited filesystem and network permissions. |
91 | 89 |
|
92 | | -### 12. Additional Hardening Recommendations |
| 90 | +## Additional hardening recommendations |
93 | 91 |
|
94 | 92 | * **Run as Non-Root:** Configure containers or services to run as a non-root OS user. |
95 | 93 | * **File Permissions:** Restrict access to configuration files, keystores, and logs (`chmod 600`). |
96 | 94 | * **Network Segmentation:** Place BI and databases on private networks/VPCs. |
97 | 95 | * **Audit and Compliance:** Periodically audit configurations and review access logs. |
98 | 96 | * **Backup and Recovery:** Encrypt and test backups regularly. |
99 | | -* **Validate the code with `scan tool`:** Use [Ballerina scan tool](https://bi.docs.wso2.com/developer-guides/tools/other-tools/scan-tool/) to identify potential issues such as code smells, bugs, and vulnerabilities. |
| 97 | +* **Validate the code with scan tool:** Use [Ballerina scan tool](https://bi.docs.wso2.com/developer-guides/tools/other-tools/scan-tool/) to identify potential issues such as code smells, bugs, and vulnerabilities. |
0 commit comments