Skip to content

feat: check ownership and permissions of gateway config drop-in directories #5704

Open

Description

@elezar

User Story

I run the OpenShell gateway from packages and operator-managed installs, where --config can point into a shared or writable directory. I need the gateway to refuse drop-in configs that another local user could have planted, so that a stray gateway.d/*.toml cannot silently change auth, TLS or driver settings.

Problem Statement

The gateway merges gateway.d/*.toml beside the base file without checking who owns the directory or the files, or who can write them. Neither the base file nor the drop-in configs have an ownership or permission check.

Impact / Why This Matters

In a shared writable directory, another local user could add gateway.d/00.toml and override auth, TLS or driver tables. The only mitigation today is to turn drop-in configs off with --config-dir "" or OPENSHELL_GATEWAY_CONFIG_DIR=. This needs an unusual layout, so it is hardening and not a defect.

Proposed Design

At startup and in config preflight, skip with a warning, or reject, a drop-in directory or file that is not owned by the gateway user or root, or that is group- or world-writable, similar to sshd StrictModes. Apply the same rule to the base file, and name the file and the reason.

Suggested UX (if applicable)

WARN ignoring /etc/openshell/gateway.d/00.toml: writable by group or others

Whether a violation warns or fails startup could be a setting.

Acceptance Criteria

  • A world- or group-writable drop-in config, or one owned by another user, is not merged silently.
  • config preflight reports the same finding as startup.
  • A ConfigMap-style symlinked drop-in config still works.
  • The behavior is documented in docs/how-it-works/gateways/configuration.mdx.

Alternatives Considered

Leave it to filesystem permissions and packaging, which is the status quo. Or require an explicit --config-dir for any overlay, which the compatibility review of #5489 suggested.

Activity

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

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