Skip to content

fix(examples): require environment variable for shared secret to prevent hardcoded credentials - #67

Open
magqqgq wants to merge 1 commit into
deso-protocol:mainfrom
magqqgq:magqqgq-patch-1
Open

fix(examples): require environment variable for shared secret to prevent hardcoded credentials#67
magqqgq wants to merge 1 commit into
deso-protocol:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Aug 29, 2026

Copy link
Copy Markdown

Description

This PR addresses a high-severity secrets and configuration management vulnerability within the examples repository[cite: 30]. It removes a hardcoded shared secret from the message encryption example to prevent the unnecessary disclosure and accidental reuse of sensitive cryptographic material[cite: 30].

Key Changes

  • Secrets Management (examples/identity/messages-shared-secret/index.js):
    • Replaced the previously committed static shared secret with a runtime environment variable lookup (process.env.DESO_SHARED_SECRET)[cite: 30, 40].
    • Implemented a fail-fast validation check that explicitly throws an error ("Set DESO_SHARED_SECRET before running this example.") if the developer attempts to execute the script without providing the necessary environment variable[cite: 40].

Validation & Testing

  • Static Verification: JavaScript syntax validation (node --check) passed successfully for the modified example file, confirming the code parses correctly without execution[cite: 30].
  • Reviewer Action Required: Any historically exposed shared secrets within the Git repository history should be considered compromised and must be rotated by their owner[cite: 30]. Developers utilizing this example must now securely supply a valid DESO_SHARED_SECRET in their local environment prior to execution[cite: 40].

…ent hardcoded credentials

### Description
This PR addresses a high-severity secrets and configuration management vulnerability within the `examples` repository[cite: 30]. It removes a hardcoded shared secret from the message encryption example to prevent the unnecessary disclosure and accidental reuse of sensitive cryptographic material[cite: 30].

### Key Changes
* **Secrets Management (`examples/identity/messages-shared-secret/index.js`):**
  - Replaced the previously committed static shared secret with a runtime environment variable lookup (`process.env.DESO_SHARED_SECRET`)[cite: 30, 40].
  - Implemented a fail-fast validation check that explicitly throws an error (`"Set DESO_SHARED_SECRET before running this example."`) if the developer attempts to execute the script without providing the necessary environment variable[cite: 40].

### Validation & Testing
* **Static Verification:** JavaScript syntax validation (`node --check`) passed successfully for the modified example file, confirming the code parses correctly without execution[cite: 30].
* **Reviewer Action Required:** Any historically exposed shared secrets within the Git repository history should be considered compromised and must be rotated by their owner[cite: 30]. Developers utilizing this example must now securely supply a valid `DESO_SHARED_SECRET` in their local environment prior to execution[cite: 40].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant