Skip to content

Commit 9853651

Browse files
committed
Fix possible xpath injection
1 parent 45f9493 commit 9853651

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/xml_security.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def validate_signature(base64_cert, soft = true)
256256
REXML::XPath.each(@sig_element, "//ds:Reference", {"ds"=>DSIG}) do |ref|
257257
uri = ref.attributes.get_attribute("URI").value
258258

259-
hashed_element = document.at_xpath("//*[@ID='#{uri[1..-1]}']")
259+
hashed_element = document.at_xpath("//*[@ID=$uri]", nil, { 'uri' => uri[1..-1] })
260260
canon_algorithm = canon_algorithm REXML::XPath.first(
261261
ref,
262262
'//ds:CanonicalizationMethod',

0 commit comments

Comments
 (0)