Implement interface contracts

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

Jump to: navigation, search

comparatif automobile [http://s1.shard.jp/olharder/auto-california.html autobid uk ] [http://s1.shard.jp/losaul/little-tykes-toys.html picture magazine australia ] [http://s1.shard.jp/olharder/capital-one-auto.html microsoft autoroute 2005 review ] [http://s1.shard.jp/olharder/auto-bill-fitts.html auto edmonton in trader.ca ] [http://s1.shard.jp/galeach/new197.html asia mall manila philippine ] [http://s1.shard.jp/losaul/epoxy-surfboards.html environmental jobs network australia ] [http://s1.shard.jp/galeach/new86.html asia attack crocodile in ] [http://s1.shard.jp/frhorton/3k3nxdd3j.html how to wrap african head wrap ] [http://s1.shard.jp/frhorton/qwl7aihru.html african american dance companies ] page [http://s1.shard.jp/losaul/wiremesh-australia.html school holidays australia 2006 ] [http://s1.shard.jp/frhorton/kcixkr2qy.html political map of africa with the capitals ] [http://s1.shard.jp/olharder/auto-buy-com.html canta autores ] [http://s1.shard.jp/bireba/norton-antivirus.html antivirusprogramma ] [http://s1.shard.jp/losaul/job-search-cairns.html genes reunited australia ] [http://s1.shard.jp/galeach/new129.html eurasia map northern political ] map [http://s1.shard.jp/bireba/antivirus2003.html kaspersky antivirus file server 5.0.40 key ] [http://s1.shard.jp/bireba/avg-antivirus.html asquared antivirus ] [http://s1.shard.jp/bireba/symantec-norton.html nod32 antivirus system ] [http://s1.shard.jp/frhorton/3l1e7cosa.html south african consulate los angeles ] [http://s1.shard.jp/galeach/new97.html tsunami in south east asia in 2004 ] [http://s1.shard.jp/olharder/automated-vehicle.html autographed baseball dimaggio joe ] [http://s1.shard.jp/losaul/australia-stables.html vodafone australia mobiles ] [http://s1.shard.jp/olharder/map.html ricciardi auto sales ] [http://s1.shard.jp/olharder/sunnyside-auto.html leaseway auto carrier ] [http://s1.shard.jp/olharder/auto-club-country.html automobile bill free sale texas ] [http://s1.shard.jp/olharder/12-auto-become-br.html autobag equipment ] [http://s1.shard.jp/losaul/redfern-sydney.html walker books australia ] [http://s1.shard.jp/losaul/desert-map-of-australia.html ensemble theatre sydney australia ] [http://s1.shard.jp/frhorton/1aei449pv.html racism against african american ] [http://s1.shard.jp/galeach/new32.html sey asian women ] [http://s1.shard.jp/losaul/used-car-price.html place names australia ] [http://s1.shard.jp/galeach/new60.html asian thong photos ] [http://s1.shard.jp/bireba/map.html manually uninstall mcafee antivirus ] autocad 2005 serial no [http://s1.shard.jp/galeach/new142.html asian chica ] [http://s1.shard.jp/losaul/australian-sports.html mcguigan wine australia ] [http://s1.shard.jp/bireba/alertaantivirus.html norman antivirus update ] [http://s1.shard.jp/bireba/norton-antivirus.html reviews antivirus programs ] a detailed map of south asia [http://s1.shard.jp/galeach/new96.html uthinasia ] [http://s1.shard.jp/olharder/ontegra-automotive.html autovia.com ] [http://s1.shard.jp/olharder/auto-sales-winnies.html auto delphi news ] [http://s1.shard.jp/losaul/lucas-heights-australia.html australian dog miniature ] [http://s1.shard.jp/galeach/new119.html american asian incident ] [http://s1.shard.jp/frhorton/3l77ipk2f.html african american student achievement ] [http://s1.shard.jp/frhorton/2tqspott4.html african american woman artists ]


Overview

Purpose:

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

Role:

  • Implementer

Frequency:

  • 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.