Skip to content

[Feature] add XML format support #2067

Open

Description

@blacksd

XML is still widely used for configuration in Java/JVM ecosystems. The company I work for uses it to define part of the configurations of such an application.

Currently, teams working with XML config files that contain secrets must either convert to a supported format before encrypting with SOPS, or fall back to BINARY mode which loses the structured diff and selective encryption benefits.

Proposal

Add an xml store alongside the existing json, yaml, ini, and dotenv stores. The implementation would:

  • Map XML elements to SOPS tree branches, attributes to @-prefixed keys, and text content to #text keys
  • Support repeated same-name elements as arrays
  • Preserve XML comments
  • Store sops metadata as a <sops> child element of the root (consistent with how other structured formats handle it)
  • Reject mixed content (interleaved text and child elements) with a clear error, as this pattern is more common in document markup (HTML, DocBook) rather than in configuration files
  • Use Go's standard encoding/xml for parsing/emission (no new dependencies)

I have a working implementation based on the existing store architecture (modeled after the INI store for metadata flattening and the JSON store for hierarchical tree construction). Happy to open a PR if there's interest.

Activity

  1. annis-souames commented on Mar 12, 2026

    @annis-souames

    Any plans to support this feature? I alsohve a dozen of XML configuration that needs to be partially encrypted: Only specific elements in the document tree should be encrypted.

  2. felixfontein commented on Mar 12, 2026

    @felixfontein
    Contributor

    Right now, there are no plans. I guess contributing this is possible, but I'm currently working on a bigger refactoring of the stores, if anyone wants to implement XML support I'd wait until that's done.

  3. blacksd commented on Mar 15, 2026

    @blacksd
    Author

    @felixfontein I'll wait on sending my PR then - not asking for any precise number, but as a ballpark estimate, shall the stores/ renovation be done in a quarter, two or EOY?

  4. felixfontein commented on Mar 15, 2026

    @felixfontein
    Contributor

    @blacksd I would hope for less than a quarter, but it depends a lot on how much time I and the reviewers have, so no promises :)

  5. kushal9897 commented on Apr 11, 2026

    @kushal9897
    Contributor

    Hi @felixfontein and @blacksd,

    I'm interested in contributing XML support after the stores refactoring.

    I also wanted to mention that I’d be happy to help with the refactoring effort as well, if that would be useful.

    A few questions from my side:

    Will the refactoring change the Store interface significantly?
    Should I wait for a specific PR/branch, or will it be announced here?
    Are there any design decisions I should keep in mind for XML support, such as namespaces, CDATA, or other edge cases?
    @blacksd, would you like to collaborate once the refactoring is done?

    Thanks!

  6. angyaljanos commented on Sep 18, 2026

    @angyaljanos

    Hey Guys!

    I recently faced this issue. After investigation.
    I would share my changes please review and comment it.

    PR

    Thanks,
    Janos

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions