2.4 Secure Coding Practices Flashcards

1
Q

What does output encoding do?

A

Output encoding replaces the potentially dangerous character with an equivalent string that produces the same result but doesn’t have the risk of manipulating the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does HTML encoding do?

A

Uses ampersand (&) notation to replace dangerous values that appear in an HTML-based web document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

URL Encoding

A

Uses percent sign (%) notation to replace dangerous values that appear in a URL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is input validation.

A

It’s the filtering of user-supplied input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What security concerns do user-supplied input raise?

A

User-supplied input may contain code designed to interact with the database, manipulate the browsers of future visitors to the site, or perform any of a number of other attacks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The Two Appraches to Input Validation

A

Whitelisting and Blacklisting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does input validation via whitelisting do? And what’s its downside?

A

Specifies allowable input. Not always practical.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is blacklisting in the context of input validation? What’s it’s main characteristic (pro/con).

A

Specifies disallowed input. More difficult and less effective than whitelisting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Should input validation be performed on the client or on the server? Why?

A

On the server.

The user controls the browser, and the user can disable the input validation routine if you validate input on the client side

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are parameterized queries?

A

In a parameterized query, the SQL template is precompiled on the database server.

The client does not send the SQL code to the database server. Instead, the client sends arguments to the server which then inserts those arguments into a pre-compiled query template.

This protects against injection attacks and improves database performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What’s one way that you should never store a password?

A

Plaintext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does hashing do?

A

Uses a cryptographic function to transform the password into a unique value that can’t be reversed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is salting? What does it protect against?

A

Adding a random value to passwords prior to hashing.

Against rainbow table attacks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In what form should the passwords be in transit?

A

Encrypted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does Transport Layer Security (TLS) do on a high level?

A

Encrypts web traffic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does output encoding do?

A

Replaces dangerous characters with equivalent strings that produce the same result for the end-user but don’t have the risk of maliciously manipulating the application.

17
Q

What does HTML encoding do?

A

Uses ampersand (&) notation to replace dangerous values that appear in an HTML-based document.

18
Q

What does URL encoding do?

A

Uses percent sign (%) notation to replace dangerous values that appear in a URL.

19
Q

Should you do output encoding manually? If not what should you do instead?

A

No. You should use trusted libraries to perform it.

20
Q

Do unpredictable states in software jeopardize application security?

A

Yes.

21
Q

What does error handling do?

What does it prevent?

A

It provides the computer with explicit instructions on handling errors.

Prevents unpredictable states.

22
Q

What’s Java’s model for error handling?

A

Try-Catch

23
Q

What does code signing do?

A

Helps users determine whether code is legitimate using digital signatures to the software. This provides users with confidence that software comes from a trusted source.

24
Q

What are the two steps of signing code?

A
  1. The developer obtains a digital certificate.

2. The developer creates a digital signature for the code using the private key associated with the certificate.

25
Q

What are the four steps of verifying code signatures?

A
  1. The user downloads the software.
  2. The OS uses the certificate’s public key to validate the signature.
  3. The OS verifies that the signature’s hash matches the code.
  4. The OS verifies that the developer is trusted.
26
Q

What is database normalization?

A

A set of design principles that database designers should follow when building and modifying databases.

Normalization improves database design and has security advantages.

27
Q

What does database activity monitoring do?

A

Logs and analyses database requests.

28
Q

What do stored procedures protect against?

A

SQL injection.

29
Q

What is deidentification?

A

The process of moving through a data set and removing data that may be individually identifying (names, social security numbers, etc).

Not as secure as it sounds…

30
Q

What is anonymization?

A

Removing the possibility of identification.

31
Q

What is data obfuscation?

A

Transforming personally-identifying information into a form where it is no longer possible to tie it to an individual person.

32
Q

What is tokenization?

A

Replacing sensitive fields with a random identifier, and using a lookup table.

33
Q

What is masking?

A

Replacing sensitive information with blank values.

34
Q

What protocol may be used to secure passwords in transit to a web application?

A

Transport Layer Security (TLS)

35
Q

What must a developer who wishes to sign their code have?

A

Digital Certificate