From f04a55ecb5dd892c50d248cb67ff795342a6fbdb Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 31 Oct 2024 10:57:46 +0100 Subject: [PATCH] Ruby: Update hash extension tests --- .../ActiveSupportDataFlow.expected | 72 +++++++++---------- .../active_support/hash_extensions.rb | 12 ++-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/ruby/ql/test/library-tests/frameworks/active_support/ActiveSupportDataFlow.expected b/ruby/ql/test/library-tests/frameworks/active_support/ActiveSupportDataFlow.expected index b2e219d1e50b..5a21191ca89f 100644 --- a/ruby/ql/test/library-tests/frameworks/active_support/ActiveSupportDataFlow.expected +++ b/ruby/ql/test/library-tests/frameworks/active_support/ActiveSupportDataFlow.expected @@ -63,19 +63,19 @@ edges | hash_extensions.rb:3:5:3:5 | x [element] | hash_extensions.rb:4:10:4:10 | x [element] | provenance | | | hash_extensions.rb:3:9:3:9 | h [element :a] | hash_extensions.rb:3:9:3:24 | call to stringify_keys [element] | provenance | | | hash_extensions.rb:3:9:3:24 | call to stringify_keys [element] | hash_extensions.rb:3:5:3:5 | x [element] | provenance | | -| hash_extensions.rb:4:10:4:10 | x [element] | hash_extensions.rb:4:10:4:14 | ...[...] | provenance | | -| hash_extensions.rb:10:5:10:5 | h [element :a] | hash_extensions.rb:11:9:11:9 | h [element :a] | provenance | | -| hash_extensions.rb:10:9:10:26 | call to [] [element :a] | hash_extensions.rb:10:5:10:5 | h [element :a] | provenance | | -| hash_extensions.rb:10:14:10:24 | call to source | hash_extensions.rb:10:9:10:26 | call to [] [element :a] | provenance | | +| hash_extensions.rb:4:10:4:10 | x [element] | hash_extensions.rb:4:10:4:15 | ...[...] | provenance | | +| hash_extensions.rb:10:5:10:5 | h [element a] | hash_extensions.rb:11:9:11:9 | h [element a] | provenance | | +| hash_extensions.rb:10:9:10:30 | call to [] [element a] | hash_extensions.rb:10:5:10:5 | h [element a] | provenance | | +| hash_extensions.rb:10:18:10:28 | call to source | hash_extensions.rb:10:9:10:30 | call to [] [element a] | provenance | | | hash_extensions.rb:11:5:11:5 | x [element] | hash_extensions.rb:12:10:12:10 | x [element] | provenance | | -| hash_extensions.rb:11:9:11:9 | h [element :a] | hash_extensions.rb:11:9:11:20 | call to to_options [element] | provenance | | +| hash_extensions.rb:11:9:11:9 | h [element a] | hash_extensions.rb:11:9:11:20 | call to to_options [element] | provenance | | | hash_extensions.rb:11:9:11:20 | call to to_options [element] | hash_extensions.rb:11:5:11:5 | x [element] | provenance | | | hash_extensions.rb:12:10:12:10 | x [element] | hash_extensions.rb:12:10:12:14 | ...[...] | provenance | | -| hash_extensions.rb:18:5:18:5 | h [element :a] | hash_extensions.rb:19:9:19:9 | h [element :a] | provenance | | -| hash_extensions.rb:18:9:18:26 | call to [] [element :a] | hash_extensions.rb:18:5:18:5 | h [element :a] | provenance | | -| hash_extensions.rb:18:14:18:24 | call to source | hash_extensions.rb:18:9:18:26 | call to [] [element :a] | provenance | | +| hash_extensions.rb:18:5:18:5 | h [element a] | hash_extensions.rb:19:9:19:9 | h [element a] | provenance | | +| hash_extensions.rb:18:9:18:30 | call to [] [element a] | hash_extensions.rb:18:5:18:5 | h [element a] | provenance | | +| hash_extensions.rb:18:18:18:28 | call to source | hash_extensions.rb:18:9:18:30 | call to [] [element a] | provenance | | | hash_extensions.rb:19:5:19:5 | x [element] | hash_extensions.rb:20:10:20:10 | x [element] | provenance | | -| hash_extensions.rb:19:9:19:9 | h [element :a] | hash_extensions.rb:19:9:19:24 | call to symbolize_keys [element] | provenance | | +| hash_extensions.rb:19:9:19:9 | h [element a] | hash_extensions.rb:19:9:19:24 | call to symbolize_keys [element] | provenance | | | hash_extensions.rb:19:9:19:24 | call to symbolize_keys [element] | hash_extensions.rb:19:5:19:5 | x [element] | provenance | | | hash_extensions.rb:20:10:20:10 | x [element] | hash_extensions.rb:20:10:20:14 | ...[...] | provenance | | | hash_extensions.rb:26:5:26:5 | h [element :a] | hash_extensions.rb:27:9:27:9 | h [element :a] | provenance | | @@ -84,12 +84,12 @@ edges | hash_extensions.rb:27:5:27:5 | x [element] | hash_extensions.rb:28:10:28:10 | x [element] | provenance | | | hash_extensions.rb:27:9:27:9 | h [element :a] | hash_extensions.rb:27:9:27:29 | call to deep_stringify_keys [element] | provenance | | | hash_extensions.rb:27:9:27:29 | call to deep_stringify_keys [element] | hash_extensions.rb:27:5:27:5 | x [element] | provenance | | -| hash_extensions.rb:28:10:28:10 | x [element] | hash_extensions.rb:28:10:28:14 | ...[...] | provenance | | -| hash_extensions.rb:34:5:34:5 | h [element :a] | hash_extensions.rb:35:9:35:9 | h [element :a] | provenance | | -| hash_extensions.rb:34:9:34:26 | call to [] [element :a] | hash_extensions.rb:34:5:34:5 | h [element :a] | provenance | | -| hash_extensions.rb:34:14:34:24 | call to source | hash_extensions.rb:34:9:34:26 | call to [] [element :a] | provenance | | +| hash_extensions.rb:28:10:28:10 | x [element] | hash_extensions.rb:28:10:28:15 | ...[...] | provenance | | +| hash_extensions.rb:34:5:34:5 | h [element a] | hash_extensions.rb:35:9:35:9 | h [element a] | provenance | | +| hash_extensions.rb:34:9:34:30 | call to [] [element a] | hash_extensions.rb:34:5:34:5 | h [element a] | provenance | | +| hash_extensions.rb:34:18:34:28 | call to source | hash_extensions.rb:34:9:34:30 | call to [] [element a] | provenance | | | hash_extensions.rb:35:5:35:5 | x [element] | hash_extensions.rb:36:10:36:10 | x [element] | provenance | | -| hash_extensions.rb:35:9:35:9 | h [element :a] | hash_extensions.rb:35:9:35:29 | call to deep_symbolize_keys [element] | provenance | | +| hash_extensions.rb:35:9:35:9 | h [element a] | hash_extensions.rb:35:9:35:29 | call to deep_symbolize_keys [element] | provenance | | | hash_extensions.rb:35:9:35:29 | call to deep_symbolize_keys [element] | hash_extensions.rb:35:5:35:5 | x [element] | provenance | | | hash_extensions.rb:36:10:36:10 | x [element] | hash_extensions.rb:36:10:36:14 | ...[...] | provenance | | | hash_extensions.rb:42:5:42:5 | h [element :a] | hash_extensions.rb:43:9:43:9 | h [element :a] | provenance | | @@ -98,7 +98,7 @@ edges | hash_extensions.rb:43:5:43:5 | x [element] | hash_extensions.rb:44:10:44:10 | x [element] | provenance | | | hash_extensions.rb:43:9:43:9 | h [element :a] | hash_extensions.rb:43:9:43:33 | call to with_indifferent_access [element] | provenance | | | hash_extensions.rb:43:9:43:33 | call to with_indifferent_access [element] | hash_extensions.rb:43:5:43:5 | x [element] | provenance | | -| hash_extensions.rb:44:10:44:10 | x [element] | hash_extensions.rb:44:10:44:14 | ...[...] | provenance | | +| hash_extensions.rb:44:10:44:10 | x [element] | hash_extensions.rb:44:10:44:15 | ...[...] | provenance | | | hash_extensions.rb:50:5:50:5 | h [element :a] | hash_extensions.rb:51:9:51:9 | h [element :a] | provenance | | | hash_extensions.rb:50:5:50:5 | h [element :b] | hash_extensions.rb:51:9:51:9 | h [element :b] | provenance | | | hash_extensions.rb:50:5:50:5 | h [element :d] | hash_extensions.rb:51:9:51:9 | h [element :d] | provenance | | @@ -309,20 +309,20 @@ nodes | hash_extensions.rb:3:9:3:9 | h [element :a] | semmle.label | h [element :a] | | hash_extensions.rb:3:9:3:24 | call to stringify_keys [element] | semmle.label | call to stringify_keys [element] | | hash_extensions.rb:4:10:4:10 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:4:10:4:14 | ...[...] | semmle.label | ...[...] | -| hash_extensions.rb:10:5:10:5 | h [element :a] | semmle.label | h [element :a] | -| hash_extensions.rb:10:9:10:26 | call to [] [element :a] | semmle.label | call to [] [element :a] | -| hash_extensions.rb:10:14:10:24 | call to source | semmle.label | call to source | +| hash_extensions.rb:4:10:4:15 | ...[...] | semmle.label | ...[...] | +| hash_extensions.rb:10:5:10:5 | h [element a] | semmle.label | h [element a] | +| hash_extensions.rb:10:9:10:30 | call to [] [element a] | semmle.label | call to [] [element a] | +| hash_extensions.rb:10:18:10:28 | call to source | semmle.label | call to source | | hash_extensions.rb:11:5:11:5 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:11:9:11:9 | h [element :a] | semmle.label | h [element :a] | +| hash_extensions.rb:11:9:11:9 | h [element a] | semmle.label | h [element a] | | hash_extensions.rb:11:9:11:20 | call to to_options [element] | semmle.label | call to to_options [element] | | hash_extensions.rb:12:10:12:10 | x [element] | semmle.label | x [element] | | hash_extensions.rb:12:10:12:14 | ...[...] | semmle.label | ...[...] | -| hash_extensions.rb:18:5:18:5 | h [element :a] | semmle.label | h [element :a] | -| hash_extensions.rb:18:9:18:26 | call to [] [element :a] | semmle.label | call to [] [element :a] | -| hash_extensions.rb:18:14:18:24 | call to source | semmle.label | call to source | +| hash_extensions.rb:18:5:18:5 | h [element a] | semmle.label | h [element a] | +| hash_extensions.rb:18:9:18:30 | call to [] [element a] | semmle.label | call to [] [element a] | +| hash_extensions.rb:18:18:18:28 | call to source | semmle.label | call to source | | hash_extensions.rb:19:5:19:5 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:19:9:19:9 | h [element :a] | semmle.label | h [element :a] | +| hash_extensions.rb:19:9:19:9 | h [element a] | semmle.label | h [element a] | | hash_extensions.rb:19:9:19:24 | call to symbolize_keys [element] | semmle.label | call to symbolize_keys [element] | | hash_extensions.rb:20:10:20:10 | x [element] | semmle.label | x [element] | | hash_extensions.rb:20:10:20:14 | ...[...] | semmle.label | ...[...] | @@ -333,12 +333,12 @@ nodes | hash_extensions.rb:27:9:27:9 | h [element :a] | semmle.label | h [element :a] | | hash_extensions.rb:27:9:27:29 | call to deep_stringify_keys [element] | semmle.label | call to deep_stringify_keys [element] | | hash_extensions.rb:28:10:28:10 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:28:10:28:14 | ...[...] | semmle.label | ...[...] | -| hash_extensions.rb:34:5:34:5 | h [element :a] | semmle.label | h [element :a] | -| hash_extensions.rb:34:9:34:26 | call to [] [element :a] | semmle.label | call to [] [element :a] | -| hash_extensions.rb:34:14:34:24 | call to source | semmle.label | call to source | +| hash_extensions.rb:28:10:28:15 | ...[...] | semmle.label | ...[...] | +| hash_extensions.rb:34:5:34:5 | h [element a] | semmle.label | h [element a] | +| hash_extensions.rb:34:9:34:30 | call to [] [element a] | semmle.label | call to [] [element a] | +| hash_extensions.rb:34:18:34:28 | call to source | semmle.label | call to source | | hash_extensions.rb:35:5:35:5 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:35:9:35:9 | h [element :a] | semmle.label | h [element :a] | +| hash_extensions.rb:35:9:35:9 | h [element a] | semmle.label | h [element a] | | hash_extensions.rb:35:9:35:29 | call to deep_symbolize_keys [element] | semmle.label | call to deep_symbolize_keys [element] | | hash_extensions.rb:36:10:36:10 | x [element] | semmle.label | x [element] | | hash_extensions.rb:36:10:36:14 | ...[...] | semmle.label | ...[...] | @@ -349,7 +349,7 @@ nodes | hash_extensions.rb:43:9:43:9 | h [element :a] | semmle.label | h [element :a] | | hash_extensions.rb:43:9:43:33 | call to with_indifferent_access [element] | semmle.label | call to with_indifferent_access [element] | | hash_extensions.rb:44:10:44:10 | x [element] | semmle.label | x [element] | -| hash_extensions.rb:44:10:44:14 | ...[...] | semmle.label | ...[...] | +| hash_extensions.rb:44:10:44:15 | ...[...] | semmle.label | ...[...] | | hash_extensions.rb:50:5:50:5 | h [element :a] | semmle.label | h [element :a] | | hash_extensions.rb:50:5:50:5 | h [element :b] | semmle.label | h [element :b] | | hash_extensions.rb:50:5:50:5 | h [element :d] | semmle.label | h [element :d] | @@ -516,12 +516,12 @@ testFailures | active_support.rb:283:8:283:17 | call to presence | active_support.rb:282:7:282:16 | call to source | active_support.rb:283:8:283:17 | call to presence | $@ | active_support.rb:282:7:282:16 | call to source | call to source | | active_support.rb:286:8:286:17 | call to presence | active_support.rb:285:7:285:16 | call to source | active_support.rb:286:8:286:17 | call to presence | $@ | active_support.rb:285:7:285:16 | call to source | call to source | | active_support.rb:291:8:291:17 | call to deep_dup | active_support.rb:290:7:290:16 | call to source | active_support.rb:291:8:291:17 | call to deep_dup | $@ | active_support.rb:290:7:290:16 | call to source | call to source | -| hash_extensions.rb:4:10:4:14 | ...[...] | hash_extensions.rb:2:14:2:24 | call to source | hash_extensions.rb:4:10:4:14 | ...[...] | $@ | hash_extensions.rb:2:14:2:24 | call to source | call to source | -| hash_extensions.rb:12:10:12:14 | ...[...] | hash_extensions.rb:10:14:10:24 | call to source | hash_extensions.rb:12:10:12:14 | ...[...] | $@ | hash_extensions.rb:10:14:10:24 | call to source | call to source | -| hash_extensions.rb:20:10:20:14 | ...[...] | hash_extensions.rb:18:14:18:24 | call to source | hash_extensions.rb:20:10:20:14 | ...[...] | $@ | hash_extensions.rb:18:14:18:24 | call to source | call to source | -| hash_extensions.rb:28:10:28:14 | ...[...] | hash_extensions.rb:26:14:26:24 | call to source | hash_extensions.rb:28:10:28:14 | ...[...] | $@ | hash_extensions.rb:26:14:26:24 | call to source | call to source | -| hash_extensions.rb:36:10:36:14 | ...[...] | hash_extensions.rb:34:14:34:24 | call to source | hash_extensions.rb:36:10:36:14 | ...[...] | $@ | hash_extensions.rb:34:14:34:24 | call to source | call to source | -| hash_extensions.rb:44:10:44:14 | ...[...] | hash_extensions.rb:42:14:42:24 | call to source | hash_extensions.rb:44:10:44:14 | ...[...] | $@ | hash_extensions.rb:42:14:42:24 | call to source | call to source | +| hash_extensions.rb:4:10:4:15 | ...[...] | hash_extensions.rb:2:14:2:24 | call to source | hash_extensions.rb:4:10:4:15 | ...[...] | $@ | hash_extensions.rb:2:14:2:24 | call to source | call to source | +| hash_extensions.rb:12:10:12:14 | ...[...] | hash_extensions.rb:10:18:10:28 | call to source | hash_extensions.rb:12:10:12:14 | ...[...] | $@ | hash_extensions.rb:10:18:10:28 | call to source | call to source | +| hash_extensions.rb:20:10:20:14 | ...[...] | hash_extensions.rb:18:18:18:28 | call to source | hash_extensions.rb:20:10:20:14 | ...[...] | $@ | hash_extensions.rb:18:18:18:28 | call to source | call to source | +| hash_extensions.rb:28:10:28:15 | ...[...] | hash_extensions.rb:26:14:26:24 | call to source | hash_extensions.rb:28:10:28:15 | ...[...] | $@ | hash_extensions.rb:26:14:26:24 | call to source | call to source | +| hash_extensions.rb:36:10:36:14 | ...[...] | hash_extensions.rb:34:18:34:28 | call to source | hash_extensions.rb:36:10:36:14 | ...[...] | $@ | hash_extensions.rb:34:18:34:28 | call to source | call to source | +| hash_extensions.rb:44:10:44:15 | ...[...] | hash_extensions.rb:42:14:42:24 | call to source | hash_extensions.rb:44:10:44:15 | ...[...] | $@ | hash_extensions.rb:42:14:42:24 | call to source | call to source | | hash_extensions.rb:56:10:56:14 | ...[...] | hash_extensions.rb:50:52:50:61 | call to taint | hash_extensions.rb:56:10:56:14 | ...[...] | $@ | hash_extensions.rb:50:52:50:61 | call to taint | call to taint | | hash_extensions.rb:58:10:58:14 | ...[...] | hash_extensions.rb:50:14:50:23 | call to taint | hash_extensions.rb:58:10:58:14 | ...[...] | $@ | hash_extensions.rb:50:14:50:23 | call to taint | call to taint | | hash_extensions.rb:59:10:59:14 | ...[...] | hash_extensions.rb:50:29:50:38 | call to taint | hash_extensions.rb:59:10:59:14 | ...[...] | $@ | hash_extensions.rb:50:29:50:38 | call to taint | call to taint | diff --git a/ruby/ql/test/library-tests/frameworks/active_support/hash_extensions.rb b/ruby/ql/test/library-tests/frameworks/active_support/hash_extensions.rb index 63d4e7a588da..9222620fef4d 100644 --- a/ruby/ql/test/library-tests/frameworks/active_support/hash_extensions.rb +++ b/ruby/ql/test/library-tests/frameworks/active_support/hash_extensions.rb @@ -1,13 +1,13 @@ def m_stringify_keys h = { a: source("a") } x = h.stringify_keys - sink x[:a] # $hasValueFlow=a + sink x["a"] # $hasValueFlow=a end m_stringify_keys() def m_to_options - h = { a: source("a") } + h = { "a" => source("a") } x = h.to_options sink x[:a] # $hasValueFlow=a end @@ -15,7 +15,7 @@ def m_to_options m_to_options() def m_symbolize_keys - h = { a: source("a") } + h = { "a" => source("a") } x = h.symbolize_keys sink x[:a] # $hasValueFlow=a end @@ -25,13 +25,13 @@ def m_symbolize_keys def m_deep_stringify_keys h = { a: source("a") } x = h.deep_stringify_keys - sink x[:a] # $hasValueFlow=a + sink x["a"] # $hasValueFlow=a end m_deep_stringify_keys() def m_deep_symbolize_keys - h = { a: source("a") } + h = { "a" => source("a") } x = h.deep_symbolize_keys sink x[:a] # $hasValueFlow=a end @@ -41,7 +41,7 @@ def m_deep_symbolize_keys def m_with_indifferent_access h = { a: source("a") } x = h.with_indifferent_access - sink x[:a] # $hasValueFlow=a + sink x["a"] # $hasValueFlow=a end m_with_indifferent_access()