SAP / odfuzz

Apache License 2.0
18 stars 12 forks source link

Add support for DELETE, PUT, POST, MERGE operation #68

Closed phanak-sap closed 2 years ago

phanak-sap commented 4 years ago

placeholder issue , will be specified in more detail

Library / DirectBuilder usage = experimental prototype for this feature.

CLI USAGE

prashdsouza commented 4 years ago

Delete queries with filter option

https://stackoverflow.com/questions/33279744/odata-delete-with-filter

AlapanGhosh commented 4 years ago

Hi, I looked through the v2 operations documentation. Based on sections 2.8 and 2.11, and also the above attached stackoverflow thread, we can assume DELETE wont be taking any query options, other than while deleting links.

Which would mean the first step would be to decouple the invocation of the query-options generation in the workflow. Any pointers on where and how I can safely stop the query-options generation in the current GET workflow? Thanks

lubosmj commented 4 years ago

@AlapanGhosh, I believe you have to modify the following method: https://github.com/SAP/odfuzz/blob/41d244111b0255854bcff3ecbc68bf679a59312c/odfuzz/fuzzer.py#L353-L361

Query options are generated and added to a specific query in the for loop. The method build_string() assembles a final query string from an entity's URI and query options' values: https://github.com/SAP/odfuzz/blob/41d244111b0255854bcff3ecbc68bf679a59312c/odfuzz/fuzzer.py#L1115-L1133

As long as a query does not reference any query options, the for loop will not be executed.

Also, I recommend you to take a look at the method _add_appendix() which is called from the method build_string(). This method appends additional query options to a URL by default: https://github.com/SAP/odfuzz/blob/41d244111b0255854bcff3ecbc68bf679a59312c/odfuzz/fuzzer.py#L1164-L1168

AlapanGhosh commented 4 years ago

@lubosmj Thanks for the pointers. It was really helpful.

AlapanGhosh commented 4 years ago

Hi @phanak-sap

As per our last discussion you mentioned you have not committed the n-odata-server test application. So, would you be in a position to commit so that I can install the test app locally and test out the DELETE PoC? Thanks

phanak-sap commented 4 years ago

@AlapanGhosh I only tested that the n-odata-server (from samples) produces valid metadata, so it is not stopped on first step. Then I went to vacation as discussed. So at the moment I don't have the sample app (but I guess you can use the internal fiorigoat for testing first changes)

Also, I am against direct modifying the generate_options() method in the fuzzer.py. It would be better, to as part of module de-coupling, to move anything relevant to URL query generation - this method and accompanying utilities - out of fuzzer.py to most probably new module or at least new class in entities.py and just call the respective URL generation (GET/DELETE) from fuzzer.py.

Remember, it would be good to move towards like a library code, that would generate URLs (and after that, mutates them) for provided metadata, without networking and database and CLI / gevent runtime.

phanak-sap commented 2 years ago

I am closing this issue with no CLI task implemented, just covering the support in the DirectBuilder only.

There is currently discussed variant that odfuzz will in the future use only the DirectBuilder in some core module, to better modularize the project. DispatchedBuilder entanglement with practically all other parts of odfuzz (e.g. in issue description) make it really hard to maintain. In the future there is also possibility to remove mongoDB dependency (and perhaps even drop the mutation part), in favor of more CLI usage with sqlite/files only.