Skip to content

Safe-settings app wants to rename all repositories for no reason #944

@John15321

Description

@John15321

Problem Description

What is actually happening

When Safe-Settings processes repository settings, the repository.name field incorrectly appears in dry-run diffs even though it's not configured in settings.yml.

(No other configuration at all, its a fresh install of safe-settings and our first usage in this org)

repository:
  # Common defaults; adjust if your org differs
  allow_merge_commit: true
  allow_squash_merge: true
  allow_rebase_merge: true

In concurrent processing scenarios (multiple repos via Promise.all), the wrong repo name can leak into other repos' diffs due to a race condition.

Root cause: In settings.js lines (https://github.com/github/safe-settings/pull/806/changes#diff-cb055c8e3497e3772fc444a77c4aed8483453e7580ffe7ddb223bdffaff43c57L299), Object.assign(repoConfig, {...}) mutates the shared this.config.repository object instead of creating a new object. When multiple repos are processed concurrently:

  1. updateRepos(repoA) sets this.config.repository.name = "repoA" then yields at an await
  2. updateRepos(repoB) sets this.config.repository.name = "repoB" then yields
  3. updateRepos(repoA) resumes but now sees name: "repoB" in its repoConfig

Additionally, name is not in ignorableFields in repository.js, so it always appears in diffs even though Safe-Settings injects it internally.

What is the expected behavior

  1. repository.name should NOT appear in dry-run diffs unless the user explicitly configures it for renaming
  2. Each repo's config should be isolated - processing repo A should never affect repo B's settings

Error output, if available

🤖 Safe-Settings config changes detected:
Msg  Plugin      Repo        Additions  Deletions  Modifications
✋   Repository  "fleetlock" {}         {}         {
  "allow_squash_merge": true,
  "name": "safe-settings-admin",   <-- WRONG: there should be nothing like this at all
  "allow_rebase_merge": true
}

With workaround (restrictedRepos.exclude: [safe-settings-admin]), the race condition is avoided but name still appears:

  "name": "fleetlock",   <-- Correct repo but shouldn't appear at all

Context

Are you using the hosted instance of probot/settings or running your own?

Running our own instance via container image ghcr.io/github/safe-settings:2.1.18

If running your own instance, are you using it with github.com or GitHub Enterprise?

https://github.com/flatcar

Version of probot/settings

safe-settings 2.1.18


Suggested Fix

#943

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions