|
| 1 | +/** |
| 2 | + * Provides classes modeling security-relevant aspects of the `container/list` package. |
| 3 | + */ |
| 4 | + |
| 5 | +import go |
| 6 | + |
| 7 | +/** Provides models of commonly used functions in the `container/list` package. */ |
| 8 | +module ContainerList { |
| 9 | + private class MethodModels extends TaintTracking::FunctionModel, Method { |
| 10 | + FunctionInput inp; |
| 11 | + FunctionOutput outp; |
| 12 | + |
| 13 | + MethodModels() { |
| 14 | + // signature: func (*Element).Next() *Element |
| 15 | + this.hasQualifiedName("container/list", "Element", "Next") and |
| 16 | + (inp.isReceiver() and outp.isResult()) |
| 17 | + or |
| 18 | + // signature: func (*Element).Prev() *Element |
| 19 | + this.hasQualifiedName("container/list", "Element", "Prev") and |
| 20 | + (inp.isReceiver() and outp.isResult()) |
| 21 | + or |
| 22 | + // signature: func (*List).Back() *Element |
| 23 | + this.hasQualifiedName("container/list", "List", "Back") and |
| 24 | + (inp.isReceiver() and outp.isResult()) |
| 25 | + or |
| 26 | + // signature: func (*List).Front() *Element |
| 27 | + this.hasQualifiedName("container/list", "List", "Front") and |
| 28 | + (inp.isReceiver() and outp.isResult()) |
| 29 | + or |
| 30 | + // signature: func (*List).Init() *List |
| 31 | + this.hasQualifiedName("container/list", "List", "Init") and |
| 32 | + (inp.isReceiver() and outp.isResult()) |
| 33 | + or |
| 34 | + // signature: func (*List).InsertAfter(v interface{}, mark *Element) *Element |
| 35 | + this.hasQualifiedName("container/list", "List", "InsertAfter") and |
| 36 | + ( |
| 37 | + inp.isParameter(0) and |
| 38 | + (outp.isReceiver() or outp.isResult()) |
| 39 | + ) |
| 40 | + or |
| 41 | + // signature: func (*List).InsertBefore(v interface{}, mark *Element) *Element |
| 42 | + this.hasQualifiedName("container/list", "List", "InsertBefore") and |
| 43 | + ( |
| 44 | + inp.isParameter(0) and |
| 45 | + (outp.isReceiver() or outp.isResult()) |
| 46 | + ) |
| 47 | + or |
| 48 | + // signature: func (*List).MoveAfter(e *Element, mark *Element) |
| 49 | + this.hasQualifiedName("container/list", "List", "MoveAfter") and |
| 50 | + (inp.isParameter(0) and outp.isReceiver()) |
| 51 | + or |
| 52 | + // signature: func (*List).MoveBefore(e *Element, mark *Element) |
| 53 | + this.hasQualifiedName("container/list", "List", "MoveBefore") and |
| 54 | + (inp.isParameter(0) and outp.isReceiver()) |
| 55 | + or |
| 56 | + // signature: func (*List).MoveToBack(e *Element) |
| 57 | + this.hasQualifiedName("container/list", "List", "MoveToBack") and |
| 58 | + (inp.isParameter(0) and outp.isReceiver()) |
| 59 | + or |
| 60 | + // signature: func (*List).MoveToFront(e *Element) |
| 61 | + this.hasQualifiedName("container/list", "List", "MoveToFront") and |
| 62 | + (inp.isParameter(0) and outp.isReceiver()) |
| 63 | + or |
| 64 | + // signature: func (*List).PushBack(v interface{}) *Element |
| 65 | + this.hasQualifiedName("container/list", "List", "PushBack") and |
| 66 | + ( |
| 67 | + inp.isParameter(0) and |
| 68 | + (outp.isReceiver() or outp.isResult()) |
| 69 | + ) |
| 70 | + or |
| 71 | + // signature: func (*List).PushBackList(other *List) |
| 72 | + this.hasQualifiedName("container/list", "List", "PushBackList") and |
| 73 | + (inp.isParameter(0) and outp.isReceiver()) |
| 74 | + or |
| 75 | + // signature: func (*List).PushFront(v interface{}) *Element |
| 76 | + this.hasQualifiedName("container/list", "List", "PushFront") and |
| 77 | + ( |
| 78 | + inp.isParameter(0) and |
| 79 | + (outp.isReceiver() or outp.isResult()) |
| 80 | + ) |
| 81 | + or |
| 82 | + // signature: func (*List).PushFrontList(other *List) |
| 83 | + this.hasQualifiedName("container/list", "List", "PushFrontList") and |
| 84 | + (inp.isParameter(0) and outp.isReceiver()) |
| 85 | + or |
| 86 | + // signature: func (*List).Remove(e *Element) interface{} |
| 87 | + this.hasQualifiedName("container/list", "List", "Remove") and |
| 88 | + (inp.isParameter(0) and outp.isResult()) |
| 89 | + } |
| 90 | + |
| 91 | + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { |
| 92 | + input = inp and output = outp |
| 93 | + } |
| 94 | + } |
| 95 | +} |
0 commit comments