๐ง 151. What is HTTPS?
HTTPS stands for: ๐ HyperText Transfer Protocol Secure
It is the secure version of HTTP that encrypts data exchanged between browser and server.
Benefits:
โ Secure communication
โ Protects sensitive data
โ Prevents eavesdropping
Example: https://example.com
๐ง 152. Difference Between HTTP and HTTPS
Feature : HTTP : HTTPS
Security : Not secure : Secure
Data : Sent as plain text : Data encrypted
Port : Uses Port 80 : Uses Port 443
SSL/TLS : No SSL/TLS : Requires SSL/TLS
๐ง 153. What is SSL/TLS?
SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are protocols that encrypt data transmission.
Benefits:
โ Data encryption
โ Authentication
โ Data integrity
Example: When you see a padlock icon in the browser, SSL/TLS is being used.
๐ง 154. What is XSS Attack?
XSS stands for: ๐ Cross-Site Scripting
It occurs when attackers inject malicious JavaScript into webpages.
Example:
<script>
alert("Hacked");
</script>
Prevention:
โ Validate input
โ Escape output
โ Use Content Security Policy (CSP)
๐ง 155. What is CSRF Attack?
CSRF stands for: ๐ Cross-Site Request Forgery
It tricks authenticated users into performing unwanted actions.
Example: A logged-in user unknowingly submits a bank transfer request.
Prevention:
โ CSRF Tokens
โ SameSite Cookies
โ Authentication checks
๐ง 156. What is SQL Injection?
SQL Injection occurs when malicious SQL code is inserted into queries.
Vulnerable Query:
SELECT * FROM users
WHERE username = 'admin'
AND password = '123';
Prevention:
โ Prepared Statements
โ Parameterized Queries
โ Input Validation
๐ง 157. How to Secure APIs?
Best Practices:
โ Use HTTPS
โ Authentication & Authorization
โ Rate Limiting
โ Input Validation
โ API Keys
โ JWT Tokens
Example:
Authorization: Bearer <token> ๐ง 158. What is Hashing?
Hashing converts data into a fixed-length value.
Example:
password123
โ
5e884898da...
Uses: Password storage, Data verification
๐ง 159. Difference Between Encryption and Hashing
Feature : Encryption : Hashing
Reversibility : Reversible : Irreversible
Key : Uses key : No key required
Purpose : Protects data : Verifies integrity
Example:
Encryption โ Credit card data
Hashing โ Passwords
๐ง 160. What is bcrypt?
bcrypt is a password hashing algorithm.
Features:
โ Salt generation
โ Secure password storage
โ Resistant to brute-force attacks
Example:
const hash = await bcrypt.hash(password, 10);
๐ง 161. What is OAuth?
OAuth is an authorization framework that allows third-party applications to access resources without sharing passwords.
Examples: Login with Google, Login with GitHub, Login with Facebook
Benefits:
โ Secure authentication
โ No password sharing
๐ง 162. What is JWT Token Security?
JWT (JSON Web Token) securely transmits user information.
Structure: Header.Payload.Signature
Security Tips:
โ Short expiration time
โ Use HTTPS
โ Store securely
๐ง 163. What is Content Security Policy (CSP)?
CSP is a browser security feature that helps prevent XSS attacks.
Example:
Content-Security-Policy: default-src 'self';