Просмотр исходного кода

fix(release): release and list security: commits, and document their format

- semantic-release: security: commits now trigger a patch release. They
  are not in the default rules, so a release containing only security
  fixes would not have been published.
- conventional-pre-commit: allow the security type, which the hook
  rejected.
- GoReleaser: drop GitHub's "Merge commit from fork" merges from the
  changelog; the security: commits inside them are already listed.
- SECURITY.md and AGENTS.md: document the security commit format and how
  advisory fork merges appear in history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 2 дней назад
Родитель
Сommit
df6a820033
5 измененных файлов с 26 добавлено и 3 удалено
  1. 1 0
      .goreleaser.yml
  2. 2 1
      .pre-commit-config.yaml
  3. 6 1
      .releaserc.yaml
  4. 9 0
      AGENTS.md
  5. 8 1
      SECURITY.md

+ 1 - 0
.goreleaser.yml

@@ -83,6 +83,7 @@ changelog:
       - '^release:'
       - '^refactor:'
       - '^Merge branch'
+      - '^Merge commit from fork'
 
 archives:
   - id: default

+ 2 - 1
.pre-commit-config.yaml

@@ -29,7 +29,8 @@ repos:
     hooks:
       - id: conventional-pre-commit
         stages: [commit-msg]
-        args: [] # optional: list of Conventional Commits types to allow e.g. [feat, fix, ci, chore, test]
+        # The hook's default types, plus security for security advisory fixes (see SECURITY.md).
+        args: [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test, security]
 
   - repo: local
     hooks:

+ 6 - 1
.releaserc.yaml

@@ -5,7 +5,12 @@ branches:
   - name: main
 
 plugins:
-  - '@semantic-release/commit-analyzer'
+  # security: commits are not in the default rules, so without this a release
+  # containing only security fixes would not be published.
+  - - '@semantic-release/commit-analyzer'
+    - releaseRules:
+        - type: security
+          release: patch
   # Only a draft is created here; GoReleaser adopts it (release.use_existing_draft),
   # replaces the notes and publishes it. This plugin's job is the success comments on
   # resolved issues/PRs, and opening an issue when a release fails.

+ 9 - 0
AGENTS.md

@@ -92,6 +92,15 @@ When a change means operators may need to do something when they upgrade (a brea
 - Do **not** mark the change with a `BREAKING CHANGE:` footer or a `!` in the commit type. semantic-release treats either as a major version bump.
 - docs.olivetin.app is built from `next`, so a note is public as soon as it merges. For security fixes the note goes in the private advisory fork PR, and should describe the behaviour change without exploit details.
 
+### Security Fixes
+Security advisory fixes follow the process in `SECURITY.md`:
+
+- Work in the advisory's private temporary fork (`OliveTin/OliveTin-ghsa-xxxx-xxxx-xxxx`), on a branch from its `next`, and open the PR against the fork's `next`. Never push fixes for unpublished advisories to the public repository, and never describe unfixed advisories in public files.
+- Commit subjects use `security: GHSA-xxxx-xxxx-xxxx (SEV) short description`, where `SEV` is `LOW`, `MED`, `HIGH` or `CRIT`. Do not name the reporter in commits; credit goes in the advisory.
+- Supporting commits in the same PR (for example docs or an upgrade note) use their normal type, and may mention the advisory ID.
+- `security:` commits trigger a patch release and are listed under **Security** in the release notes. Do not use `fix:` for advisory fixes, or they will be listed as bug fixes.
+- When an advisory is closed as not a vulnerability but still worth fixing, the fix is an ordinary public `fix:` commit against `next`, without the advisory ID.
+
 ### Branch Naming
 Use conventional-commit-style branch names with a type prefix, optional issue reference, and a short kebab-case description:
 

+ 8 - 1
SECURITY.md

@@ -126,4 +126,11 @@ Once a vulnerability is reported, the process is;
 * The severity of the vulnerability will be assessed using CVSS, and the patch will be prioritised accordingly.
 * Once the patch is ready, it will be queued for a release onto the `next` branch (3k).
 * The reporter will be credited in the advisory and the release notes, but not the commit message.
-* The commit message will contain a reference to the CVSS score (eg: MED) and the advisory ID.
+* Commits that fix the vulnerability use this format, with the severity (`LOW`, `MED`, `HIGH` or `CRIT`) and the advisory ID:
+
+  ```
+  security: GHSA-xxxx-xxxx-xxxx (MED) short description of the fix
+  ```
+
+  `security:` commits trigger a patch release, and are listed under **Security** in the release notes.
+* Merging the private advisory fork into `next` creates a merge commit titled "Merge commit from fork". This is GitHub's fixed message and is expected; the `security:` commits inside the merge are what appear in the release notes.