All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.codemodder.codemods.HQLParameterizationCodemod.description.md Maven / Gradle / Ivy

There is a newer version: 0.97.3
Show newest version
This change refactors Hibernate queries to be parameterized, rather than built by hand.

Without parameterization, developers must remember to escape inputs using the rules for that database. It's usually buggy, at the least -- and sometimes vulnerable.

Our changes look something like this:

```diff
- Query hqlQuery = session.createQuery("select p from Person p where p.name like '" + tainted + "'");
+ Query hqlQuery = session.createQuery("select p from Person p where p.name like :parameter0").setParameter(":parameter0", tainted);
```




© 2015 - 2024 Weber Informatics LLC | Privacy Policy