Skip to content

CCM-23434: Add DL getLetterData permissions - #684

Merged
masl2 merged 7 commits into
mainfrom
fix/CCM-23434_dl-bucket-perms
Sep 4, 2026
Merged

CCM-23434: Add DL getLetterData permissions#684
masl2 merged 7 commits into
mainfrom
fix/CCM-23434_dl-bucket-perms

Conversation

@masl2

@masl2 masl2 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

Use new TF variables identifying associated DL account and environment to grant appropriate bucket permissions for the getLetterData function

Context

GetLetterData is a supplier api function to allow suppliers to retrived PDFs for printing. This lambda's prinicpal requires permissions for the storage location of the PDFs such that when it generates a pre-signed URL, said URL has the appropriate bucket permissions

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

DT3-Specific Checklist

  • If I have added a new resource (SQS, Lambda, Gateway, DDB table, etc), I have created the appropriate alarms

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@masl2
masl2 requested a review from a team as a code owner September 3, 2026 13:17
@masl2 masl2 changed the title add DL variable feed for pdf perms CCM-23434: Add DL getLetterData permissions Sep 3, 2026
stevebux
stevebux previously approved these changes Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The getLetterData Lambda policy adds access to a new S3 bucket but is missing the corresponding KMS permissions needed for SSE-KMS encrypted objects in the Digital Letters bucket.

Pull request overview

This PR updates the Supplier API Terraform component to grant the getLetterData Lambda access to the Digital Letters PDF storage bucket, using new variables to identify the Digital Letters AWS account and environment.

Changes:

  • Add Terraform inputs for digital_letters_account_id and digital_letters_environment.
  • Extend the getLetterData Lambda IAM policy to include S3 access to the Digital Letters PDF bucket ARN (and object ARNs).
  • Add locals for the Digital Letters bucket ARN and KMS key alias naming.
File summaries
File Description
infrastructure/terraform/components/api/variables.tf Adds new input variables for Digital Letters account/environment.
infrastructure/terraform/components/api/README.md Updates Terraform-docs inputs list to include the new variables.
infrastructure/terraform/components/api/module_lambda_get_letter_data.tf Extends IAM policy S3 permissions for getLetterData to cover the Digital Letters bucket.
infrastructure/terraform/components/api/locals.tf Defines Digital Letters bucket ARN and KMS alias locals for use in policy/resources.
Review details

Suppressed comments (1)

infrastructure/terraform/components/api/module_lambda_get_letter_data.tf:94

  • Digital Letters S3 bucket access is being added to the IAM policy, but there is no corresponding KMS permission statement for the Digital Letters SSE-KMS key. If the DL bucket is encrypted with its KMS key (as implied by the new digital_letters_s3_kms_key_alias_name local), the presigned GET will fail with KMS access denied even though S3 permissions are granted.
      "${local.digital_letters_pdf_bucket_arn}/*",
    ]
  }

  statement {
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is a focused IAM policy update to support Digital Letters S3/KMS access, with only a minor non-blocking comment noted about an inline comment’s accuracy.

Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@masl2
masl2 merged commit 15b1486 into main Sep 4, 2026
61 of 65 checks passed
@masl2
masl2 deleted the fix/CCM-23434_dl-bucket-perms branch September 4, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants