Skip to content

Commit b6e60e4

Browse files
committed
Rust: Address small bugs in the test.
1 parent 215fe7d commit b6e60e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rust/ql/test/query-tests/security/CWE-312/test_storage.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ async fn test_storage_sql_command(url: &str) -> Result<(), sqlx::Error> {
7979
// execute queries - SQLite, prepared query
8080
let _ = sqlx::query(insert_query1.as_str()).execute(&mut conn2).await?;
8181
let _ = sqlx::query(insert_query2.as_str()).execute(&mut conn2).await?; // $ Alert[rust/cleartext-storage-database]
82-
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).execute(&mut conn2).await?;
83-
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).execute(&mut conn2).await?; // $ MISSING: Alert[rust/cleartext-storage-database]
82+
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).bind(id).execute(&mut conn2).await?;
83+
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).bind(id).execute(&mut conn2).await?; // $ MISSING: Alert[rust/cleartext-storage-database]
8484

8585
// execute queries - SQLite, prepared query variant
8686
let _ = sqlx::query(insert_query1.as_str()).fetch(&mut conn2);
8787
let _ = sqlx::query(insert_query2.as_str()).fetch(&mut conn2); // $ Alert[rust/cleartext-storage-database]
88-
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).fetch(&mut conn2);
89-
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).fetch(&mut conn2); // $ MISSING: Alert[rust/cleartext-storage-database]
88+
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).bind(id).fetch(&mut conn2);
89+
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).bind(id).fetch(&mut conn2); // $ MISSING: Alert[rust/cleartext-storage-database]
9090

9191
// connect through a PostgreSQL connection pool
9292
let pool3 = sqlx::postgres::PgPool::connect(url).await?;
@@ -99,8 +99,8 @@ async fn test_storage_sql_command(url: &str) -> Result<(), sqlx::Error> {
9999
// execute queries - PostgreSQL, prepared query
100100
let _ = sqlx::query(insert_query1.as_str()).execute(&pool3).await?;
101101
let _ = sqlx::query(insert_query2.as_str()).execute(&pool3).await?; // $ Alert[rust/cleartext-storage-database]
102-
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).execute(&pool3).await?;
103-
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).execute(&pool3).await?; // $ MISSING: Alert[rust/cleartext-storage-database]
102+
let _ = sqlx::query(prepared_query.as_str()).bind(get_harmless()).bind(id).execute(&pool3).await?;
103+
let _ = sqlx::query(prepared_query.as_str()).bind(get_social_security_number()).bind(id).execute(&pool3).await?; // $ MISSING: Alert[rust/cleartext-storage-database]
104104

105105
Ok(())
106106
}

0 commit comments

Comments
 (0)