mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Fix QLDocs and the qhelp example
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/** Provides classes and predicates for working with SQLite databases. */
|
||||
|
||||
import java
|
||||
import Android
|
||||
import semmle.code.java.dataflow.FlowSteps
|
||||
@@ -24,10 +26,16 @@ class TypeDatabaseUtils extends Class {
|
||||
TypeDatabaseUtils() { hasQualifiedName("android.database", "DatabaseUtils") }
|
||||
}
|
||||
|
||||
/**
|
||||
* The class `android.database.sqlite.SQLiteOpenHelper`.
|
||||
*/
|
||||
class TypeSQLiteOpenHelper extends Class {
|
||||
TypeSQLiteOpenHelper() { this.hasQualifiedName("android.database.sqlite", "SQLiteOpenHelper") }
|
||||
}
|
||||
|
||||
/**
|
||||
* The class `android.database.sqlite.SQLiteStatement`.
|
||||
*/
|
||||
class TypeSQLiteStatement extends Class {
|
||||
TypeSQLiteStatement() { this.hasQualifiedName("android.database.sqlite", "SQLiteStatement") }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/** Provides classes and predicates for working with Android widgets. */
|
||||
|
||||
import java
|
||||
import semmle.code.java.dataflow.ExternalFlow
|
||||
import semmle.code.java.dataflow.FlowSources
|
||||
|
||||
@@ -16,3 +16,12 @@ public void sqlCipherStorageSafe(String name, String password, String databasePa
|
||||
net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase("test", databasePassword, null);
|
||||
db.execSQL("INSERT INTO users VALUES (?, ?)", new String[] {name, password});
|
||||
}
|
||||
|
||||
private static String encrypt(String cleartext) {
|
||||
// Use an encryption or strong hashing algorithm in the real world.
|
||||
// The example below just returns a SHA-256 hash.
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hash = digest.digest(cleartext.getBytes(StandardCharsets.UTF_8));
|
||||
String encoded = Base64.getEncoder().encodeToString(hash);
|
||||
return encoded;
|
||||
}
|
||||
Reference in New Issue
Block a user