moby / moby/swarmkit

Can removal of secrets be prevented when referenced in a Service's PreviousSpec?

Open
#2,509 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/security kind/feature
Dominant language
Go
Stars
3.7k
Forks
676
Avg merge
4d 9h
Merged PRs (30d)
6

Description

Currently, the RemoveSecret function will error out when a secret is being referenced by a service's Spec. This is super-useful!

However, the same is not true when secrets are referenced by a service's PreviousSpec. From what I can tell this can be implemented by modifying serviceIndexerBySecret.FromObject to consider s.PreviousSpec.Task.GetContainer() as well. This could help prevent removed secrets from causing a service rollback to fail.

Could this behaviour be considered? Not sure if there's a way to opt-in, since it'd be a change in the current behaviour...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read manager/controlapi/secret.go around RemoveSecret and manager/state/store/services.go around serviceIndexerBySecret.FromObject. Trace how references in a service's Spec are detected, then evaluate including PreviousSpec.Task.GetContainer(). Done means the intended behavior for removing secrets referenced by PreviousSpec is defined and covered by the relevant service or secret-removal checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.