Repository navigation
refactor: call the access token hash secret a pepper, not a salt - #2159
Merged
Merged
Conversation
The value under ovsx.access-token.token-hash-salt has every property of a pepper and none of a salt: one value for the whole instance rather than one per token, secret, and deliberately kept out of the database alongside the hashes it protects. The name misleads in a way that matters. A reader looking for the per-token salt column will not find one, and, worse, may take the value for the non-secret a salt is and put it where a salt could legitimately go - a plain ConfigMap, or a committed application.yml. A salt would also have nothing to do here. Token values are 256 bits from a CSPRNG, so there is no dictionary to precompute against and no realistic chance of two hashing alike; the one thing this value buys is the pepper property, that a leaked personal_access_token.value column is useless without the configuration. The javadoc's own warning gives it away too - a changed value invalidating every existing token is pepper rotation, since a per-record salt stays with its row. Renamed now because the property has never shipped: it arrived in d5a01c8, one day after v1.1.2, so unlike ovsx.access-token.prefix it needs no fallback to an old key. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is a consistent rename across config/service/tests with no remaining references to the old key or getter found in the repository.
Pull request overview
Renames the access-token hash secret configuration from “salt” terminology to “pepper” to better reflect its instance-wide, secret, config-only role and reduce the risk of unsafe handling or misunderstanding.
Changes:
- Rename config key
ovsx.access-token.token-hash-salt→ovsx.access-token.token-hash-pepperand corresponding field/getter names. - Update
AccessTokenService.hashTokenValuecall site and clarify the inline comment. - Update tests and Javadoc to use “pepper” terminology and explain the security/rotation implications.
File summaries
| File | Description |
|---|---|
| server/src/main/java/org/eclipse/openvsx/accesstoken/AccessTokenConfig.java | Renames property/field/getter and updates Javadoc + validation message to “pepper”. |
| server/src/main/java/org/eclipse/openvsx/accesstoken/AccessTokenService.java | Switches the hash input from getTokenHashSalt() to getTokenHashPepper() and updates the comment. |
| server/src/test/java/org/eclipse/openvsx/accesstoken/AccessTokenServiceTest.java | Updates mocks and comments to reflect “pepper” terminology. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
cstamas
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ovsx.access-token.token-hash-salthas every property of a pepper and none of a salt:The name misleads in a way that matters. A reader looking for the per-token salt column will not find one, and — worse — may take the value for the non-secret a salt is and put it somewhere a salt could legitimately go, such as a plain ConfigMap or a committed
application.yml.A salt would also have nothing to do here. Token values are 256 bits from a CSPRNG (
AccessTokenService.java:67-83), so there is no dictionary to precompute against and no realistic chance of two hashing alike. The one thing this value buys is the pepper property: that a leakedpersonal_access_token.valuecolumn is useless without the configuration. The old javadoc gave it away too — a changed value invalidating every existing token is pepper rotation, since a per-record salt stays with its row.Changes
ovsx.access-token.token-hash-salt→ovsx.access-token.token-hash-peppertokenHashSalt→tokenHashPepper,getTokenHashSalt()→getTokenHashPepper(), and thevalidate()failure messageAccessTokenService.hashTokenValue, plus the mock stub and one comment inAccessTokenServiceTestNo behaviour change: the hash construction is untouched.
No back-compat alias needed
The property has never shipped. It arrived in d5a01c8 (Trusted Publishing, #2000) on 2026-08-21, one day after the v1.1.2 release —
git show v1.1.2:.../AccessTokenConfig.javahas no trace of it. So unlikeovsx.access-token.prefix, which carries a fallback to its oldovsx.token-prefixkey, this one needs none. Renaming after the next release would mean carrying that alias forever.Verification
compileJava compileTestJavaclean./gradlew test --tests '*AccessToken*'— 30 tests pass (AccessTokenServiceTest, plus theAdminAPITestandTrustedPublishingAPITestcases that exercise token creation and hashing end to end)spotlessCheckreports no violations in the three touched files (it fails overall on pre-existing formatting underjson/, untouched here)Follow-ups, not in this PR
H(token || pepper)rather thanHMAC(pepper, token). Not practically exploitable — the attacker controls no part of the input and length extension neither recovers the pepper nor forges a chosen token's hash — and changing it would break every stored hash, so it is deliberately left alone.🤖 Generated with Claude Code