Commit 4490700
[JENKINS-73851] Add SHA-256 HMAC webhook signature validation (#438)
* feat(JENKINS-73851): Add SHA-256 HMAC webhook signature validation
- Add SignatureAlgorithm enum with SHA-256 as default and SHA-1 for legacy support
- Extend GHWebhookSignature class to support SHA-256 HMAC computation
- Update HookSecretConfig to include configurable signature algorithm
- Modify RequirePostWithGHHookPayload.Processor to use configured algorithm
- Add comprehensive unit tests for SHA-256 functionality
- Maintain backwards compatibility with existing SHA-1 configurations
- Log deprecation warnings when SHA-1 is used
This implements GitHub's recommended SHA-256 HMAC signature validation
while maintaining backwards compatibility through configuration.
SHA-256 becomes the default for enhanced security.
Resolves: JENKINS-73851
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat(JENKINS-73851): Add UI for signature algorithm selection
- Add doFillSignatureAlgorithmItems() method to provide dropdown options
- Create signature algorithm selection dropdown in Jenkins configuration UI
- Add help documentation for signature algorithm selection
- Update HookSecretConfig constructor to parse algorithm from UI string input
- Add parseSignatureAlgorithm() method with case-insensitive parsing
- Update tests to work with new string-based constructor
- Add comprehensive test cases for algorithm parsing edge cases
Users can now choose between SHA-256 (Recommended) and SHA-1 (Legacy)
signature algorithms through the Jenkins UI in the GitHub plugin
configuration section.
The dropdown properly displays both options with SHA-256 set as default
for enhanced security, while SHA-1 remains available for legacy compatibility.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(JENKINS-73851): Fix checkstyle violations in SHA-256 implementation
- Remove trailing whitespace from all modified files
- Fix line length violations by properly wrapping long lines
- Fix operator wrap issues by placing operators on new lines
- Maintain consistent code formatting throughout
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* chore: Remove .vscode/settings.json and add to .gitignore
- Remove IDE-specific configuration file from version control
- Add .vscode/ directory to .gitignore to prevent future tracking
- Keep IDE configurations local to individual developer environments
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat(JENKINS-73851): Add system property override for default signature algorithm
- Add jenkins.github.webhook.signature.default system property
- Allows overriding default from SHA-256 to SHA-1 for CI compatibility
- Maintains SHA-256 as secure default when no property is set
- Dynamic evaluation prevents static initialization issues
- Added comprehensive test coverage and documentation
Usage:
- Default: SHA-256 (secure)
- CI override: -Djenkins.github.webhook.signature.default=SHA1
- Invalid values fallback to SHA-256
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(JENKINS-73851): Fix failing tests
---------
Co-authored-by: Jason Heithoff <[email protected]>
Co-authored-by: Claude <[email protected]>1 parent 0ffb13e commit 4490700
File tree
12 files changed
+535
-25
lines changed- src
- main
- java/org/jenkinsci/plugins/github
- config
- webhook
- resources/org/jenkinsci/plugins/github/config/HookSecretConfig
- test/java
- com/cloudbees/jenkins
- org/jenkinsci/plugins/github
- config
- webhook
12 files changed
+535
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
| |||
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
48 | 78 | | |
49 | 79 | | |
50 | 80 | | |
| |||
54 | 84 | | |
55 | 85 | | |
56 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
57 | 114 | | |
58 | 115 | | |
59 | 116 | | |
| |||
62 | 119 | | |
63 | 120 | | |
64 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
65 | 132 | | |
66 | 133 | | |
67 | 134 | | |
| |||
Lines changed: 58 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
53 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
54 | 78 | | |
55 | | - | |
56 | | - | |
| 79 | + | |
| 80 | + | |
57 | 81 | | |
58 | 82 | | |
59 | 83 | | |
60 | 84 | | |
61 | 85 | | |
62 | | - | |
| 86 | + | |
63 | 87 | | |
64 | 88 | | |
65 | 89 | | |
| |||
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| 95 | + | |
71 | 96 | | |
| 97 | + | |
72 | 98 | | |
73 | | - | |
74 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
75 | 127 | | |
76 | 128 | | |
77 | 129 | | |
78 | 130 | | |
79 | 131 | | |
| 132 | + | |
80 | 133 | | |
81 | 134 | | |
82 | 135 | | |
| |||
Lines changed: 68 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
64 | | - | |
| 62 | + | |
65 | 63 | | |
66 | 64 | | |
| 65 | + | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
| |||
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| 151 | + | |
| 152 | + | |
142 | 153 | | |
143 | 154 | | |
144 | 155 | | |
145 | 156 | | |
146 | 157 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
161 | 211 | | |
162 | 212 | | |
163 | 213 | | |
| |||
0 commit comments