forked from NVIDIA/NemoClaw
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: 🧹 Remove unused apiKey placeholder #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,9 @@ | ||
| ## 🎯 What | ||
| 🎯 **What:** Removed the dead code `apiKey: "unused"` placeholder from the configuration generation script `scripts/generate-openclaw-config.py`, and removed all corresponding runtime and test assertions expecting this placeholder across `src/lib/onboard.ts`, `test/e2e/test-messaging-compatible-endpoint.sh`, `test/generate-openclaw-config.test.ts`, and `test/onboard.test.ts`. | ||
|
|
||
| The `hashCredential` function previously used an unsalted SHA-256 algorithm to hash credentials, which is insecure and vulnerable to rainbow table attacks and brute-forcing. | ||
| 💡 **Why:** This `apiKey` variable was an artificial non-secret placeholder ("unused") that served no functional purpose at runtime. Removing it cleans up dead code, reduces cognitive load, and eliminates unnecessary assertions in the provider initialization logic and test suites, improving overall code health and maintainability. | ||
|
|
||
| ## ⚠️ Risk | ||
| ✅ **Verification:** Ran syntax validation on the modified bash script (`bash -n test/e2e/test-messaging-compatible-endpoint.sh`). Executed the unit test suite (`pnpm test --project cli test/generate-openclaw-config.test.ts test/onboard.test.ts`), and ensured repository-wide pre-commit hook checks (`npm run check`) successfully passed after discarding unrelated file changes. All functionality and tests behave as expected. | ||
|
|
||
| If an attacker gains access to the local sandbox state or the registry payload where these hashes are stored, they could rapidly compute plaintexts using hardware acceleration or pre-computed hash tables, compromising the messaging bridge tokens or router credentials. | ||
| ✨ **Result:** Improved maintainability by stripping out artificial dead code, simplifying the config generator, eliminating unnecessary config validation logic, and streamlining the dependent test suites. | ||
|
|
||
| ## 🛡️ Solution | ||
|
|
||
| - Migrated the hashing implementation to use Node.js's native `crypto.scryptSync` with a random 16-byte salt per hash. | ||
| - Implemented `verifyCredential` using `crypto.timingSafeEqual` to securely compare plaintexts against stored salted hashes. | ||
| - Retained a fallback in `verifyCredential` to support legacy, unsalted SHA-256 hashes for backwards compatibility with existing active deployments. | ||
| - Updated conflict detection logic to pass plaintexts safely for in-memory resolution where strict equality checks on hashes are mathematically impossible with distinct salts. | ||
|
|
||
| Signed-off-by: Jules <jules@nemo.claw> | ||
| Signed-off-by: Jules <jules@example.com> |
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.