DBSheriff demo

PostgreSQL schema

Sensitive tables (real data)

A statement here may be ended. Real filings. DBSheriff treats every statement that touches these tables as high risk.

public.balance_sheet

table, about 44,000 rows

A statement here may be ended.

Source: SEC EDGAR (Public company filings.)

ColumnType
symboltext
period_enddate
fiscal_yearinteger
period_typetext
total_assetsnumeric(20,2)
current_assetsnumeric(20,2)
inventorynumeric(20,2)
goodwillnumeric(20,2)
total_liabilitiesnumeric(20,2)
current_liabilitiesnumeric(20,2)
deferred_revenue_currentnumeric(20,2)
stockholders_equitynumeric(20,2)
cash_and_equivalentsnumeric(20,2)
long_term_debtnumeric(20,2)
loaded_attimestamp with time zone
shares_outstandingbigint

public.income_statement

table, about 44,000 rows

A statement here may be ended.

Source: SEC EDGAR (Public company filings.)

ColumnType
symboltext
period_enddate
fiscal_yearinteger
period_typetext
revenuenumeric(20,2)
cost_of_revenuenumeric(20,2)
gross_profitnumeric(20,2)
research_and_developmentnumeric(20,2)
sga_expensenumeric(20,2)
labor_and_related_expensenumeric(20,2)
operating_incomenumeric(20,2)
net_incomenumeric(20,2)
eps_basicnumeric(10,4)
eps_dilutednumeric(10,4)
loaded_attimestamp with time zone

public.insider_transactions

table, about 2,000,000 rows

A statement here may be ended.

The names of the filers are not shown on this site.

Source: SEC EDGAR (Public company filings.)

ColumnType
symboltext
accession_numbertext
txn_seqinteger
filing_datedate
reporting_owner_nametext
reporting_owner_ciktext
is_officerboolean
is_directorboolean
is_ten_pct_ownerboolean
officer_titletext
is_derivativeboolean
security_titletext
transaction_datedate
transaction_codetext
sharesnumeric(20,4)
price_per_sharenumeric(14,4)
acquired_disposedtext
shares_owned_afternumeric(20,4)
loaded_attimestamp with time zone

Normal tables and views (real data)

Ordinary reads. Real data that DBSheriff scores like any other table.

public.cash_flow

table, about 41,000 rows

Ordinary reads.

Source: SEC EDGAR (Public company filings.)

ColumnType
symboltext
period_enddate
fiscal_yearinteger
period_typetext
operating_cash_flownumeric(20,2)
investing_cash_flownumeric(20,2)
financing_cash_flownumeric(20,2)
capital_expendituresnumeric(20,2)
dividends_paidnumeric(20,2)
share_buybacksnumeric(20,2)
share_issuancesnumeric(20,2)
stock_based_compensationnumeric(20,2)
loaded_attimestamp with time zone

public.date_dimension

table, about 9,500 rows

Ordinary reads.

Source: Calendar facts (Derived from the calendar.)

ColumnType
datedate
yearinteger
quarterinteger
monthinteger
month_nametext
dayinteger
day_of_weekinteger
day_nametext
week_of_yearinteger
is_weekendboolean
is_trading_dayboolean

public.index_membership

table, about 880 rows

Ordinary reads.

Source: Wikipedia (Constituent lists, licence CC BY-SA 4.0.)

ColumnType
symboltext
start_datedate
end_datedate
start_date_exactboolean
loaded_attimestamp with time zone

public.macro_observations

table, about 73,000 rows

Ordinary reads.

Source: FRED (Federal Reserve Bank of St. Louis) (Macro-economic data series.)

ColumnType
series_idtext
datedate
valuenumeric(20,6)
loaded_attimestamp with time zone

public.macro_series

table, about 81 rows

Ordinary reads.

Source: FRED (Federal Reserve Bank of St. Louis) (Macro-economic data series.)

ColumnType
series_idtext
indicator_nametext
descriptiontext
categorytext

