Skip to content

Avoid Hardcoded and Unescaped Raw HTML in Source Code ​

WarningSecurity & Robustness#EC NO_RAW_HTMLRemote Enabled

Overview ​

Avoid raw unescaped HTML tags in strings and templates.

ATC Finding Message: Avoid hardcoded raw HTML; use UI5, BSP, or cl_abap_format/escape to prevent XSS

Rationale ​

Embedding raw HTML markup strings (<div>, <script>, <table>) directly in ABAP source code creates Cross-Site Scripting (XSS) vulnerabilities (OWASP A03 / CWE-79) and couples backend logic to user interface rendering. When dynamic values are concatenated into raw HTML without strict escaping, malicious scripts can be executed in the user's browser session.

Best Practice: Separate presentation from logic using SAP Fiori / SAPUI5, BSP extensions, or use cl_abap_format / escape( ... format = cl_abap_format=>e_html_text ) to sanitize HTML output.

Non-Compliant ​

abap
" Anti-pattern: Concatenating unescaped user data into raw HTML
DATA(lv_html) = |<div class="user-info"><b>{ lv_name }</b></div>|.

Compliant ​

abap
" Clean ABAP: Use UI framework or encode output to prevent XSS
DATA(lv_safe_name) = escape( val = lv_name format = cl_abap_format=>e_html_text ).
DATA(lv_html) = |<div class="user-info"><b>{ lv_safe_name }</b></div>|. "#EC NO_RAW_HTML

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
CHECK_SCRIPTSBooleantrueDetect high-risk script and iframe HTML tags
CHECK_TAGSBooleantrueDetect structural HTML tags (div, table, form, etc.)

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC NO_RAW_HTML

" SAP CI_ prefix format:
... "#EC CI_NO_RAW_HTML

Technical Details ​

Released under the MIT License.