Database_Security_Flashcards
What are the key components of database security?
- Physical Security
- Network Security
- Access Control
- Application Security
What are the main elements to ensure in database security?
- Data Integrity
- Confidentiality
- Availability
What is SQL Injection?
A malicious technique where attackers execute unauthorized SQL commands by exploiting vulnerabilities in the input fields of an application, leading to unauthorized access and manipulation of the database.
What are common threats to database security?
- SQL Injection
- Phishing
- Malware and Ransomware
- Accidental Misuse
- Malicious Insiders
- Theft
- Natural Disasters
- DoS and DDoS Attacks
- Man-in-the-Middle Attacks
What is the Principle of Least Privilege (PoLP)?
Ensure that users and applications have only the minimum levels of access needed to perform their tasks.
What are the best practices for securing physical databases?
- Access Controls
- Environmental Controls
- Hardware Security
What are some methods to prevent SQL injection attacks?
- Input Validation
- Data Sanitization
- Prepared Statements and Parameterized Queries
What are essential security measures for databases?
- Encryption
- Backup and Recovery Plans
- Security Policies and Procedures
In PostgreSQL, what are the attributes of roles?
- LOGIN / NOLOGIN
- SUPERUSER / NOSUPERUSER
- CREATEDB / NOCREATEDB
- CREATEROLE / NOCREATEROLE
How do you create a role in PostgreSQL?
CREATE ROLE username;
How do you grant and revoke privileges in PostgreSQL?
Granting: GRANT SELECT ON database TO username;
Revoking: REVOKE SELECT ON database FROM username;
How do you manage role memberships in PostgreSQL?
GRANT it_staff TO john_doe;
What command displays all roles and their attributes in PostgreSQL?
\du
What is the command to create a user with login rights in PostgreSQL?
CREATE USER john_doe WITH LOGIN PASSWORD ‘password’;
What is the difference between CREATE ROLE and CREATE USER in PostgreSQL?
There is no difference in terms of command syntax; the key difference lies in whether the LOGIN privilege is granted. Use CREATE ROLE for groups and CREATE USER for actual users.