Repository navigation
Conversation
…key, tied to that workspace
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Host-encrypter credential flow plugins/whatsapp/credentials.go, plugins/whatsapp/whatsapp.go, sdk/sdk.go |
The plugin receives an sdk.Encrypter and uses the access_token purpose to encrypt tokens before storage and decrypt them during credential lookup. |
Credential behavior and integration tests plugins/whatsapp/credentials_internal_test.go, plugins/whatsapp/events_test.go, plugins/whatsapp/export_test.go, plugins/whatsapp/fetcher_internal_test.go, plugins/whatsapp/send_test.go, cmd/alphone/whatsapptokens_feature_test.go, test/features/features/whatsapp-tokens.feature, Makefile |
Tests cover tenant-bound tokens, encryption and decryption errors, environment credentials, and WhatsApp token scenarios. The end-to-end server receives ALPHONE_ENCRYPTION_KEY. |
Legacy key removal and enforcement .env.example, .golangci.yml, plugins/whatsapp/e2e.env, plugins/whatsapp/whatsapp_internal_test.go, plugins/whatsapp/whatsapp_test.go, sdk/commands_test.go, docs/src/content/docs/self-hosting/configuration.md, docs/src/content/docs/self-hosting/updates-and-backups.md |
The plugin-specific key is removed from settings and documentation. A lint rule denies cipher-package imports in plugin and enterprise production Go files. The migration notes say tokens stored under the old key must be entered again. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant WhatsAppPlugin
participant sdkEncrypter
participant TenantScopedDatabase
WhatsAppPlugin->>sdkEncrypter: Encrypt token with access_token purpose
sdkEncrypter-->>WhatsAppPlugin: Return encrypted token
WhatsAppPlugin->>TenantScopedDatabase: Store encrypted token for tenant
WhatsAppPlugin->>TenantScopedDatabase: Read tenant token
TenantScopedDatabase-->>WhatsAppPlugin: Return encrypted token
WhatsAppPlugin->>sdkEncrypter: Decrypt token with access_token purpose
sdkEncrypter-->>WhatsAppPlugin: Return token or decryption error
Possibly related PRs
- gopherium/AlphOne#311: Adds the
sdk.Encryptercontract and host-side encryption wiring used by this plugin change. - gopherium/AlphOne#282: Updates the WhatsApp end-to-end configuration that this change also modifies.
Suggested reviewers: codescene-access
Merge Risk: 
Minimal · up to 082f9
-
No actionable merge-blocking issue is established from the supplied evidence. Normal build and test checks remain appropriate before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#312has coding requirements, and the pull request implements them.plugins/whatsapp/credentials.gouses the hostsdk.Encrypterwith theaccess_tokenpurpose for workspace token encryption and decryption. The tenant context is passed to the encrypter, which binds copied tokens to their workspace. The environment-file fallback remains for the default workspace. The feature scenarios verify workspace access, unreadable-at-rest storage, rejection of copied tokens, theALPHONE_ENCRYPTION_KEYerror, and the default-workspace fallback. The change removesALPHONE_WHATSAPP_CREDENTIALS_KEY, adds the plugin encryption depguard rule, and updates the documented migration and configuration text.
Full details: Out of Scope Changes check
-
Explanation
The changed files stay within issue
#312. The e2e encryption-key setting and feature harness support the required automated scenarios. Test updates replace the removed plugin-owned cipher setup. The lint configuration prevents the encryption implementation that issue#312replaces. Environment and documentation changes remove the old key and describe the new host-key behavior.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 30 functions across 11 files. (5 skipped: 5 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Code Review ✅ Approved🔴 High risk · Moving WhatsApp tokens to workspace-bound host encryption changes sensitive credential handling; legacy values no longer decrypt, potentially interrupting messaging until re-entered. Switches WhatsApp access token encryption to the host-provided encrypter, binding each token to its workspace and removing the plugin-specific VerificationRules No rules evaluated Functional validation Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
[High impact] No merge-blocking concerns remain in the validated token-storage and workspace-isolation behavior.
|
Closes #312.
What
ALPHONE_ENCRYPTION_KEYand ties the token to its workspace.ALPHONE_WHATSAPP_CREDENTIALS_KEYand the plugin's own cipher code are gone.ALPHONE_ENCRYPTION_KEY. The number in the environment file still serves the default workspace.Why
The old key belonged to WhatsApp alone, and a token copied into another workspace's row still opened there. One host key for every plugin secret binds each value to its workspace and is replaced the same way for all of them.
Testing Instructions
Run the testing toolchain.
Summary by CodeRabbit