|
| 1 | +/** |
| 2 | + * Models the `ActionMailbox` library, which is part of Rails. |
| 3 | + * Version: 7.0.4. |
| 4 | + */ |
| 5 | + |
| 6 | +private import codeql.ruby.AST |
| 7 | +private import codeql.ruby.Concepts |
| 8 | +private import codeql.ruby.DataFlow |
| 9 | +private import codeql.ruby.dataflow.RemoteFlowSources |
| 10 | + |
| 11 | +/** |
| 12 | + * Models the `ActionMailbox` library, which is part of Rails. |
| 13 | + * Version: 7.0.4. |
| 14 | + */ |
| 15 | +module ActionMailbox { |
| 16 | + private DataFlow::ClassNode controller() { |
| 17 | + result = DataFlow::getConstant("ActionMailbox").getConstant("Base").getADescendentModule() |
| 18 | + } |
| 19 | + |
| 20 | + /** |
| 21 | + * A method in a mailbox which receives incoming mail. |
| 22 | + */ |
| 23 | + class Process extends DataFlow::MethodNode { |
| 24 | + Process() { this = controller().getAnInstanceMethod() and this.getMethodName() = "process" } |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 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. |
| 30 | + */ |
| 31 | + class MailCall extends DataFlow::CallNode, Mail::Message::Range { |
| 32 | + MailCall() { this = controller().getAnInstanceSelf().getAMethodCall("mail") } |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Models classes from the `mail` library. |
| 37 | + * Version: 2.7.1. |
| 38 | + */ |
| 39 | + module Mail { |
| 40 | + /** |
| 41 | + * An instance of `Mail::Message`. |
| 42 | + */ |
| 43 | + class Message extends DataFlow::Node instanceof Message::Range { } |
| 44 | + |
| 45 | + module Message { |
| 46 | + abstract class Range extends DataFlow::Node { } |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * A method call on a `Mail::Message` object which may return data from a remote source. |
| 51 | + */ |
| 52 | + class RemoteContent extends DataFlow::CallNode, RemoteFlowSource::Range { |
| 53 | + RemoteContent() { |
| 54 | + this.getReceiver() instanceof Message and |
| 55 | + this.getMethodName() = |
| 56 | + [ |
| 57 | + "body", "to", "from", "raw_source", "subject", "from_address", "recipients_addresses", |
| 58 | + "cc_addresses", "bcc_addresses", "in_reply_to", "references", "reply_to", |
| 59 | + "raw_envelope", "to_s", "encoded", "header", "bcc", "cc", "text_part", "html_part" |
| 60 | + ] |
| 61 | + } |
| 62 | + |
| 63 | + override string getSourceType() { result = "ActionMailbox" } |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments