Guidelines for Committing Code to DSpace GitHub

All of the below guidelines are just suggestions. They are not meant to create additional "red tape" during the normal development process. If you find they are getting in the way, let us know, we can always change them! Development processes and best practices change over time, and these guidelines should be no different.

General Guidelines for Committing

  1. Use GitHub Issues to track your changes
  2. Submit a Pull Request for your code changes
  3. Code approval processes
  4. Document your code early & often
  5. Once Approved, Merge your Pull Request in a timely manner

GitHub "Main Branch" Committing Rules

By "Main Branch" we are not only referring to DSpace/DSpace in GitHub. We're also referring to the Main branch of any other production-quality, out-of-the-box GitHub projects (e.g. DSpace/dspace-api-lang, etc.)

The GitHub Main branch is one of the few places that needs to remain well managed. As we all fork it and/or create Pull Requests from it, it can be detrimental to us all if incomplete or extremely buggy code is committed. Obviously, mistakes happen (and we've all made them), so don't worry if you accidentally commit/merge something you didn't mean to (just try to roll it back as soon as you notice it). Here are the few rules we try to follow when committing code to the Main branch:

  1. No broken builds on the Main Branch, ever.
  2. No unapproved / incomplete features on the Main Branch.
  3. All new features must have documentation before merging into the Main Branch.

Guidelines for Security Fixes

  1. Security vulnerabilities may be reported by users as detailed at DSpace Software Support Policy
    1. Once reported, further information may be gathered/discussed via email with the reporting user in order to verify the vulnerability
  2. If a vulnerability is verified, Committers should use GitHub Security Advisories to draft an advisory & begin collaborating on a fix.
    1. Original reporter may be invited to collaborate on that advisory, see Adding a collaborator to a security advisory
    2. (Recommended) A private temporary fork repository may be created to develop the fix.
      1. Note: These private forks will NOT trigger our normal GitHub Actions/CI (as this is not yet supported by GitHub).  So, Unit Test & Integration Test impact will have to be verified manually by reviewers (by running tests locally).
      2. To collaborate in the private fork, you will need to either: clone that private repository, or add it as a new remote.  The latter tends to be easier, and may be done as follows:

        # Add the private repo as a new remote
        git remote add DSpace-ghsa-[id] git@github.com:DSpace/DSpace-ghsa-[id].git
        # Pull down that repo
        git remote update
        # Checkout the branch you are collaborating on
        git checkout -b [local-branch-name] DSpace-ghsa-[id]/[remote-branch]


    3. Once the code is verified/approved, merge it.  NOTE: This applies the changes directly to GitHub main which will make them public. So you may want to wait until the release is almost ready to do this.
    4. Submit the draft advisory to GiHub to request a CVE.  The response should come back in a few hours or so, with an assigned CVE number (e.g. CVI-[year]-[num]). When assigned, a comment is added from "github-staff" with the details.
    5. When ready, publish the draft advisory.  NOTE: This makes everything public, which means it usually should occur around the time of the release which fixes this vulnerability.