UPI Study › Courses › Database Programming › Free lessons › Lesson 12.5 Free with a free account
Advanced Techniques for Protecting Database Systems
Database Programming · Chapter 12: Database Security and AuditingSection 12.5 · lesson 74 of 7610 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Database Programming.
Lesson complete
Earn the 3 college credits for Database Programming
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Encrypting Database Data: Methods and Applications →← Defending Against SQL Injection — Parameterized Queries, Input Validation, and Best PracticesNext lesson: Encrypting Database Data: Methods and Applications →
A free account plays all of Chapter 1 and 3 more lessons of Database Programming. Create a free account →
In this lesson
Add row-level security, masking, segmentation and tested backups to database defenses.
- Explain how SQL Server row-level security uses filter and block predicates
- Describe what dynamic data masking protects and why it is not a full boundary
- Apply network segmentation and separation of duties to a database system
- Protect backups and prove recovery with an actual restore test
Free study notes
Get this lesson's notes by email
The key points and 4 practice questions with answers, in your inbox. One email, free.
One email. Unsubscribe in one click.
Transcript
Everything said in the video, section by section (1,126 words). Read along, or search it.
Opening Scenario
What a Stolen Support Session Can Reach
Maya Rao owns fictional Lantern Books. She asks Amina Diallo, the database administrator, to imagine that a support session has been stolen. The intruder has a valid connection. Customer details are masked on screen, and the team has a nightly backup. Is that enough protection? Amina tests what the session can read, where it can connect, and whether recovery would actually work.
Row-Level Security
Filter Predicates Limit Visible Rows
Table permissions control an object and an action. Row-level security adds a rule deciding which records an identity may see. For a proposed staff assignment map, Amina assigns selected orders to each worker. The underlying order identifiers and customer data stay unchanged. A filter predicate evaluates the access rule as queries read the table. In SQL Server, a security policy attaches that predicate to the protected table. An injected query through a narrow staff identity still encounters that policy. A successful query does not automatically make other staff members' rows visible. A manager exception must be deliberate. People who can alter the policy remain powerful, so protecting the policy definition is part of protecting the data.
Block Predicates
Writes, MySQL Views and Pooled Logins
A filter rule is not the same as a write prohibition. SQL Server distinguishes filter predicates from block predicates that reject specified writes. Amina tests insertion and reassignment separately. After an update, a disappearing row may still have been improperly moved outside the worker's scope. MySQL has no equivalent built-in row-security policy. A restricted view can filter rows using the connected identity, with direct table access withheld. That workaround needs careful identity handling. A view using only a user-name fragment can lose identity detail, because MySQL accounts also include hosts. A pooled application login creates another issue: all staff may share one database identity. Use trusted application identity context, rather than a visitor-controlled staff name.
Dynamic Data Masking
Masked Display, Unchanged Stored Values
Dynamic data masking alters returned display values, while the stored value stays intact. It can reduce accidental exposure during routine support work. SQL Server offers column masks and an unmask permission for authorized viewers. MySQL Enterprise offers masking functions; a restricted view can construct masked text elsewhere. Amina demonstrates the limitation conceptually: a query can still filter using a guessed underlying value, even when the displayed field is obscured. Repeated guesses may reveal that value. Masking is therefore unsuitable as the sole boundary against someone allowed to issue arbitrary queries. The team restricts query scope, then treats masking as an additional display safeguard. Encryption addresses a different risk and requires separate key decisions.
Network Segmentation
Zones, Firewalls and Database Ports
Now Amina checks reachability. Network segmentation places public web services, application services, and database services in different zones. A firewall permits only the traffic each zone needs. The public website reaches the application; the application reaches the database on its required listener. A direct internet connection to the database is blocked. Administrative access uses a separate controlled path, rather than an open database port. MySQL commonly uses port thirty-three oh six. A default SQL Server instance commonly uses fourteen thirty-three, though configured and named-instance ports can differ. Restrict listeners to needed interfaces, and allow only approved source systems. A private address helps the design, but firewall rules still enforce the boundary.
Separation of Duties
No One Person Holds Every Power
Separation of duties divides sensitive powers, so one person cannot silently grant access, change business data, and erase the evidence. A developer designs application work. A database administrator maintains the service, while permission approval and independent audit review have separate responsibilities. Roles implement these boundaries, but broad fixed roles can exceed the job. Amina reviews their effective powers instead of assuming the role names guarantee safety. A small team may need overlapping duties. Independent review and protected external logs can compensate when complete staffing separation is impractical. Maya records who approves emergency access, how long it lasts, and who reviews its use afterward. An exception should leave evidence rather than become permanent convenience.
Vulnerability Scans
Interpreting Scanner Findings
A vulnerability scan compares the system with known weaknesses. Findings may include old software, exposed listeners, unused accounts, and excessive privileges. Repeat scans after changes and on a schedule. New disclosures and configuration drift make an old clean report insufficient. The result needs interpretation. An empty authentication field in a MySQL account record does not, by itself, prove that anybody can log in without a password. Authentication plugins and external identity mechanisms affect that judgment. Likewise, a SQL Server password-policy flag describes a setting, not the quality of every current secret. Amina assigns owners to confirmed findings, tests the repair, and rescans. A scanner supports investigation; it does not certify the whole application as secure.
Backup Protection
Offline, Encrypted and Separately Stored Copies
Finally, Amina examines the backup. It contains the same sensitive data as production, so its storage deserves its own permissions and encryption. A backup kept only beside the live database can disappear in the same hardware failure. A copy on another system reduces that shared exposure. A permanently online copy may still be reachable by ransomware. Keep a protected offline or immutable copy, according to the recovery design. Use protected credentials, monitor access, and store keys so that authorized recovery can succeed. A readable backup file defeats careful live-table permissions. For MySQL, a consistent transactional dump needs the right assumptions, including transactional tables and controlled schema changes. Restrictive file permissions alone do not encrypt it.
Restore Testing
Only a Real Restore Proves Recovery
SQL Server backup checksums help detect certain corruption. Restore verifyonly checks backup readability and completeness, but it does not replace a real restore test. Amina restores a copy into an isolated environment, then runs meaningful application checks. Only that rehearsal demonstrates the required recovery path. Maya records how recent the recovered data is and how long restoration takes. Those observations help choose a backup schedule that fits the business. The original support-session problem now has several boundaries. Rows, query scope, network rules, independent review, and recoverable copies address different failures.
Quick Check
Masking Alone Cannot Stop Guessing
A tester's database login can run arbitrary queries on customers. The phone column is masked, and Amina worries about guessing. Which added control fits best? Pause, and decide. Narrow what that login may query. A mask alters display only, so reducing reachable rows and columns limits repeated guessing. Opening the listener widens exposure, and longer retention concerns recovery. Neither limits what this login can ask the database.
Resolution
Several Boundaries for Different Failures
Back at Lantern Books, Maya no longer treats the masked screen and nightly file as proof of safety. Amina tests row and write boundaries, restricts database reachability, separates permission review, and rehearses recovery from a protected copy. A stolen session can still cause harm within its permissions. The design reduces that reach, preserves evidence, and gives the store a tested way to recover.
Key Takeaways
Limit Reach, Preserve Evidence, Recover
Use row policies and controlled queries to limit what a connection can reach. Treat masking as a display safeguard, and restrict network paths separately. Separate sensitive duties, then investigate and repair scanner findings. Protect backup copies and keys, and prove recovery with a real restore test.
About Database Programming at UPI Study
Database Programming (Computer Science 381) is a self-paced online course of 76 video lessons in 12 chapters, from database applications, SQL setup, schema planning and normalization to keys and constraints, data types, filtering and sorting, joins, subqueries, views, indexes, ROLLUP and PIVOT, regular expressions and database security. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Computer Science courses Every credit course with PRO →
Why take it here
Why students take Database Programming with UPI Study
Where the credit goes
Universities that work with NCCRS
Database Programming carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Advanced Techniques for Protecting Database Systems
What is row-level security in SQL Server?
Is dynamic data masking a security boundary?
Should a database server accept connections directly from the internet?
Why should you test restoring a database backup?
About the Database Programming course
How many college credits is Database Programming?
How much does Database Programming cost and what is included?
Which universities accept UPI Study credits?
How long does Database Programming take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Database Programming.
76 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
Updated
3 credits · NCCRSEnroll →