|
| 1 | +/** Definitions of taint steps in the IO package of the Guava framework */ |
| 2 | + |
| 3 | +import java |
| 4 | +private import semmle.code.java.dataflow.ExternalFlow |
| 5 | + |
| 6 | +private class GuavaIoCsv extends SummaryModelCsv { |
| 7 | + override predicate row(string row) { |
| 8 | + row = |
| 9 | + [ |
| 10 | + //"package;type;overrides;name;signature;ext;inputspec;outputspec;kind", |
| 11 | + "com.google.common.io;BaseEncoding;true;decode;(CharSequence);;Argument[0];ReturnValue;taint", |
| 12 | + "com.google.common.io;BaseEncoding;true;decodingStream;(Reader);;Argument[0];ReturnValue;taint", |
| 13 | + "com.google.common.io;BaseEncoding;true;decodingSource;(CharSource);;Argument[0];ReturnValue;taint", |
| 14 | + "com.google.common.io;BaseEncoding;true;encode;(byte[]);;Argument[0];ReturnValue;taint", |
| 15 | + "com.google.common.io;BaseEncoding;true;encode;(byte[],int,int);;Argument[0];ReturnValue;taint", |
| 16 | + "com.google.common.io;BaseEncoding;true;withSeparator;(String,int);;Argument[0];ReturnValue;taint", |
| 17 | + "com.google.common.io;BaseEncoding;true;decode;(CharSequence);;Argument[-1];ReturnValue;taint", |
| 18 | + "com.google.common.io;BaseEncoding;true;decodingStream;(Reader);;Argument[-1];ReturnValue;taint", |
| 19 | + "com.google.common.io;BaseEncoding;true;decodingSource;(CharSource);;Argument[-1];ReturnValue;taint", |
| 20 | + "com.google.common.io;BaseEncoding;true;encode;(byte[]);;Argument[-1];ReturnValue;taint", |
| 21 | + "com.google.common.io;BaseEncoding;true;upperCase;();;Argument[-1];ReturnValue;taint", |
| 22 | + "com.google.common.io;BaseEncoding;true;lowerCase;();;Argument[-1];ReturnValue;taint", |
| 23 | + "com.google.common.io;BaseEncoding;true;withPadChar;(char);;Argument[-1];ReturnValue;taint", |
| 24 | + "com.google.common.io;BaseEncoding;true;omitPadding;();;Argument[-1];ReturnValue;taint", |
| 25 | + "com.google.common.io;BaseEncoding;true;encode;(byte[],int,int);;Argument[-1];ReturnValue;taint", |
| 26 | + "com.google.common.io;ByteSource;true;asCharSource;(Charset);;Argument[-1];ReturnValue;taint", |
| 27 | + "com.google.common.io;ByteSource;true;concat;;;Argument[0];ReturnValue;taint", |
| 28 | + "com.google.common.io;ByteSource;true;copyTo;(OutputStream);;Argument[-1];Argument[0];taint", |
| 29 | + "com.google.common.io;ByteSource;true;openStream;();;Argument[-1];ReturnValue;taint", |
| 30 | + "com.google.common.io;ByteSource;true;openBufferedStream;();;Argument[-1];ReturnValue;taint", |
| 31 | + "com.google.common.io;ByteSource;true;read;();;Argument[-1];ReturnValue;taint", |
| 32 | + "com.google.common.io;ByteSource;true;slice;(long,long);;Argument[-1];ReturnValue;taint", |
| 33 | + "com.google.common.io;ByteSource;true;wrap;(byte[]);;Argument[0];ReturnValue;taint", |
| 34 | + "com.google.common.io;ByteStreams;false;copy;(InputStream,OutputStream);;Argument[0];Argument[1];taint", |
| 35 | + "com.google.common.io;ByteStreams;false;copy;(ReadablyByteChannel,WritableByteChannel);;Argument[0];Argument[1];taint", |
| 36 | + "com.google.common.io;ByteStreams;false;limit;(InputStream,long);;Argument[0];ReturnValue;taint", |
| 37 | + "com.google.common.io;ByteStreams;false;newDataInput;(byte[]);;Argument[0];ReturnValue;taint", |
| 38 | + "com.google.common.io;ByteStreams;false;newDataInput;(byte[],int);;Argument[0];ReturnValue;taint", |
| 39 | + "com.google.common.io;ByteStreams;false;newDataInput;(ByteArrayInputStream);;Argument[0];ReturnValue;taint", |
| 40 | + "com.google.common.io;ByteStreams;false;newDataOutput;(ByteArrayOutputStream);;Argument[0];ReturnValue;taint", |
| 41 | + "com.google.common.io;ByteStreams;false;read;(InputStream,byte[],int,int);;Argument[0];Argument[1];taint", |
| 42 | + "com.google.common.io;ByteStreams;false;readFully;(InputStream,byte[]);;Argument[0];Argument[1];taint", |
| 43 | + "com.google.common.io;ByteStreams;false;readFully;(InputStream,byte[],int,int);;Argument[0];Argument[1];taint", |
| 44 | + "com.google.common.io;ByteStreams;false;toByteArray;(InputStream);;Argument[0];ReturnValue;taint", |
| 45 | + "com.google.common.io;CharSource;true;asByteSource;(Charset);;Argument[-1];ReturnValue;taint", |
| 46 | + "com.google.common.io;CharSource;true;concat;;;Argument[0];ReturnValue;taint", |
| 47 | + "com.google.common.io;CharSource;true;copyTo;(Appendable);;Argument[-1];Argument[0];taint", |
| 48 | + "com.google.common.io;CharSource;true;openStream;();;Argument[-1];ReturnValue;taint", |
| 49 | + "com.google.common.io;CharSource;true;openBufferedStream;();;Argument[-1];ReturnValue;taint", |
| 50 | + "com.google.common.io;CharSource;true;read;();;Argument[-1];ReturnValue;taint", |
| 51 | + "com.google.common.io;CharSource;true;readFirstLine;();;Argument[-1];ReturnValue;taint", |
| 52 | + "com.google.common.io;CharSource;true;readLines;();;Argument[-1];ReturnValue;taint", |
| 53 | + "com.google.common.io;CharSource;true;lines;();;Argument[-1];ReturnValue;taint", |
| 54 | + "com.google.common.io;CharSource;true;wrap;(CharSequence);;Argument[0];ReturnValue;taint", |
| 55 | + "com.google.common.io;CharStreams;false;copy;(Readable,Appendable);;Argument[0];Argument[1];taint", |
| 56 | + "com.google.common.io;CharStreams;false;readLines;(Readable);;Argument[0];ReturnValue;taint", |
| 57 | + "com.google.common.io;CharStreams;false;toString;(Readable);;Argument[0];ReturnValue;taint", |
| 58 | + "com.google.common.io;Closer;true;register;;;Argument[0];ReturnValue;value", |
| 59 | + "com.google.common.io;Files;false;getFileExtension;(String);;Argument[0];ReturnValue;taint", |
| 60 | + "com.google.common.io;Files;false;getNameWithoutExtension;(String);;Argument[0];ReturnValue;taint", |
| 61 | + "com.google.common.io;Files;false;simplifyPath;(String);;Argument[0];ReturnValue;taint", |
| 62 | + "com.google.common.io;MoreFiles;false;getFileExtension;(Path);;Argument[0];ReturnValue;taint", |
| 63 | + "com.google.common.io;MoreFiles;false;getNameWithoutExtension;(Path);;Argument[0];ReturnValue;taint", |
| 64 | + "com.google.common.io;LineReader;false;LineReader;(Readable);;Argument[0];ReturnValue;taint", |
| 65 | + "com.google.common.io;LineReader;true;readLine;();;Argument[-1];ReturnValue;taint", |
| 66 | + "com.google.common.io;ByteArrayDataOutput;true;toByteArray;();;Argument[-1];ReturnValue;taint", |
| 67 | + "com.google.common.io;ByteArrayDataOutput;true;write;(byte[]);;Argument[0];Argument[-1];taint", |
| 68 | + "com.google.common.io;ByteArrayDataOutput;true;write;(byte[],int,int);;Argument[0];Argument[-1];taint", |
| 69 | + "com.google.common.io;ByteArrayDataOutput;true;write;(int);;Argument[0];Argument[-1];taint", |
| 70 | + "com.google.common.io;ByteArrayDataOutput;true;writeByte;(int);;Argument[0];Argument[-1];taint", |
| 71 | + "com.google.common.io;ByteArrayDataOutput;true;writeBytes;(String);;Argument[0];Argument[-1];taint", |
| 72 | + "com.google.common.io;ByteArrayDataOutput;true;writeChar;(int);;Argument[0];Argument[-1];taint", |
| 73 | + "com.google.common.io;ByteArrayDataOutput;true;writeChars;(String);;Argument[0];Argument[-1];taint", |
| 74 | + "com.google.common.io;ByteArrayDataOutput;true;writeDouble;(double);;Argument[0];Argument[-1];taint", |
| 75 | + "com.google.common.io;ByteArrayDataOutput;true;writeFloat;(float);;Argument[0];Argument[-1];taint", |
| 76 | + "com.google.common.io;ByteArrayDataOutput;true;writeInt;(int);;Argument[0];Argument[-1];taint", |
| 77 | + "com.google.common.io;ByteArrayDataOutput;true;writeLong;(long);;Argument[0];Argument[-1];taint", |
| 78 | + "com.google.common.io;ByteArrayDataOutput;true;writeShort;(int);;Argument[0];Argument[-1];taint", |
| 79 | + "com.google.common.io;ByteArrayDataOutput;true;writeUTF;(String);;Argument[0];Argument[-1];taint" |
| 80 | + ] |
| 81 | + } |
| 82 | +} |
| 83 | + |
| 84 | +private class GuavaIoSinkCsv extends SinkModelCsv { |
| 85 | + override predicate row(string row) { |
| 86 | + row = |
| 87 | + [ |
| 88 | + //"package;type;overrides;name;signature;ext;inputspec;kind", |
| 89 | + "com.google.common.io;Resources;false;asByteSource;(URL);;Argument[0];url-open-stream", |
| 90 | + "com.google.common.io;Resources;false;asCharSource;(URL,Charset);;Argument[0];url-open-stream", |
| 91 | + "com.google.common.io;Resources;false;copy;(URL,OutputStream);;Argument[0];url-open-stream", |
| 92 | + "com.google.common.io;Resources;false;asByteSource;(URL);;Argument[0];url-open-stream", |
| 93 | + "com.google.common.io;Resources;false;readLines;;;Argument[0];url-open-stream", |
| 94 | + "com.google.common.io;Resources;false;toByteArray;(URL);;Argument[0];url-open-stream", |
| 95 | + "com.google.common.io;Resources;false;toString;(URL,Charset);;Argument[0];url-open-stream" |
| 96 | + ] |
| 97 | + } |
| 98 | +} |
0 commit comments