Arquitectura de Datos

Data Mesh: Security, Privacy, and Access Control, How to Protect Data Products in a Decentralized Architecture

Learn how to design security, privacy, and access control in a Data Mesh architecture by applying least privilege, data classification, AWS KMS encryption, attribute-based access control with AWS Lake Formation, and end-to-end auditing.

Content explored 0%
18px

The indicator keeps the furthest percentage explored; marking the article complete is your choice.

When Fast Access Compromises Domain Privacy

At CommerceFlow, adopting Data Mesh enabled the Sales, Payments, and Inventory domains to publish their own data products (sales-orders, confirmed-payments, and inventory-availability) without waiting on a centralized data engineering queue. However, when the Business Intelligence (BI) team requested urgent access to build a quarterly conversion dashboard, an engineer created a shared role with s3:GetObject on the wildcard resource arn:aws:s3:::commerceflow-mesh-*/* and attached the managed policy AmazonAthenaFullAccess.

Two weeks later, an internal security review uncovered four critical findings:

  1. Any analyst assuming that shared role could query not only the aggregate order amounts in sales-orders, but also raw customer email addresses (customer_email), home addresses (shipping_address), and bank settlement tokens (settlement_reference) stored in confirmed-payments.
  2. An automated ingestion script in the Inventory domain authenticated using long-lived static access keys (AKIA...) stored in environment variables that had not been rotated in eight months.
  3. A data scientist had exported a full CSV extract of sales-orders into an unmonitored sandbox bucket without a customer-managed encryption key or retention policy, creating an unmanaged shadow copy.
  4. AWS CloudTrail was configured to record only Management Events, leaving no audit trail of which identity had read specific Parquet files in Amazon S3.

CommerceFlow's mistake was not decentralizing its data, but confusing self-service access with the absence of security boundaries. In a Data Mesh architecture, every Data Product must be simultaneously discoverable for authorized consumers with a legitimate purpose and strictly protected against unauthorized access. Achieving that balance requires embedding security, privacy, and access control into the design of each Data Product and automating enforcement through the platform.


Security, Privacy, Access Control, and Auditability: Distinct Responsibilities

In day-to-day engineering discussions, several security and governance terms are often treated as interchangeable even though they address different risks. Before writing AWS policies or SQL views, let us clarify the exact scope of each responsibility:

ConceptWhat It Protects or VerifiesConcrete Question in CommerceFlowCommon Trap to Avoid
ConfidentialityEnsures that data is read only by authorized identities.Can an inventory analyst read bank settlement details inside confirmed-payments?Assuming that hiding a bucket or table name protects its confidentiality.
IntegrityGuarantees that data is not modified or deleted in an unauthorized or accidental way.Can a downstream consumer overwrite or delete partitions published by the Sales domain?Granting read/write (s3:*) permissions to consumer roles that only need read (SELECT) access.
AvailabilityEnsures that authorized consumers can reliably access the Data Product within agreed windows.Do encryption key and network policies allow the financial close job to read confirmed-payments on time?Breaking a legitimate production consumer by revoking KMS permissions without testing the access chain.
PrivacyGoverns the ethical and lawful handling of personal data: purpose limitation, minimization, and retention.Does the conversion dashboard actually need customer_email, or do aggregated metrics suffice?Assuming encryption guarantees privacy: if an authorized user decrypts and reads personal attributes without a legitimate purpose, the bytes were encrypted on disk, yet privacy was violated.
Authentication (AuthN)Verifies the identity of the requester (human user or workload).How does the Sales pipeline or analyst Ana prove her identity?Sharing a single generic user (bi_shared_user) across ten people or using permanent static keys.
Authorization (AuthZ)Determines which specific actions an authenticated identity may perform on which specific data resources.Once authenticated, may Ana run SELECT on total_amount while being blocked from customer_email?Assuming that permission to invoke a query engine (Amazon Athena) grants permission to read every cataloged table.
AuditabilityRecords immutable evidence of who accessed (or attempted to access) which data, when, and from where.Which identities queried restricted columns in confirmed-payments over the past 90 days?Assuming default cloud logs record every object read or SQL query without explicit data event configuration.

Four Guiding Principles Across the Mesh

To coordinate these guarantees across autonomous domains, we apply four foundational security engineering principles:

  1. Least Privilege: Every human user or workload receives only the minimum permissions required for its specific task and only for the duration needed.
  2. Separation of Duties: Platform engineers who manage shared infrastructure do not automatically receive permission to decrypt and read sensitive domain business data; domain producers cannot unilaterally disable global security guardrails.
  3. Defense in Depth: No single control is treated as infallible. Protection layers network boundaries, IAM identity policies, fine-grained catalog permissions (table/column/row), S3 bucket policies, and domain-specific encryption keys in AWS KMS.
  4. Zero Trust: Implicit trust is never granted merely because a request originates inside the corporate network or from another CommerceFlow domain; every request is authenticated, explicitly authorized at the resource boundary, and audited.

Classifying Data by Sensitivity Across Business Domains

Not every Data Product—and not every column inside a single table—carries the same risk. Applying maximum restrictions to a public warehouse directory slows down innovation, whereas treating financial tokens as internal data exposes the organization. At CommerceFlow, federated governance defines four classification tiers that each domain assigns to its attributes inside its Data Contract:

Classification TierDescription and CriteriaExamples in sales-orders (Sales), confirmed-payments (Payments), and inventory-availability (Inventory)Mandatory Controls in the Mesh
1. PublicInformation approved for external release with no adverse impact.General product categories, ISO country or currency codes (currency).Write integrity controls (only the owning domain can modify).
2. InternalLow-risk operational data intended for general internal business use.warehouse_id, available_qty in inventory-availability; order_status and created_at in sales-orders.Read access for authenticated internal roles; anonymous/public access strictly blocked.
3. ConfidentialSensitive commercial metrics or indirect identifiers whose disclosure would harm the business or partners.total_amount, discount_code, pseudonymized customer_id_hash in sales-orders; payment_method_type in confirmed-payments.Explicit domain/purpose authorization, domain KMS encryption, and query monitoring.
4. Restricted (PII / Financial)Direct personal identifiers (PII), sensitive financial records, or attributes subject to strict regulatory obligations.customer_email, shipping_address, phone_number in Sales; settlement_token, payer_tax_id, card_last4 in Payments.Excluded by default from general BI views, column/cell-level restriction, approved purpose justification, and detailed data-access auditing.

Legal and Regulatory Note: Classifying data and using cloud services such as AWS does not automatically satisfy regulations such as GDPR, CCPA, HIPAA, or PCI-DSS. Legal compliance depends on the applicable jurisdiction, the lawful basis for processing, contractual obligations, and the specific technical and organizational controls implemented and verified by each organization.


Protection in Transit, at Rest, and Credential Hygiene

The first technical layer ensures that raw bytes cannot be intercepted over the network or read from storage by bypassing catalog governance:

  1. Protection in Transit (Encryption in Transit): Every connection between operational databases, ingestion pipelines, Amazon S3, Amazon Athena, and BI clients must enforce TLS (HTTPS) and deny plaintext requests via explicit bucket policy conditions such as "aws:SecureTransport": "true".
  2. Protection at Rest (Encryption at Rest) with AWS KMS: While default server-side encryption (SSE-S3) protects against physical media theft, any principal in the account with s3:GetObject can read SSE-S3 objects transparently. By using customer-managed keys in AWS KMS (SSE-KMS) scoped per domain (for example, alias/commerceflow-sales-prod and alias/commerceflow-payments-prod), an identity requires both data-access authorization and explicit kms:Decrypt permission in the KMS key policy.
  3. Eliminating Permanent Credentials and Managing Secrets: Workloads running on AWS must assume IAM roles via AWS STS (Security Token Service), which issues short-lived temporary credentials (e.g., 15 to 60 minutes) that rotate automatically. When an ingestion connector must authenticate against an external database using a password or API token, the secret is stored encrypted in AWS Secrets Manager with automated rotation and is never hardcoded in source repositories, YAML files, or container images.

Authorization Models: IAM, RBAC, and ABAC in a Data Mesh

As the number of data products and consumers grows across the mesh, how you express authorization rules determines whether security scales cleanly or collapses under administrative overhead:

1. Identity and Access Management (IAM)

The foundational cloud control plane that authenticates principals (service roles, federated SSO users) and evaluates JSON policies over infrastructure and service actions (s3:GetObject, glue:GetTable, athena:StartQueryExecution, kms:Decrypt).

2. Role-Based Access Control (RBAC)

Grants permissions based on organizational job functions: role_sales_producer, role_bi_analyst, role_finance_auditor, role_platform_admin. RBAC is straightforward when roles are coarse-grained, but it suffers from role explosion when you need separate roles for every combination of domain, geography, and sensitivity tier (role_bi_sales_latam_no_pii, role_bi_payments_eu_confidential...).

3. Attribute-Based Access Control (ABAC / Tag-Based Access Control)

Evaluates access by matching attributes of the principal (e.g., department=finance, clearance=confidential) against metadata tags attached to data resources (for example, LF-Tags in AWS Lake Formation such as domain=sales, sensitivity=confidential, pii=false). When the Sales domain adds a new column and tags it with sensitivity=restricted, existing ABAC policies automatically block that column for roles authorized only up to sensitivity=confidential, without requiring manual edits to dozens of policies.


Separating Infrastructure Permissions from Data Permissions

One of the most common architectural mistakes in AWS data platforms is assuming that AWS Lake Formation replaces IAM, S3, or KMS, or conversely, assuming that IAM alone can restrict individual columns inside a Parquet file. In reality, these controls operate at different layers and must be coordinated across the access path:

[Consumer: BI Analyst Role (Short-lived STS Credentials)]
       |
       +---> Layer 1: AWS IAM (Service & Infrastructure Permissions)
       |     May this role invoke athena:StartQueryExecution and glue:GetTable?
       |     (Note: The role does NOT have direct s3:GetObject on the product bucket)
       v
       +---> Layer 2: AWS Lake Formation (Fine-Grained Catalog Permissions)
       |     Which databases, tables, columns (LF-Tags), and rows may this role SELECT?
       v
       +---> Layer 3: Amazon S3 + AWS KMS (Physical Storage & Encryption)
             The integrated engine obtains mediated temporary credentials to read S3 blocks
             and decrypts them via the domain KMS key if the key policy permits.

Consider what happens if these layers are not coordinated:

  • If you grant direct s3:GetObject in IAM to the BI analyst role on s3://commerceflow-sales-prod/*, the analyst can download the underlying Parquet file directly using the AWS CLI (aws s3 cp) and read every restricted column (customer_email), completely bypassing the column-level rules configured in Lake Formation and Athena views.
  • Therefore, for S3 locations registered with Lake Formation for analytical consumption, human analysts and BI roles must not hold direct s3:GetObject IAM permissions on the underlying data product buckets; their data access is mediated through integrated engines (such as Amazon Athena or AWS Glue) that enforce catalog table, column, and row filters.

Practical Case in CommerceFlow: Access Matrix and Layered Controls

Let us design the security and access policy for three Data Products in CommerceFlow:

  • sales-orders (Sales): contains commercial metrics (order_id, order_status, total_amount, currency, country_code, created_at) and restricted personal attributes (customer_email, shipping_address).
  • confirmed-payments (Payments): contains reconciled payment records (payment_id, order_id, settled_amount, payment_status) and restricted financial attributes (settlement_token, card_last4).
  • inventory-availability (Inventory): contains internal operational stock levels (sku, warehouse_id, available_qty, updated_at).

Mesh Role and Permission Matrix

Role / Identitysales-orders (Internal / Confidential Columns)sales-orders (Restricted PII Columns)confirmed-payments (Confidential Columns)confirmed-payments (Restricted Columns)inventory-availability (Internal)Write & Administrative Scope
sales-producer-pipeline (Sales Domain Service Role)Read / WriteRead / WriteNo AccessNo AccessNo AccessWrites exclusively to the sales-orders bucket prefix and catalog table.
bi-commercial-analyst (BI Analyst)Read Only (SELECT)DeniedRead Only (SELECT)DeniedRead Only (SELECT)No write access on products; writes temporary query results only to an isolated Athena workgroup prefix.
finance-reconciliation-role (Finance & Audit)Read Only (SELECT)DeniedRead Only (SELECT)Read Only (Audited SELECT)No AccessRead-only access for bank settlement and tax reconciliation.
platform-infra-engineer (Platform Engineer)Denied (no plaintext data read)DeniedDeniedDeniedDeniedManages control-plane templates, engines, and policies without kms:Decrypt permission on domain business data.

Declarative Classification and LF-Tag Controls in the Data Contract (YAML)

The Sales domain team declares column classifications and access grants for sales-orders in a YAML specification that the Self-Serve Data Platform uses to configure catalog tags and permissions:

# Security and privacy specification for the sales-orders Data Product
dataProduct: sales-orders
domain: sales
ownerRole: arn:aws:iam::111122223333:role/commerceflow-sales-producer-role
storageLocation: s3://commerceflow-sales-data-product-prod/sales-orders/
kmsKeyAlias: alias/commerceflow-sales-prod

catalogClassification:
  defaultTags:
    domain: sales
    environment: prod
  columns:
    - name: order_id
      sensitivity: internal
      pii: "false"
    - name: customer_id_hash
      sensitivity: confidential
      pii: "false"
      protectionMethod: hmac_sha256_pseudonymized
    - name: order_status
      sensitivity: internal
      pii: "false"
    - name: total_amount
      sensitivity: confidential
      pii: "false"
    - name: country_code
      sensitivity: internal
      pii: "false"
    - name: customer_email
      sensitivity: restricted
      pii: "true"
    - name: shipping_address
      sensitivity: restricted
      pii: "true"

accessGrants:
  - principalRole: arn:aws:iam::111122223333:role/commerceflow-bi-analyst-role
    permissions: ["SELECT"]
    allowedTagFilter:
      domain: sales
      sensitivity: ["internal", "confidential"]
      pii: ["false"]
    rowFilter: "order_status != 'INTERNAL_TEST'"

Least-Privilege IAM Policy for the Producer Pipeline

The following conceptual IAM policy illustrates how the Sales producer pipeline role (commerceflow-sales-producer-role) restricts its permissions strictly to its own product prefix and domain KMS key, avoiding broad * wildcards:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "WriteOnlyToSalesOrdersPrefix",
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::commerceflow-sales-data-product-prod/sales-orders/*"
    },
    {
      "Sid": "ListOnlySalesOrdersBucketPrefix",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::commerceflow-sales-data-product-prod",
      "Condition": {
        "StringLike": {
          "s3:prefix": [
            "sales-orders/*"
          ]
        }
      }
    },
    {
      "Sid": "UseDomainKmsKeyOnlyViaS3",
      "Effect": "Allow",
      "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:GenerateDataKey"
      ],
      "Resource": "arn:aws:kms:us-east-1:111122223333:key/12345678-aaaa-bbbb-cccc-1234567890ab",
      "Condition": {
        "StringEquals": {
          "kms:ViaService": "s3.us-east-1.amazonaws.com"
        }
      }
    }
  ]
}

Implementation Warning: This JSON policy is a conceptual example using fictitious ARNs. Before deploying any policy to production, always validate exact resource ARNs, KMS key policies, bucket policies, and network conditions using tools such as IAM Policy Simulator and IAM Access Analyzer.


Minimization, Masking, Pseudonymization, and SQL Views

Beyond blocking columns in the catalog, domain teams should apply data minimization by design: omitting personal attributes from analytical products whenever downstream use cases do not require them.

Critical Distinction: Masking vs. Pseudonymization vs. Anonymization

  • Data Masking: Partially obscures a value at display or query time (for example, turning ana.gomez@example.com into a***@example.com or a card number into ****-****-****-4821). Useful for customer support screens, but the underlying sensitive value still exists.
  • Pseudonymization: Replaces a direct identifier (customer_email or customer_id) with a deterministic token or keyed cryptographic hash (HMAC-SHA256(customer_id, secret_salt)). This allows analysts to join orders belonging to the same customer over time without exposing raw emails. Crucial caveat: pseudonymization is not anonymization. Anyone who has access to the lookup table, the secret salt, or enough quasi-identifiers (exact postal code, purchase timestamp, and exact basket amount) can re-identify the individual; therefore, pseudonymized records remain personal data subject to privacy controls.
  • Anonymization: An irreversible transformation after which an individual can no longer be identified directly or indirectly by any reasonably likely means (for example, aggregated metrics enforcing minimum cohort sizes or k-anonymity).

Publishing a Minimized SQL View (and Understanding Its Limits)

For consumers who only need to analyze revenue trends by country and order status, the Sales domain can publish an analytical SQL view that excludes direct PII columns and truncates timestamps to the hour:

-- Minimized analytical view for Business Intelligence consumption
CREATE OR REPLACE VIEW sales_mesh_catalog.v_sales_orders_bi AS
SELECT
    order_id,
    -- Keyed HMAC pseudonymized identifier computed during ingestion using a secret in KMS/Secrets Manager
    customer_id_hash,
    order_status,
    total_amount,
    currency,
    country_code,
    -- Truncated to the hour to reduce exact temporal correlation risk
    DATE_TRUNC('hour', created_at) AS order_hour_utc
FROM sales_mesh_catalog.sales_orders
WHERE order_status IN ('PAID', 'SHIPPED', 'CANCELLED', 'REFUNDED');

Fundamental Boundary to Remember: Creating a SQL view such as v_sales_orders_bi does not by itself replace an authorization control or guarantee anonymization. If the analyst still holds SELECT permissions on the base table sales_orders or direct s3:GetObject permissions on the underlying Parquet files, they can bypass the view and query customer_email directly. A view acts as an effective security boundary only when the authorization engine (such as Lake Formation or the database engine) revokes direct read access to the base table and grants the consumer SELECT exclusively on the view or on the permitted subset of columns.


Auditing, Risk Detection, and Preventing Unmanaged Shadow Copies

Access control does not end when a permission is granted. In a decentralized architecture, you must continuously audit how Data Products are accessed and close operational blind spots:

  1. True Visibility in AWS CloudTrail: By default, CloudTrail logs Management Events (such as creating a role or updating a policy), but does not log Data Events (such as individual s3:GetObject or s3:PutObject calls) unless you explicitly enable Data Events on the trail for your data product buckets. To audit who queried which table and columns across the mesh, combine AWS Lake Formation audit logs, Amazon Athena query execution history, and S3 Data Events in CloudTrail.
  2. Preventing Unmanaged Shadow Copies: When an analyst executes CREATE TABLE AS SELECT (CTAS) or downloads Athena query results into an ungoverned bucket, those exported files lose their catalog classification tags. To mitigate this risk, the platform restricts Athena Workgroup output locations to encrypted, access-controlled staging buckets, enforces S3 lifecycle rules that expire temporary query results after 24–48 hours, and blocks writes to unapproved external buckets via AWS Organizations Service Control Policies (SCPs) or VPC Endpoint policies.
  3. Time-Bound Grants and Access Recertification: Access grants requested through the Data Catalog for exploratory projects should include an automatic expiration timestamp (e.g., 30 days) so permissions do not accumulate indefinitely (privilege creep).
  4. Lineage-Driven Classification Propagation: When an attribute classified as confidential or restricted feeds a downstream Aggregate or Consumer-Aligned Data Product, column-level Data Lineage allows governance checks to verify that the derived product inherits at least the same classification tier and security controls.

Three Scenarios with Different Security and Access Control Decisions

Scenario 1: Multi-Domain Regulated E-Commerce (CommerceFlow)

  • Context: Three domains (Sales, Payments, Inventory) share dozens of datasets with over 40 analysts, data scientists, and finance workflows on AWS.
  • Decision: Implement ABAC using LF-Tags in AWS Lake Formation (domain, sensitivity, pii), revoke direct s3:GetObject access for analytical users, encrypt each domain with a dedicated customer-managed key in AWS KMS, and enable CloudTrail Data Events on prefixes classified as confidential and restricted.
  • Why: Managing column-by-column permissions through manual IAM policies for 40 consumer roles does not scale; tag-based policies adapt automatically as domains evolve their schemas.

Scenario 2: Cross-Domain Integration for Fraud Detection

  • Context: The Fraud / ML team needs to join sales-orders and confirmed-payments in batch to train a model that detects chargeback rings operating from the same shipping address.
  • Decision: Rather than exposing plaintext customer_email and shipping_address to the entire data science team, the Sales ingestion pipeline generates deterministic keyed tokens (address_fingerprint_hmac and email_domain_hash) using a secret stored in AWS Secrets Manager, and grants access only to the automated training job role (fraud-training-job-role) running inside an isolated subnet with no internet egress.
  • Why: The machine learning algorithm only needs to detect whether two orders share the same address fingerprint or email domain; human engineers do not need to read customer street addresses in plaintext.

Scenario 3: When a Simpler Alternative Is Sufficient (Internal Non-PII Analytics in a Small Team)

  • Context: A B2B logistics startup with a single 5-person engineering team manages internal route and loading-dock timing metrics in PostgreSQL or DuckDB, with no consumer PII or payment card records.
  • Decision: Use standard database RBAC with three clean roles (data_writer, data_reader, db_admin), TLS connections, standard disk encryption, and rotated credentials—without introducing a complex ABAC tag engine or separate KMS keys per column.
  • Why: When datasets contain no personal or regulated financial attributes and team boundaries are small, a well-audited least-privilege RBAC setup is simpler to operate and less prone to misconfiguration.

Using AI Assistants to Design and Audit Security Policies

Large language models can help draft least-privilege policies and spot over-permissive wildcards, provided you never paste real secrets or private identifiers into prompts and a human engineer validates every output before deployment.

Prompt 1: Auditing an IAM Policy to Remove Wildcards and Enforce Least Privilege

Context: I need to review an AWS IAM policy used by the publication pipeline of the "confirmed-payments" Data Product in the Payments domain.
Current flawed policy:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:*", "kms:*", "glue:*"],
      "Resource": "*"
    }
  ]
}
Authorized target resources (fictitious design ARNs):
- S3 Bucket: arn:aws:s3:::commerceflow-payments-prod, exclusive prefix: "confirmed-payments/*"
- Domain KMS Key: arn:aws:kms:us-east-1:111122223333:key/99998888-7777-6666-5555-444433332222
- Glue Catalog Database: "payments_mesh_prod", table: "confirmed_payments"

Task: Rewrite the policy applying least privilege, separating statements by service (S3 object actions, S3 bucket listing restricted by prefix condition, KMS restricted via kms:ViaService, and Glue Catalog scoped to the specific database and table). Explain what concrete risk each change eliminates.
  • What a human must verify: Confirm the exact account ARNs, ensure no administrative actions (s3:PutBucketPolicy, kms:PutKeyPolicy, glue:DeleteDatabase) remain in the policy, and test the resulting policy in a non-production environment using IAM Policy Simulator.

Prompt 2: Reviewing Data Classification and Privacy Before Publishing a Data Contract

Context: The Sales domain is preparing version 2.0 of the "sales-orders" Data Product for consumption by Commercial BI and Marketing teams.
Proposed columns: order_id, customer_id, customer_full_name, customer_email, customer_phone, birth_date, shipping_postal_code, order_status, total_amount, currency, created_at.

Task:
1. Classify each column into one of the 4 tiers (Public, Internal, Confidential, Restricted/PII).
2. Identify which columns violate the data minimization principle for a general Commercial BI use case.
3. Propose which transformations (exclusion, keyed HMAC pseudonymization, generalization, or LF-Tag column restriction) should be applied before publishing, and explain why pseudonymizing customer_id does not make the row anonymous if birth_date and shipping_postal_code remain intact.
  • What a human must verify: Review the recommendations with the organization's privacy or legal team and verify which specific attributes each registered consumer legitimately requires.

Practical Exercises

Exercise 1: Diagnosing a Cross-Layer Authorization Bypass (Lake Formation vs. S3)

The platform team configures a column restriction in AWS Lake Formation so that commerceflow-bi-analyst-role can query order_id and total_amount on the sales_orders table, while denying access to customer_email and shipping_address. However, to troubleshoot a permission error the previous week, an administrator had attached an IAM policy to commerceflow-bi-analyst-role granting Action: ["s3:GetObject", "s3:ListBucket"] on arn:aws:s3:::commerceflow-sales-data-product-prod/* and kms:Decrypt on the domain KMS key.

Explain what happens when the analyst queries the table through Amazon Athena versus what happens if the analyst runs aws s3 cp or reads the S3 path directly from an external Python script, and describe how to fix the permission architecture.

Exercise 2: Designing Classification and Access Controls for confirmed-payments

The Payments domain needs to publish the confirmed-payments Data Product containing the following attributes:

  • payment_id
  • order_id
  • payment_timestamp
  • settled_amount
  • currency
  • payment_gateway_name
  • card_pan_encrypted (encrypted payment card number from the gateway)
  • payer_email
  • bank_settlement_token

Three personas request access:

  1. Commercial BI Analyst (wants to calculate payment success rates by gateway and currency).
  2. Finance Reconciliation Process (needs to match payment_id, order_id, settled_amount, and bank_settlement_token against bank statements).
  3. Self-Serve Data Platform Engineer (maintains the orchestrator that executes catalog registration jobs).

Design the column classification, identify whether any column should be excluded altogether from the analytical Data Product, and define the exact access permissions for each of the three personas.

Exercise 3: Critical Evaluation of Pseudonymization and Auditing Claims

A domain team claims: "Because we replaced customer_email with SHA256(LOWER(customer_email)) in the sales-orders table and the S3 bucket uses default SSE-S3 encryption, the dataset is now completely anonymous, complies with all privacy laws, and we can grant read access to all employees without enabling CloudTrail Data Events."

Identify at least three technical or conceptual flaws in that statement and explain how to correct each one.


Solutions to the Exercises

Solution to Exercise 1

  • What happens: When the analyst queries the table through Amazon Athena integrated with Lake Formation, the catalog policy blocks the customer_email column as expected. However, because the analyst's IAM role holds direct s3:GetObject and kms:Decrypt permissions on the underlying S3 bucket, the analyst can execute aws s3 cp s3://commerceflow-sales-data-product-prod/sales-orders/part-001.parquet . or read the file directly with PyArrow/DuckDB and read every column in plaintext, including customer_email and shipping_address.
  • How to fix it: Enforce defense in depth and separate service permissions from physical storage permissions. Revoke direct s3:GetObject permissions from commerceflow-bi-analyst-role on the data product bucket and register the S3 location in Lake Formation using a dedicated data-access service role, ensuring that analytical users can read the data only through governed query engines that enforce column and row filters.

Solution to Exercise 2

  1. Data minimization by design: The attribute card_pan_encrypted must not be included at all in the analytical confirmed-payments Data Product; it belongs strictly inside the PCI-scoped transactional payment vault, as no analytical or accounting workflow in the mesh requires raw or encrypted card numbers.
  2. Classification of the remaining columns:
    • currency, payment_gateway_name: Internal.
    • payment_id, order_id, payment_timestamp, settled_amount: Confidential.
    • payer_email, bank_settlement_token: Restricted (PII and sensitive financial settlement secret).
  3. Permissions per persona:
    • Commercial BI Analyst: SELECT access only to Internal and Confidential columns (payment_id, order_id, payment_timestamp, settled_amount, currency, payment_gateway_name); access denied to payer_email and bank_settlement_token.
    • Finance Reconciliation Process: SELECT access to Internal, Confidential, and specifically bank_settlement_token (with full audit logging), but denied access to payer_email, since bank reconciliation matches on settlement tokens rather than customer email addresses.
    • Self-Serve Data Platform Engineer: Control-plane permissions to deploy pipelines and manage catalog infrastructure, but no SELECT or kms:Decrypt permission on the business records inside confirmed-payments (separation of duties).

Solution to Exercise 3

The statement contains three major flaws:

  1. An unsalted SHA256 hash of an email address is not anonymization (and is not even secure pseudonymization): Email addresses have a predictable structure; anyone with a list of known emails can compute SHA256(email) (a dictionary or rainbow-table attack) and reverse the identity in seconds. Moreover, because individual transactions remain linked to the same hash, the records are pseudonymized personal data, not anonymous data. Proper pseudonymization requires a keyed HMAC-SHA256 with a secret key stored in KMS/Secrets Manager, and the resulting table still requires access control.
  2. Default SSE-S3 encryption at rest does not restrict authorized internal readers: SSE-S3 transparently decrypts objects for any principal in the account that holds s3:GetObject. It does not enforce purpose-based authorization or least privilege.
  3. Lack of data-access auditing eliminates accountability: Granting broad internal access without query audit logs and CloudTrail Data Events makes it impossible to detect or investigate unauthorized data extraction, violating basic governance and security requirements.

Key Takeaways and Decision Criteria

To protect Data Products in a Data Mesh architecture without sacrificing domain autonomy, apply these core decision criteria:

  • Distinguish security, privacy, and authorization: Encrypting a bucket protects physical storage, but privacy and confidentiality require minimizing exposed attributes and authorizing every read against a legitimate business purpose.
  • Classify at the source and govern via tags (ABAC): The owning domain team understands the business meaning of its data and must classify every column (Public, Internal, Confidential, Restricted) in its Data Contract, allowing the platform to enforce automated table, column, and row policies.
  • Coordinate every layer of the access path: Ensure that AWS IAM policies, S3 bucket policies, AWS KMS key policies, and catalog permissions (such as AWS Lake Formation) work together without leaving direct s3:GetObject backdoors or long-lived static credentials.
  • Audit actual data access and prevent shadow copies: Enable data-access logging on sensitive resources, enforce temporary credentials, and apply automatic expiration to both consumer grants and temporary query results.

Loading conversation…

Keep learning