public.pension_funds

view, a view

Ordinary reads.

Source: FRED (Federal Reserve Bank of St. Louis) (Macro-economic data series.)

ColumnType
datedate
pension_typetext
metrictext
valuenumeric(38,2)
descriptiontext

public.securities

table, about 500 rows

Ordinary reads.

Source: Wikipedia (Constituent lists, licence CC BY-SA 4.0.)

ColumnType
symboltext
company_nametext
ciktext
is_indexboolean
created_attimestamp with time zone
updated_attimestamp with time zone
gics_sectortext
gics_sub_industrytext
date_added_to_indexdate

public.shareholders_equity

table, about 43,000 rows

Ordinary reads.

Source: SEC EDGAR (Public company filings.)

ColumnType
symboltext
period_enddate
fiscal_yearinteger
period_typetext
beginning_equitynumeric(20,2)
net_incomenumeric(20,2)
dividends_paidnumeric(20,2)
share_buybacksnumeric(20,2)
share_issuancesnumeric(20,2)
stock_based_compensationnumeric(20,2)
other_unexplainednumeric(20,2)
ending_equitynumeric(20,2)
loaded_attimestamp with time zone

public.us_ownership_by_sector

view, a view

Ordinary reads.

Source: FRED (Federal Reserve Bank of St. Louis) (Macro-economic data series.)

ColumnType
datedate
asset_classtext
sectortext
sector_grouptext
valuenumeric(38,2)
descriptiontext

Sensitive fixtures (invented data)

Synthetic data. A statement here may be ended. Invented rows that look like card, salary and credential data. None of it is real.

financial_data.credit_cards

table, about 100 rows

Synthetic data. A statement here may be ended.

Source: Invented for the demo (Synthetic rows; no real person or card.)

ColumnType
snointeger
card_numbercharacter varying(25)
cvvcharacter varying(8)
expiry_datedate

hr_schema.salaries

table, about 100 rows

Synthetic data. A statement here may be ended.

Source: Invented for the demo (Synthetic rows; no real person or card.)

ColumnType
snointeger
firstnamecharacter varying(25)
lastnamecharacter varying(25)
salarydouble precision

system_auth.credentials

table, about 6 rows

Synthetic data. A statement here may be ended.

Source: Invented for the demo (Synthetic rows; no real person or card.)

ColumnType
snointeger
usernamecharacter varying(25)
password_hashcharacter varying(100)

Decoys

Decoys: any read is flagged. Bait tables with invented rows. Nobody has a reason to read them, so DBSheriff flags every read.

public.card_vault_archive

table, row count not available

Decoys: any read is flagged.

Source: Invented for the demo (Synthetic rows; no real person or card.)

ColumnType
card_idinteger
pan_last4character varying(4)
pan_tokencharacter varying(40)
expirycharacter varying(5)
beaconcharacter varying(48)

public.hr_salaries_export

table, row count not available

Decoys: any read is flagged.

Source: Invented for the demo (Synthetic rows; no real person or card.)

ColumnType
employee_idinteger
emailcharacter varying(80)
annual_salaryinteger
bonusinteger
beaconcharacter varying(48)

Examples

Copy one into the SQL box. What a statement does is stated with each example.

Cash flow of one company

The last ten cash-flow filings of one ticker.

SELECT symbol, period_end, period_type, operating_cash_flow FROM cash_flow WHERE symbol = 'AAPL' ORDER BY period_end DESC LIMIT 10

Expected: returns 1 to 10 rows.

Last eight equity rows

The most recent shareholders' equity rows of one ticker.

SELECT symbol, period_end, beginning_equity, ending_equity FROM shareholders_equity WHERE symbol = 'MSFT' ORDER BY period_end DESC LIMIT 8

Expected: returns 1 to 8 rows.

A window of one FRED series

Twelve recent observations of one macro series.

SELECT date, value FROM macro_observations WHERE series_id = 'Y351RC1A027NBEA' ORDER BY date DESC LIMIT 12

