Skip to content

Commit ed9477a

Browse files
committed
Ruby: Clarify that deserialization following a schema is safe
1 parent 4e47f77 commit ed9477a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ruby/ql/src/queries/security/cwe-502/UnsafeDeserialization.qhelp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Deserializing untrusted data using any method that allows the construction of
77
arbitrary objects is easily exploitable and, in many cases, allows an attacker
88
to execute arbitrary code.
99
</p>
10+
<p>
11+
Note that a deserialization method is only dangerous if it can instantiate
12+
arbitrary classes or objects. Serialization frameworks that use a schema to instantiate
13+
only expected, predefined types are generally not tracked by this query. Such
14+
frameworks are generally safe with respect to arbitrary-class-instantiation and
15+
gadget-chain attacks when the schema is trusted and does not permit
16+
user-controlled type resolution.
17+
</p>
1018
</overview>
1119

1220
<recommendation>
@@ -31,7 +39,7 @@ safely be used.
3139
If deserializing an untrusted XML document using the <code>ox</code> gem,
3240
do not use <code>parse_obj</code> and <code>load</code> using the non-default :object mode.
3341
Instead use the <code>load</code> method in the default mode or better explicitly set a safe
34-
mode such as :hash.
42+
mode such as :hash.
3543
</p>
3644

3745
<p>

0 commit comments

Comments
 (0)