I have an internal web service that exposes what rate to pay for a given task. Currently there is a single service that exposes:
- Currencies - Add, Edit, Delete, SelectById
- Countries - Add, Edit, Delete, SelectById
- Tasks - Add, Edit, Delete, SelectById
- Rates - Add, Edit, Delete, SelectAll, SelectById - (*1) Search
- Reference data (Currencies, Countries, Users, Tasks...) - SelectAll
- Users - Add, Edit, Delete, SelectById
(*1) This just takes and executes SQL query (I know this is a SQL injection nightmare! I didn't write this)
I was asked to review the service before someone decides to expose it across our firewalls into the DMZ and even though they are telling me the firewall rules will prevent attack I am refusing to allow this service to be exposed.
The application that wants the information wants only read-only access to the data and I am going to suggest that we produce a facade that is much more secure (probably using WCF) that exposes only the required information and schedule a complete overhaul of the system.
My suggestion is to decompose the service into a series of specific interfaces for:
- Currencies
- Countries
- Tasks
- Rates
- Users
However, given that I require only read-only data within the DMZ would it make sense to decompose each service into a read-only service contract and a writeable-service contrac, e.g. for currencies:
public interface ReadOnlyCurrencyService
{
IEnumerable<Currency>GetAll();
Currency GetById(int id);
}
public interface CurrencyService : ReadOnlyCurrencyService
{
void Add(Currency currency);
void Update(Currency currency);
void Delete(Currency currency);
}
public class CurrencyServiceLAN : CurrencyService
{
}
That way we can expose only the read-only parts of the currency service as an endpoint across the DMZ-LAN boundary but using the same service expose the writeable parts of the service inside the LAN.
Just wondered if anyone had any thoughts/comments/different approaches