Skip to content

Commit 71f2d8f

Browse files
committed
Ruby: Model ActionMailbox#inbound_mail
1 parent eac5aa2 commit 71f2d8f

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActionMailbox.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@ module ActionMailbox {
2525
}
2626

2727
/**
28-
* A call to `ActionMailbox::Base#mail`, which is equivalent to calling `inbound_mail.mail`.
29-
* The returned object contains data from the incoming mail.
28+
* A call to `mail` on the return value of
29+
* `ActionMailbox::Base#inbound_email`, or a direct call to
30+
* `ActionMailbox::Base#mail`, which is equivalent. The returned object
31+
* contains data from the incoming email.
3032
*/
3133
class MailCall extends DataFlow::CallNode, Mail::Message::Range {
32-
MailCall() { this = controller().getAnInstanceSelf().getAMethodCall("mail") }
34+
MailCall() {
35+
this =
36+
[
37+
controller().getAnInstanceSelf().getAMethodCall("inbound_email").getAMethodCall("mail"),
38+
controller().getAnInstanceSelf().getAMethodCall("mail")
39+
]
40+
}
3341
}
3442

3543
/**
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
processMethods
2-
| action_mailbox.rb:2:3:5:5 | process |
3-
| action_mailbox.rb:13:5:15:7 | process |
2+
| action_mailbox.rb:2:3:7:5 | process |
3+
| action_mailbox.rb:15:5:17:7 | process |
44
messageInstances
55
| action_mailbox.rb:3:5:3:8 | call to mail |
66
| action_mailbox.rb:4:5:4:8 | call to mail |
7-
| action_mailbox.rb:8:5:8:8 | call to mail |
8-
| action_mailbox.rb:14:9:14:12 | call to mail |
7+
| action_mailbox.rb:6:5:6:10 | call to mail |
8+
| action_mailbox.rb:10:5:10:8 | call to mail |
9+
| action_mailbox.rb:16:9:16:12 | call to mail |
910
remoteContent
1011
| action_mailbox.rb:3:5:3:13 | call to body |
1112
| action_mailbox.rb:4:5:4:11 | call to to |
12-
| action_mailbox.rb:8:5:8:18 | call to text_part |
13-
| action_mailbox.rb:14:9:14:23 | call to raw_source |
13+
| action_mailbox.rb:6:5:6:13 | call to to |
14+
| action_mailbox.rb:10:5:10:18 | call to text_part |
15+
| action_mailbox.rb:16:9:16:23 | call to raw_source |

ruby/ql/test/library-tests/frameworks/action_mailbox/action_mailbox.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ class A < ActionMailbox::Base
22
def process
33
mail.body
44
mail.to
5+
m = inbound_email
6+
m.mail.to
57
end
68

79
def other_method

0 commit comments

Comments
 (0)