Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Budowanie i kod

security-patch-workflow

/security-patch-workflow

Opisuje, jak tworzyć, stosować i weryfikować łatki bezpieczeństwa w repozytoriach git oraz sprawdzać, czy łatki rzeczywiście usuwają podatności.

Licencja
MIT
Ostatnia zmiana repozytorium
02.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 02.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Opisuje, jak tworzyć, stosować i weryfikować łatki bezpieczeństwa w repozytoriach git oraz sprawdzać, czy łatki rzeczywiście usuwają podatności.

Oryginalny opis (EN)

How to create, apply, and verify security patches for git repositories. Use this skill when creating patches from code changes, applying patches to source code, or validating that patches correctly address vulnerabilities.

Jak działa

  1. Overview
  2. Creating Patches
  3. Understanding Patch File Format
  4. Applying Patches
  5. Verifying Patch Application
  6. Handling Patch Conflicts
  7. Patch Best Practices
  8. Creating a Patch Series
  9. Validating Patch Content
Sekcje z nagłówków SKILL.md, w oryginale · 179 linii, 577 słów
Podgląd SKILL.md
---
name: security-patch-workflow
description: How to create, apply, and verify security patches for git repositories. Use this skill when creating patches from code changes, applying patches to source code, or validating that patches correctly address vulnerabilities.
---

# Security Patch Workflow

## Overview

Security patches are created as unified diff files that can be transported and applied to source code repositories. This workflow covers creating patches from changes and applying them to Druid or other git repositories.

## Creating Patches

### Method 1: Creating Patch from Uncommitted Changes

If you've edited files directly:

```bash
cd /root/druid
git diff > /root/patches/fix-vulnerability.patch
```

### Method 2: Creating Patch from Committed Changes

If changes are already committed:

```bash
cd /root/druid
git format-patch -1 HEAD -o /root/patches/
```

This creates a patch file named like `0001-fix-vulnerability.patch`

### Method 3: Creating Patch from Multiple Commits

```bash
cd /root/druid
git format-patch HEAD~3..HEAD -o /root/patches/
```

Creates patches for the last 3 commits.

## Understanding Patch File Format

A unified diff patch file contains:
- File paths with `a/` and `b/` prefixes
- Hunk headers showing line numbers
- Lines prefixed with `-` (removed), `+` (added), or ` ` (context)

Example:
```diff
--- a/src/main/java/org/apache/druid/query/filter/JavaScriptFilter.java
+++ b/src/main/java/org/apache/druid/query/filter/JavaScriptFilter.java
@@ -45,6 +45,12 @@
     public void init() {
         // initialization code
+        // Add validation for filter specification
+        if (filterSpec.containsKey("")) {
+            throw new IllegalArgumentException(
+                "Invalid filter specification: contains empty keys");
+        }
     }
```

## Applying Patches

### Method 1: Using `git apply`

Non-interactive application, good for automation:

```bash
cd /root/druid
git apply /root/patches/fix-vulnerability.patch
```

### Method 2: Using `git am` (Recommended for Commits)

If the patch was created with `git format-patch`:

```bash
cd /root/druid
git am /root/patches/0001-fix-vulnerability.patch
```

### Method 3: Using `patch` Command

Direct application with the `patch` utility:

```bash
cd /root/druid
patch -p1 < /root/patches/fix-vulnerability.patch
```

## Verifying Patch Application

After applying a patch, verify:

### 1. Check Git Status
```bash
cd /root/druid
git status
```

You should see modified files (if using `git apply`) or new commits (if using `git am`).

### 2. Review Changed Files
```bash
cd /root/druid
git diff HEAD~1..HEAD  # if patch was committed
# or
git diff              # if patch was applied but not committed
```

### 3. Verify Specific Fixes
Look for:
- Expected files were modified
- Validation logic was added
- Security checks are in place
- No unintended changes

## Handling Patch Conflicts

If a patch doesn't apply cleanly:

```bash
cd /root/druid
git apply --reject /root/patches/fix-vulnerability.patch
```

This creates `.rej` files showing conflicts. Manually merge them:

```bash
# View the .rej files
find . -name "*.rej" -exec cat {} \;

# Manually fix the conflicts in the source files
# Then remove the .rej files
find . -name "*.rej" -delete

# Apply remaining patches
git add .
git commit -m "Apply security patch (manual resolution)"
```

## Patch Best Practices

1. **Minimal changes:** Patches should contain only the necessary fixes
2. **Clear context:** Include sufficient context lines for reliable application
3. **No unrelated changes:** Don't mix security fixes with refactoring
4. **Test before patching:** Verify the original code builds and runs
5. **Test after patching:** Verify the patched code builds and runs correctly
6. **Document the patch:** Include a description of the vulnerability and fix

## Creating a Patch Series

For multiple related patches:

```bash
# Create numbered patches
git format-patch -3 -o /root/patches/

# List them
ls /root/patches/*.patch

# Apply all in order
cd /root/druid
git am /root/patches/*.patch
```

## Validating Patch Content

Before applying, review the patch to ensure it's legitimate:

```bash
cat /root/patches/fix-vulnerability.patch | head -50
```

Check for:
- Appropriate file modifications
- No suspicious code patterns
- Clear change descriptions
- Expected syntax and structure

Wersje

W bazie nie ma innych skilli o nazwie security-patch-workflow.

Migawka bazy z 28.10.2026 · wersja paczki b338983d0759 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90evo-patch-generate-apply
    Generuje łatki w formacie unified diff z oryginalnej i zmodyfikowanej treści plików, zapisuje je do numerowanych plików i stosuje w repozytorium przez git apply lub GNU patch.
  • 100patch-creation
    Tworzy i rejestruje nowe łatki w tweakcc, przy dodawaniu własnych dostosowań do Claude Code.
  • 100threat-patch
    Naprawia ustalenia bezpieczeństwa minimalnymi, precyzyjnymi poprawkami kodu na podstawie findings.json, THREAT-MODEL.md, raportu CSV skanera lub opisów podatności.
  • 95patch
    Przygotowuje kandydatów na poprawki zweryfikowanych luk bezpieczeństwa jako pliki diff do przeglądu przez człowieka.
  • 100patch-anatomy
    Wyjaśnia, jak pisać łatki do Morphe: DSL bytecodePatch, zgodność, rozszerzenia, opcje i finalizacja, przy tworzeniu nowych łatek lub poznawaniu ich struktury.
  • 90claude-security
    Skanuje bazę kodu lub zmiany (diff gałęzi, pull requesta albo commitu) narzędziem Claude Security i proponuje poprawki w postaci celowanych plików patch weryfikowanych przez panel agentów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.