.net core security Flashcards

(7 cards)

1
Q

How do you implement Secure Authentication and Authorization?

A

Strong Password Policies and Multi-Factor Authentication
Role-Based Access Control
Secure Protocols:
OAuth 2.0 or OpenID Connect for authentication and authorization.

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

How do you implement data protection?

A

Encrypt Sensitive Data:
Both at rest (e.g., in databases) and in transit (using HTTPS/SSL/TLS).
Hashing and Salting Passwords:
Never store passwords in plain text; instead, hash and salt them using strong algorithms.
Secure Secret Management:
Store application secrets (e.g., API keys, connection strings) securely do not hard code
Utilize Azure Key Vault or the .NET Secret Manager.

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

Secure Communication

A

Enforce HTTPS and HSTS: Always use HTTPS with strong SSL/TLS protocols and cipher suites to encrypt data in transit. Implement HTTP Strict Transport Security (HSTS) to enforce secure communication and prevent downgrade attacks.

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

Session and Cookie Management

A

Secure Session Management:
Store session data securely on the server-side, encrypt cookies using the Data Protection API, and set the Secure and HttpOnly flags for cookies.

CSRF Protection:
Implement Cross-Site Request Forgery (CSRF) protection using anti-forgery tokens provided by ASP.NET Core.

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

Error Handling and Logging

A

Custom Error Pages:
Implement custom error pages to prevent sensitive information disclosure during exceptions.
Security-Focused Logging:
Log security-related events and errors to enable monitoring and incident response.

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

Regular Updates and Security Testing

A

Keep Framework and Libraries Updated:
Regularly update ASP.NET Core and all third-party libraries to benefit from the latest security patches.
Security Testing:
Conduct regular security testing, including penetration testing and vulnerability scanning, to identify and address potential weaknesses.

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

How do you implement JWT?

A

JSON Web Token
1. install nuget package
2. In Program.cs configure authentication services and add JWT Bearer authentication
3.Store JWT configuration (Issuer, Audience, and a strong secret Key) in appsettings.json
4. Create an API endpoint (ex: /api/login) for users to submit their credentials.
5. Apply [Authorize] attribute to controllers/action methods that require authentication. Or specify roles for role-based authorization (e.g., [Authorize(Roles = “Admin”)]).
6. include JWT in Client requests to endpoints

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