Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Default Implementation allows for SQL injection #1

Open
pgaschuetz opened this issue Nov 21, 2012 · 1 comment
Open

Default Implementation allows for SQL injection #1

pgaschuetz opened this issue Nov 21, 2012 · 1 comment

Comments

@pgaschuetz
Copy link

Hi,

I've just been looking at this and believe - without testing - that your default implementation is actually prone for SQL injection:

  • When configured with the integration Servlet Filter, a http header could be provided,
  • this is in turn converted to a Tenant using the DefaultProvider,
  • which simply sets the Identity to the provided value.
  • The SwitchingDatasource then simply uses getIdentity().toString() as a database name.

DatabaseMetaData.getIdentifierQuoteString() might be a possible candidate for a solution, or at least throw an exception if the databasename contains the quote character.

Best
Philipp

@ghost
Copy link

ghost commented Nov 23, 2012

Thanks for pointing out this issue Philipp. As you point out the implementation should either ensure that special characters are properly encoded, disallow special characters, or use a prepared statement with parameters instead of using the string directly in the SQL.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant