Implement interface contracts

Revision as of 09:34, 29 May 2009 by Deleted user (Talk | contribs)

Jump to: navigation, search

comparatif automobile [ autobid uk ] [ picture magazine australia ] [ microsoft autoroute 2005 review ] [ auto edmonton in ] [ asia mall manila philippine ] [ environmental jobs network australia ] [ asia attack crocodile in ] [ how to wrap african head wrap ] [ african american dance companies ] page [ school holidays australia 2006 ] [ political map of africa with the capitals ] [ canta autores ] [ antivirusprogramma ] [ genes reunited australia ] [ eurasia map northern political ] map [ kaspersky antivirus file server 5.0.40 key ] [ asquared antivirus ] [ nod32 antivirus system ] [ south african consulate los angeles ] [ tsunami in south east asia in 2004 ] [ autographed baseball dimaggio joe ] [ vodafone australia mobiles ] [ ricciardi auto sales ] [ leaseway auto carrier ] [ automobile bill free sale texas ] [ autobag equipment ] [ walker books australia ] [ ensemble theatre sydney australia ] [ racism against african american ] [ sey asian women ] [ place names australia ] [ asian thong photos ] [ manually uninstall mcafee antivirus ] autocad 2005 serial no [ asian chica ] [ mcguigan wine australia ] [ norman antivirus update ] [ reviews antivirus programs ] a detailed map of south asia [ uthinasia ] [ ] [ auto delphi news ] [ australian dog miniature ] [ american asian incident ] [ african american student achievement ] [ african american woman artists ]



  • Provide unit-level semantic input validation.
  • Identify reliability errors in a structured way at the earliest point in time.


  • Implementer


  • As needed; generally as functions or methods are modified.

Interface contracts are also commonly known as assertions. They can be a formidable tool for preventing security problems - particularly if applied consistently, and rigorously.

In many application development processes, interface contracts are not enabled in production software. They are removed by habit in order to improve efficiency. If the efficiency impact is nominal for the project, CLASP strongly recommends leaving such checks in the code for the sake of security.

Otherwise, checks of security critical parameters should be implemented using a permanent mechanism, such as code directly at the top of the function, as discussed in activities below.

Implement validation and error handling on function or method inputs

For each method or function visible outside its compilation unit, specify in code what the expectations are for valid input values. One should validate that each input variable has a valid value in and of itself, and should determine validity in relation to other inputs. Validation checks should contain no side effects. Failures should be handled as specified in design. See CLASP Resource B for the concept on input validation.

Input variables should not be constrained to parameters. Any variable read by the function or method should be considered an input variable - including global variables, and class and method variables. Note that some interface contract facilities will allow specifying invariants for an entire class - i.e., things that must always be true about class data before and after each method invocation - once.

Implement validation on function or method outputs

Perform the same validation between relationships before exiting a function or method. Output specifications are meant to provide a clear behavioral specification to calling code to prevent accidental misuse.

Generally, output validation code is most useful in implementation. It is reasonable to disable such code for deployment or even use pseudo-code if absolutely necessary.