0

I'm using the playframework with version 1.2.5 and I have just a simple Question.

If I use for example:

public static User findByUsername(String username) {
    return User.find("username = ?", username).first();
}

So if I perform this call, does the "JPAQuery find()" or the playframework prevent cross site scripting and such things?

If not, what do I have easily to do for preventing it in all my database interactions?

Thanks a lot.

Cheers,

Marco

biesior
  • 55,576
  • 10
  • 125
  • 182
grailsInvas0r
  • 655
  • 2
  • 10
  • 25

2 Answers2

0

Since version 1.0.1, Play’s template engine automatically escapes string. More details on this page: playframework owasp top 10

Community
  • 1
  • 1
  • In addition to this dont forget to check if its enabled in the application.conf file with "future.escapeInTemplates=true". See here http://www.playframework.org/documentation/1.1.1/security – Gambo Jul 31 '12 at 07:29
0

Cross-site scripting does not quite apply to the code you posted, so I suppose you mean SQL injection. In that case, the code you posted should be safe. (The wrong way would be to build the query by concatenating Strings with + operator.)

See here: http://www.playframework.org/documentation/1.2.5/security#sql

Tommi
  • 8,550
  • 5
  • 32
  • 51