Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid ObjectToSQLString in EnumStringType #3563

Open
fredericDelaporte opened this issue Jun 9, 2024 · 0 comments
Open

Invalid ObjectToSQLString in EnumStringType #3563

fredericDelaporte opened this issue Jun 9, 2024 · 0 comments

Comments

@fredericDelaporte
Copy link
Member

fredericDelaporte commented Jun 9, 2024

While working on a fix for #3516 in #3547, the case of EnumStringType.ObjectToSQLString appeared to be invalid on another level.

public override string ObjectToSQLString(object value, Dialect.Dialect dialect)
{
return GetValue(value).ToString();
}

That type stores enum values as strings in the database. But its method for obtaining SQL compatible literal values just yields the enum value name (or string representation of the underlying type value if not named) as is, not as a SQL string literal.

So, using that type for the few features relying on ObjectToSQLString is very likely to fail. (So, using it as a discriminator, or in a query referencing a static field.)

But it does not allow a practical SQL injection since it is limited to inject a single word having .Net identifier naming constraints. So, I will not fix this in #3547 but I open an issue instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant