FINERACT-2624: Prepared statement, input parameter sanitisation#5916
FINERACT-2624: Prepared statement, input parameter sanitisation#5916terencemo wants to merge 1 commit into
Conversation
IOhacker
left a comment
There was a problem hiding this comment.
No visible allow‑list, enum, or sanitization is applied to tableName or columnName
Sanitisation is not based on allow-list or enum. Can you explain what you mean by |
|
@terencemo Question: why didn't we use just this service If I understood the code here correctly then the only thing left would be the type checking for the columns, that could stay... but in any way, why not re-use the SQL validator, add any missing pattern and then the entire code base could profit? Should also simplify the proposed changes significantly. As for the "allow-list" that @IOhacker mentioned: we could use the JDBC driver's metadata, extract all existing tables in the database at boot time and collect a static final list of table and column names in a |
adamsaghy
left a comment
There was a problem hiding this comment.
I like the idea, but second @meonkeys and @vidakovic regarding we should have a central place for sql validation and rules and reuse that.
IOhacker
left a comment
There was a problem hiding this comment.
I support to reuse and improve the existing SQL validator as pointed by @alexivanov instead of applying a local fix.
I did not say that and I'm not reviewing this PR, but FWIW it sounds like a good idea? |
@meonkeys To the idea of using prepared statements wherever possible and input value sanitization and validation: yes, I do think it’s a good direction. To implement it locally: not so much. I would probably wire and move this logic into the I suppose the main point here is to avoid having a local solution but a centralized one. |
Description
This PR enhances stretchy reporting in Fineract by:
Integrations tests have been added which invoke
runreportswith both valid and invalid inputs. Numeric parameter (officeId) positive and negative tests (numeric and non-numeric input) - some of the invalid inputs includeSLEEPandpg_sleepcommands. AlsoUNION ALLinputs passed attempting SQL injection.Besides this, unregistered parameter passing is covered where a parameter not in
stretchy_report_parameterfor the given report is passed. Additional integration tests can be added to cover date and string parameter types.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.