Skip to content

pipeline: streaming security group and EFA placement group are created in the Lambda's region, not the stages' region #929

Closed

Description

@scttfrdmn

Found while fixing #912. Found by reading the code; not reproduced against AWS.

In lambda/pipeline-orchestrator/main.go, createStreamingSecurityGroup and createPlacementGroup build their EC2 client with ec2.NewFromConfig(awsCfg), the Lambda's own region (us-east-1 when deployed). launchStageInstance then passes state.SecurityGroupID in SecurityGroupIds and state.PlacementGroupID in Placement.GroupName to a RunInstances call made in the stage's region (stageDef.Region).

Security groups and placement groups are regional. For a pipeline with streaming or EFA stages whose region is anything but the Lambda's region, every launch in that stage should fail (InvalidGroup.NotFound / InvalidPlacementGroup.Unknown), and the stage is marked failed at launch. A pipeline whose stages span regions cannot get one group that works for all of them.

The cleanup (cleanupNetworkResources) deletes the groups in the Lambda's region too, so it is at least consistent with where they were created.

Also: the security group opens tcp/22 to 0.0.0.0/0. Stage instances are launched with no KeyName, so it is not obviously exploitable, but nothing in the pipeline uses SSH.

Suggested: create one group per stage region (keyed by region in PipelineState), or reject streaming/EFA pipelines whose stages are not all in one region until that exists. Drop the SSH rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions