Skip to content

fix(scripts): harden citation.py #430

Closed

Description

@uniqueg

scripts/citation.py (setting and checking the release in CITATION.cff) has a few weak spots, found by Sourcery in the copy of proTES (elixir-cloud-aai/protes#244) and shared by this repository's copy:

  • set writes through a fixed temporary file (.CITATION.cff.tmp) next to the file. A file or symbolic link planted under that name is written to, concurrent runs share it, and the new file gets the default permissions instead of those of the old one.
  • check does not check that the version is a release version (X.Y.Z, X.Y.ZaN, X.Y.ZbN, X.Y.ZrcN) if the file has the same, invalid one.
  • set --date accepts dates after today (UTC), which check then rejects.
  • The docstrings do not describe these limits.

Port the fix of proTES, with tests, so that the copies stay consistent:

  • Write through a temporary file with a new, unpredictable name (tempfile.mkstemp) in the same directory, keeping the file's permissions.
  • Check the version in check, also if the file has the same one.
  • Refuse set --date with a date after today (UTC).
  • Update the docstrings accordingly.

Activity

  1. added
    priority: low
    status: in progress
    type: security
    workload: hours
    on Oct 23, 2026
  2. uniqueg commented on Oct 23, 2026

    @uniqueg
    MemberAuthor

    Done in #431.

  3. removed
    status: in progress
    on Oct 23, 2026
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

    priority: lowtype: securityworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions