Skip to content

Discovery: find SSN and credit card data in an S3 bucket, filtered to

Source: 15-find-pii-s3.phisql

PhiSQL

-- Discovery: find SSN and credit card data in an S3 bucket, filtered to
-- findings with a risk score above 7. Compiles to the discovery-query JSON
-- in 15-find-pii-s3.json (executed by a Phinder-compatible engine; not a
-- Phileas policy).

FIND PII IN 's3://prod-data/customers/'
  WHERE entity_type IN ('SSN', 'CREDIT_CARD')
    AND risk_score > 7;

Compiles to

{
  "operation": "FIND_PII",
  "source": {
    "uri": "s3://prod-data/customers/",
    "scheme": "s3"
  },
  "where": {
    "type": "and",
    "left": {
      "type": "in",
      "column": "entity_type",
      "values": ["SSN", "CREDIT_CARD"]
    },
    "right": {
      "type": "compare",
      "column": "risk_score",
      "op": ">",
      "value": 7
    }
  }
}