Skip to content

Prevent default security groups from accessing registration DB#1718

Merged
jacobwinch merged 1 commit intomainfrom
jw-rds-sgs
Mar 5, 2026
Merged

Prevent default security groups from accessing registration DB#1718
jacobwinch merged 1 commit intomainfrom
jw-rds-sgs

Conversation

@jacobwinch
Copy link
Contributor

@jacobwinch jacobwinch commented Mar 4, 2026

What does this change?

There have been a few different networking approaches used to control access to the registration DB over the years:

  1. Initially all services could access the registration DB by joining the VPC's default security group (i.e. the default security group that AWS provides).
  2. More recently services were able to access the registration DB by joining a new security group (which was created by Guardian engineers in response to this issue). This allowed us to resolve a number of FSBP issues, but did not follow the principle of least privilege, as a number of services which didn't need DB access were also joining this group1.
  3. Today a service can access the registration DB (including via its proxy) if it joins a dedicated 'Postgres Access' security group (which was created in New security group for Postgres access to registration db #1636).

In #1636, #1705, #1707, #1708 and #1709 we updated all services which need DB access to start using the new approach (3). This means that we can now officially remove the AWS default security group (1) and the Guardian 'default' security group (2) from the ingress rules associated with the registration DB.

Once this PR is deployed (and the import here is removed), we should also be able to delete the Guardian 'default' security group (2) via https://github.com/guardian/mobile-platform/pull/727.

How has this change been tested / checked?

I've deployed this branch to CODE to check that the CFN change is valid.

I've also done some checking in the AWS console to confirm that this change will be safe. In the console we can see resources that are associated with a given security group. For the new 'Postgres Access' security groups (3), we can see the expected instances and Lambdas:

registrations-db-CODE-access
image

registrations-db-PROD-access
image

For the old security groups (1 and 2) we don't see any associated instances or Lambdas:

default (1):

image

Notifications VPC Main Security Group (CODE and PROD) (2):

image

How can we measure success?

This should improve our security posture but all functionality should keep working as before.

Have we considered potential risks?

There is a small risk that something is currently relying on one of the default security groups (1 or 2) in order to access the DB. I think the steps taken to check for usage via the console are sufficient to mitigate this risk.

Footnotes

  1. At one stage this also provided other functionality, such as the ability to access parameter store via an interface endpoint. This functionality is now available to any instance running in the private subnet, so services such as notification or report no longer need to join a special security group for this.

@jacobwinch jacobwinch added the maintenance Departmental tracking: maintenance work, not a fix or a feature label Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

@jacobwinch jacobwinch marked this pull request as ready for review March 4, 2026 14:28
@jacobwinch jacobwinch requested a review from a team as a code owner March 4, 2026 14:28
@jacobwinch
Copy link
Contributor Author

jacobwinch commented Mar 5, 2026

Notifications VPC Main Security Group (CODE and PROD)

A quick update on this one. There are now 0 related resources; yesterday there were still 2 ENIs that referred to a CODE Lambda (even though there were no Lambdas listed under related resources), so I guess that AWS has now tidied these up(?) 🎉

@jacobwinch jacobwinch merged commit dd5b844 into main Mar 5, 2026
10 checks passed
@jacobwinch jacobwinch deleted the jw-rds-sgs branch March 5, 2026 13:14
@jacobwinch
Copy link
Contributor Author

jacobwinch commented Mar 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants