Suppose we have an SQL database. Suppose we have a user D who has no read access to some table named EMP (employees).

Suppose we allow him to create a table with a foreign key regarding EMP table. Is the danger here that when inserting into his table, by having failed/succeeded to insert D can infer what keys are absent/present in EMP ?

Also, say we allow D to read from EMP and he can also define a foreign key in his new table regarding EMP. Is the danger still the same only that others who can read D's table can try inserting and inferring ? Because basically D can copy EMP to his table because he can read EMP. So why does the foreign key matter if D can read EMP and is able to copy it anyway ?

How does the foreign key add to the security problem if having read access on EMP means you know all of EMP's entries ?

  • The original question didn't say anything about EMP. I assume it's a table with employees data (id as primary key, name, salary) and someone wants that info to remain private. But that's my guess, the question is rather general. – caffein May 16 at 20:04
  • Normally keys aren't supposed to contain meaningful information. Some people violate this DB design principle, and use a name as a key, i.e. johnTJohnson01011984. The only real danger in leaking the presence of a key is if it contains real information. i.e. if it's an increasing integer, it might give away roughly how many employees you've had. – Steve Sether May 16 at 20:09
  • @SteveSether But then, what would be the extra danger of giving D read access on EMP + foreign key right. If D has read on EMP he can copy EMP anyway so why does the foreign key add to the danger ? – caffein May 16 at 20:11
  • Is it because if D doesn't cooperate (does not copy EMP into his table) then others who can read his own table can infer the keys of EMP by failing/succeeding to insert into D's table ? – caffein May 16 at 20:14
  • Presumably the employee table has more information that just a key. It's sort of hard to make generalizations here without real information. Is this some kind of school homework? – Steve Sether May 16 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.