String interpolation
Encyclopedia
String interpolation is a common feature in many programming language
s such as Ruby
, PHP
, Perl
, etc. It means to insert a string
or replace a variable with its value. It makes string formatting and specifying contents more intuitive.
The output will be:
The output will be:
The output will be:
The output will be:
The output will be:
The output will be:
, Script Injection, XML External Entity Injection (XXE), and Cross Site Scripting (XSS) attacks.
An example of SQL Injection will be like this:
If id is replaced with "'; DELETE FROM Table WHERE = '", executing this query will wipe out all the data on the local machine.
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s such as Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
, PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
, Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
, etc. It means to insert a string
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
or replace a variable with its value. It makes string formatting and specifying contents more intuitive.
PHP
The output will be:
Perl
The output will be:
Ruby
The output will be:
BOO
The output will be:
CoffeeScript
The output will be:
Python
The output will be:
Security Issues
String Interpolation, like string concatenation, may lead to security problems. When failed to properly escape or filter user input data, system will expose to SQL InjectionSQL injection
A SQL injection is often used to attack the security of a website by inputting SQL statements in a web form to get a badly designed website in order to dump the database content to the attacker. SQL injection is a code injection technique that exploits a security vulnerability in a website's software...
, Script Injection, XML External Entity Injection (XXE), and Cross Site Scripting (XSS) attacks.
An example of SQL Injection will be like this:
If id is replaced with "'; DELETE FROM Table WHERE = '", executing this query will wipe out all the data on the local machine.