Mapa mental
Defensive Design
Contenido del mapa
Defensive Design
Defensive Design helps to ensure programs Function Properly
- When programs are functioning correctly , they should never break and never produce errors.
- Programmers try to protect their programs through defensive design:
- Anticipate how users might misuse their program, then attempt to prevent it from happeneing.
- Ensure their code is well-maintained
- Reduce the number of errors in the code through testing.
Make sure the Inputs can't be Exploited
- The easiest way for a user to accidentally or intentionally misuse a program is when entering data.
- There are two ways that you can prevent users from entering something you don't want them to:
- INPUT SANITISATION - removing any unwanted characters before passing data through the program
- INPUT VALIDATION - checking if any data meets certain criteria before passing it into the program. E.g. checking that and email address contains an @ symbol and has a suitable ending (.com, .co.uk, etc)
- Sanitisation and Validation are often done using whitelists and blacklists. Whitelists ten to be more secure, however they can take a long time to set up and can be too restrictive.
- A whitelist is a list of all data that a program should accept - any data that isn't on the whitelist will be rejected.
- A blacklist is a list of all the data that a program should reject - any fata that isn't on the blacklist will be accepted.
Authentication can help Protect your programs
- Authentication can confirm the identity of a user before they're allowed to access certain pieces of data or features of the program.
- Password are usually associated with a username. When someone tries to access a protected part of the program, it should ask them for their password to check that they are who they claim to be.
- Here are some common wats to increate the security of a password-based authentication system:
- Force users to use strong passwords and get them to change their passwords regularly.
- Limit the number of failed authentication attempts before access to an account is lost.
- Ask for a random selection of characters from the password on each authentication.
Your program should be Easy To Maintain
- As part of the defensive design of a program, programmers should make sure that it is well-maintained.
- The following features can improve the maintainability of source code:
- Comments are useful for explaining what the key features of a program do.
- Indentation can be used to separate different statements in a program. This allows other programmers to see the flow of the program more clearly and pick out the different features.
- Variables and sub programs should be named so that they refer to what they actually are.
- Only use global variables when necessary as they could affect the rest of your code.
Información
- Descripción
- Mapa Mental sobre Defensive Design, creado por Paul Lawrence el 27/06/2019.
- Creado por
- Paul Lawrence
- Visitas
- 0
- Valoración