|
| 1 | +/** |
| 2 | + * Provides classes modeling security-relevant aspects of the `squirrel` ORM package. |
| 3 | + */ |
| 4 | + |
| 5 | +import go |
| 6 | + |
| 7 | +/** |
| 8 | + * Provides classes modeling security-relevant aspects of the `squirrel` ORM package. |
| 9 | + */ |
| 10 | +module Squirrel { |
| 11 | + private string packagePath() { |
| 12 | + result = |
| 13 | + package([ |
| 14 | + "github.com/Masterminds/squirrel", |
| 15 | + "github.com/lann/squirrel", |
| 16 | + "gopkg.in/Masterminds/squirrel", |
| 17 | + ], "") |
| 18 | + } |
| 19 | + |
| 20 | + private class RowScan extends TaintTracking::FunctionModel, Method { |
| 21 | + FunctionInput inp; |
| 22 | + FunctionOutput outp; |
| 23 | + |
| 24 | + RowScan() { |
| 25 | + // signature: func (rs *RowScanner) Scan(dest ...interface{}) error |
| 26 | + this.hasQualifiedName(packagePath(), "Row", "Scan") and |
| 27 | + inp.isReceiver() and |
| 28 | + outp.isParameter(_) |
| 29 | + } |
| 30 | + |
| 31 | + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { |
| 32 | + input = inp and output = outp |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + private class RowScannerScan extends TaintTracking::FunctionModel, Method { |
| 37 | + FunctionInput inp; |
| 38 | + FunctionOutput outp; |
| 39 | + |
| 40 | + RowScannerScan() { |
| 41 | + // signature: func (rs *RowScanner) Scan(dest ...interface{}) error |
| 42 | + this.hasQualifiedName(packagePath(), "RowScanner", "Scan") and |
| 43 | + inp.isReceiver() and |
| 44 | + outp.isParameter(_) |
| 45 | + } |
| 46 | + |
| 47 | + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { |
| 48 | + input = inp and output = outp |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + private class BuilderScan extends TaintTracking::FunctionModel, Method { |
| 53 | + FunctionInput inp; |
| 54 | + FunctionOutput outp; |
| 55 | + |
| 56 | + BuilderScan() { |
| 57 | + // signature: func (rs *InsertBuilder) Scan(dest ...interface{}) error |
| 58 | + this.hasQualifiedName(packagePath(), |
| 59 | + ["DeleteBuilder", "InsertBuilder", "SelectBuilder", "UpdateBuilder"], "Scan") and |
| 60 | + inp.isReceiver() and |
| 61 | + outp.isParameter(_) |
| 62 | + } |
| 63 | + |
| 64 | + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { |
| 65 | + input = inp and output = outp |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + private class BuilderScanContext extends TaintTracking::FunctionModel, Method { |
| 70 | + FunctionInput inp; |
| 71 | + FunctionOutput outp; |
| 72 | + |
| 73 | + BuilderScanContext() { |
| 74 | + // signature: func (rs *InsertBuilder) Scan(dest ...interface{}) error |
| 75 | + this.hasQualifiedName(packagePath(), |
| 76 | + ["DeleteBuilder", "InsertBuilder", "SelectBuilder", "UpdateBuilder"], "ScanContext") and |
| 77 | + inp.isReceiver() and |
| 78 | + exists(int i | i > 0 | outp.isParameter(i)) |
| 79 | + } |
| 80 | + |
| 81 | + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { |
| 82 | + input = inp and output = outp |
| 83 | + } |
| 84 | + } |
| 85 | +} |
0 commit comments