Skip to content

Restrict submissions to S3 role permissions - #2324

Merged
theseanything merged 1 commit into
mainfrom
restrict-submissions-to-s3-role
Oct 16, 2026
Merged

theseanything merged 1 commit into
mainfrom
restrict-submissions-to-s3-role

Conversation

@theseanything

@theseanything theseanything commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

The runner assumes the govuk-forms-submissions-to-s3-<env> role to deliver submissions to a department's S3 bucket. The role's policy allowed s3:* on every bucket, but the runner only uses it for two calls in S3SubmissionService:

  • put_object writes the submission CSV or JSON to the department's bucket
  • copy_object copies uploaded files from our file upload bucket into the department's bucket

This change replaces the wildcard with s3:PutObject on any object, and s3:GetObject on objects in our file upload bucket only. Deleting uploaded files afterwards uses the runner task role, so this role doesn't need delete permissions.

PutObject still has to apply to every bucket because departments choose the destination bucket. Their bucket policy grants us only s3:PutObject, as described in the wiki guide on setting up S3 submissions.

Tested this in dev - and the file upload and submission to S3 still work.

The runner assumes this role only to put submission files into a
department's bucket and to copy uploaded files there from our file
upload bucket. It does not need any other S3 actions. Deleting uploaded
files afterwards uses the runner task role, not this one.

Departments choose the destination bucket and grant us s3:PutObject in
their bucket policy, so PutObject has to stay open to every bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@theseanything
theseanything marked this pull request as ready for review October 16, 2026 11:25
Copilot AI balanced review requested due to automatic review settings October 16, 2026 11:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The permissions match the described delivery operations, with no unresolved findings.

0 open findings

What changed in this PR

Narrows the runner’s S3 submission role permissions to the operations needed for delivery.

Changes:

  • Replaces s3:* with s3:PutObject for department-selected destinations.
  • Limits s3:GetObject to the file upload bucket for copying uploaded files.
File Description
infra/​modules/​forms-runner/​submissions-to-s3.tf Restricts the submission role’s S3 actions and read scope.

🧠 Review effort: Balanced


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

@theseanything
theseanything added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit 951687f Oct 16, 2026
20 checks passed
@theseanything
theseanything deleted the restrict-submissions-to-s3-role branch October 16, 2026 11:50
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.

3 participants