Skip to content

Comment on A Bad Privacy Bug

Comments

The schema should really be:

  private bit not null default 0
If you use something like tinyint and have a range of values that are acceptable, bake this into the database with a check constraint:
  myfield tinyint not null default 0 check (myfield between 0 and 3)
Regardless of how comprehensive your unit tests are, you should prevent as much bad data as you can at the DB layer.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.