Expected: returns 1 to 12 rows.

Companies of one sector

Ten S&P 500 companies of the information technology sector.

SELECT symbol, company_name FROM securities WHERE gics_sector = 'Information Technology' ORDER BY symbol LIMIT 10

Expected: returns 1 to 10 rows.

Companies per sector

A count per sector.

SELECT gics_sector, COUNT(*) AS companies FROM securities GROUP BY gics_sector ORDER BY companies DESC

Expected: returns 1 to 20 rows.

Cash flow joined to equity

Two tables joined on ticker and period.

SELECT c.symbol, c.period_end, c.operating_cash_flow, e.ending_equity FROM cash_flow c JOIN shareholders_equity e ON e.symbol = c.symbol AND e.period_end = c.period_end WHERE c.symbol = 'AAPL' ORDER BY c.period_end DESC LIMIT 10

Expected: returns 1 to 10 rows.

A view: pension funds

The pension_funds view, built on FRED series.

SELECT date, pension_type, metric, value FROM pension_funds ORDER BY date DESC LIMIT 10

Expected: returns 1 to 10 rows.

A view: ownership by sector group

A count per sector group of the us_ownership_by_sector view.

SELECT sector_group, COUNT(*) AS observations FROM us_ownership_by_sector GROUP BY sector_group ORDER BY sector_group

Expected: returns 1 to 10 rows.

Trading days per year

The calendar table, five recent years.

SELECT year, COUNT(*) AS trading_days FROM date_dimension WHERE is_trading_day GROUP BY year ORDER BY year DESC LIMIT 5

Expected: returns 1 to 5 rows.

The same count, again and again

Run this many times in a row to imitate a burst of identical statements.

SELECT COUNT(*) AS filings FROM cash_flow

Expected: returns 1 row.

Look around: list the tables

Catalog reconnaissance, the first step of many attacks.

SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY table_schema, table_name LIMIT 50

Expected: returns 1 to 50 rows.

A narrow read of a sensitive table

One ticker, five rows. A statement on a sensitive table may be ended while it runs, whatever its size.

SELECT symbol, period_end, revenue, net_income FROM income_statement WHERE symbol = 'AAPL' ORDER BY period_end DESC LIMIT 5

Expected: returns rows, or DBSheriff ends the statement.

Balance sheet totals

Total assets and liabilities of one ticker.

SELECT symbol, period_end, total_assets, total_liabilities FROM balance_sheet WHERE symbol = 'MSFT' ORDER BY period_end DESC LIMIT 5

Expected: returns rows, or DBSheriff ends the statement.

Mass read of a sensitive table

A bulk read of the whole insider table, which DBSheriff is built to stop.

SELECT symbol, filing_date, transaction_code, shares, price_per_share FROM insider_transactions

Expected: DBSheriff may end this statement.

One page of a slow sweep

Page 3 of a sweep that reads a sensitive table 200 rows at a time.

SELECT symbol, filing_date, transaction_code, shares FROM insider_transactions ORDER BY filing_date, accession_number, txn_seq LIMIT 200 OFFSET 400

Expected: returns rows, or DBSheriff ends the statement.

A sleep probe

A statement that only waits. The demo itself stops anything that runs past 30 seconds.

SELECT pg_sleep(45)

Expected: DBSheriff may end this statement.

Read a decoy table

card_vault_archive is bait. Any read of it is flagged.

SELECT * FROM card_vault_archive LIMIT 5

Expected: returns rows, or DBSheriff ends the statement.

Read the invented card table

The rows are invented. DBSheriff still treats the table as sensitive.

SELECT * FROM financial_data.credit_cards LIMIT 5

Expected: returns rows, or DBSheriff ends the statement.

Try to create a table

Visitors can read and nothing else. The database refuses this and DBSheriff still scores it.

CREATE TABLE scratch (id integer)

Expected: the database refuses it (error 42501).