OutSystems enables customers to develop applications in record time using a visual language in Service Studio. Each time a developer performs a publish operation, the visual code is translated into a specific format and uploaded to the OutSystems Platform Server where the Code generator converts it to source code (.NET/C#). The code is then deployed in application servers where it is executed.
In order to be able to perform Static Code Analysis for Security purposes, customers need to obtain the source code and submit it for analysis.
This document describes the static code analysis process for security purposes, starting at the export of the source code generated by the Code generator, to analyzing the results.
When dealing with the static code analysis process, there are some architecture considerations to be taken into account, namely when using OutSystems Cloud or On-Premises deployments and web or mobile applications. The description and process of implementing SAST for Web applications can be found below.
Extracting Web Applications source code
As a best practice for frequently running static code analysis, consider licensing an additional production environment, and use it to run your static code analysis.
The share folder with the source code is not available to customers using the OutSystems Cloud. Thus, customers need to have a self-managed environment and use Lifetime (running on the OutSystems Cloud) to stage code to the customer-managed environment where static code analysis will run. The requirements are explained below.
It is not possible to extract the code generated by OutSystems directly from the OutSystems Cloud. In order to obtain the generated code, Customers must have at least one On-Premise environment meaning that a Hybrid Deployment is necessary.
Hybrid deployments enable Customers to have some environments On-Premises (or other cloud providers) and other environments hosted on OutSystems Cloud.
In order to successfully create a Hybrid deployment, instructions can be found here.
From this point, obtaining the applications source code for static code analysis is the same as an on-premise installation.
Customers that have an OutSystems On-Premise installation can obtain the code to perform Static Code analysis following the instructions below.
When reviewing static code analysis results, it is important to keep in mind that each static code analysis tool will report on findings without a proper context. These findings must be reviewed to detect false positives and experts in OutSystems development shall be consulted to help on understanding those findings in the proper context.
Following are some examples of such findings and why they should be considered false positives.
Code Injection: Improper neutralization of directives in dynamically evaluated code (Eval Injection)
These potential threats in the form of inline scripts would only be possible to execute if the application is not protected against XSS attacks. OutSystems is by default well protected against this and customers need to specifically allow inline expressions in order to open up for this attack. These openings are accompanied with security warnings at design time, in the Service Studio (OutSystems IDE).
In order to increase the security level, there is a mechanism described in Apply Content Security Policy article.
More information can be found here.
Credentials Management: Use of hard-coded passwords
Details: Static code analysis tools typically raise a flag when the password word is anywhere in the code.
The files where this flag is normally raised are SQL Server, Oracle and DB2 database connectors. None of these files have hard-coded passwords, but they do have variables named password. All values for the password variables are obtained dynamically.
This can be verified using decompiler tools and inspect the flagged DLL files to confirm that there are no hard-coded passwords there.
Cross-site Scripting (XSS): Improper neutralization of script-related HTML tags in a web page
Details: Most of the flags will be raised on file osjs.js. This happens because OutSystems uses the jQuery query selector $, which is known for being vulnerable to XSS in some earlier versions of jQuery, including the one that the platform uses.
OutSystems makes its own implementation of $, protecting it against XSS, so this is likely a false positive.
More information about this can be found in this article.
Cryptographic Issues: Use of a broken or risky cryptographic algorithm
Details: This issue is typically flagged when default random generators or hashing functions are used, assuming that those functions are being used for cryptographic or security related operations. This may not be the case and using a random() or hash() is perfectly fine if the results of those functions are not used to encrypt or authenticate content.
Since OutSystems does not use weak functions for cryptographic ends, this should be considered a false positive. This finding is commonly flagged when analyzing the file OutSystems.RuntimeCommon.dll, which contains some random and hash functions but they are not used for cryptographic or security-related operations.
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Details: OutSystems does not explicitly perform SQL Injection validation on all SQL queries that are executed by applications. However, the platform has a SQL sanitization built-in action available that allows developers to validate all user inputs that are going to be used in SQL statements.
Therefore, it is the developer’s responsibility to guarantee that all user inputs are sanitizing before being used in a SQL statement. Moreover, OutSystems displays a warning at design and compile time when a pattern that may introduce a SQL Injection vulnerability is detected.
Technical Support from OutSystems
Technical Support and OutSystems Security Teams are ready to discuss the findings of the static code analysis with customers, as follows:
We expect customers to involve one of their trained OutSystems engineers to do a preliminary analysis of the report, and report to OutSystems Technical Support only the issues that are likely to be caused by the platform.
The list of issues reported to OutSystems Technical Support should exclude issues that can be fixed by developers, by changing its OutSystems applications.
Technical Support's reply may include:
- A reasoned identification of false positives;
- A reasoned adjustment of severity based on the specifics of the technical environment;
- An escalation of eventual product defects to R&D;
- The classification of an issue as "to be solved in the application”.
Furthermore, the following tables can help understand the responsibilities and expectations by deployment model: