Check out the OWASP development guide at www.owasp.org. It is a bit dated (2005), but it contains information about many of the security issues associated with web applications.
I do not know any library or structure to solve this problem. It really depends on what technologies and applications you use.
NYSystemsAnalyst
source share