-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat: encrypt the privacy data when it is persisted #6056
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
Conversation
* 对私密数据持久化时执行加密 * 将锁屏密码合并到accessStore中进行加密
|
WalkthroughThis update introduces a secure storage mechanism for persisting application state by integrating the SecureLS library. Environment variable Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LockScreenComponent
participant AccessStore
participant SecureLS
User->>LockScreenComponent: Submit password to lock
LockScreenComponent->>AccessStore: lockScreen(password)
AccessStore->>SecureLS: Persist isLockScreen, lockScreenPassword (encrypted)
User->>LockScreenComponent: Submit to unlock
LockScreenComponent->>AccessStore: unlockScreen()
AccessStore->>SecureLS: Update persisted state (clear lock info)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🔇 Additional comments (6)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (2)
playground/.env (1)
6-8
: (same asapps/web-antd/.env
: ensure the placeholder key is replaced with a secure value and document its usage in.env.example
and the README)apps/web-naive/.env (1)
6-8
: (same asapps/web-antd/.env
: ensure the placeholder key is replaced with a secure value and document its usage in.env.example
and the README)
🧹 Nitpick comments (2)
apps/web-antd/.env (1)
7-8
: Enforce secure key replacement and documentation.
The placeholderVITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key
must be replaced with a strong, unique key in each environment. Consider adding a.env.example
(without real secrets) and updating the README to explain how to set and rotate this key.packages/stores/src/modules/access.ts (1)
72-75
: Add password validation to lockScreen actionThe
lockScreen
action accepts any string as a password without validation.Consider adding basic password validation to ensure security:
lockScreen(password: string) { + if (!password || password.trim().length < 6) { + throw new Error('Lock screen password must be at least 6 characters'); + } this.isLockScreen = true; this.lockScreenPassword = password; },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
apps/web-antd/.env
(1 hunks)apps/web-ele/.env
(1 hunks)apps/web-naive/.env
(1 hunks)packages/effects/layouts/src/widgets/lock-screen/lock-screen.vue
(4 hunks)packages/stores/package.json
(1 hunks)packages/stores/src/modules/access.ts
(3 hunks)packages/stores/src/modules/index.ts
(0 hunks)packages/stores/src/modules/lock.test.ts
(0 hunks)packages/stores/src/modules/lock.ts
(0 hunks)packages/stores/src/setup.ts
(2 hunks)playground/.env
(1 hunks)pnpm-workspace.yaml
(1 hunks)
💤 Files with no reviewable changes (3)
- packages/stores/src/modules/index.ts
- packages/stores/src/modules/lock.test.ts
- packages/stores/src/modules/lock.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Lint (windows-latest)
- GitHub Check: Test (windows-latest)
🔇 Additional comments (6)
pnpm-workspace.yaml (1)
150-150
:✅ Verification successful
Verify the
secure-ls
version availability.
Ensure that the addedsecure-ls@^2.0.0
entry exists in the registry and is compatible with your workspace.
🏁 Script executed:
#!/bin/bash # Verify the published versions of secure-ls npm view secure-ls@^2.0.0 versionLength of output: 43
secure-ls@^2.0.0 is available
- pnpm-workspace.yaml (line 150):
secure-ls@^2.0.0
resolves to version 2.0.0 in the npm registry.No further action needed.
packages/stores/package.json (1)
28-28
: Confirm the workspace version specifier forsecure-ls
.
The"catalog:"
placeholder must resolve to the^2.0.0
version defined in yourpnpm-workspace.yaml
. Verify that installs will pull in the intended version.packages/effects/layouts/src/widgets/lock-screen/lock-screen.vue (1)
6-6
: Store migration implemented correctlyThe lock screen component has been properly updated to use
accessStore
instead of the removedlockStore
, maintaining the same functionality while consolidating related state management.Also applies to: 29-29, 38-38, 69-69
packages/stores/src/modules/access.ts (3)
30-37
: Lock screen interface additions look goodThe AccessState interface has been properly extended with the lock screen properties.
97-100
: Lock screen unlock action is correctThe
unlockScreen
action properly resets both the lock state and clears the password.
104-110
: Properly configured persistence for lock screen stateThe persistence configuration correctly includes the lock screen properties, and the state initialization provides appropriate default values.
Since you're storing sensitive information (password), it's good that you've implemented encryption for the persisted store data through SecureLS as seen in the
setup.ts
file.Also applies to: 118-119
* 对私密数据持久化时执行加密 * 将锁屏密码合并到accessStore中进行加密
Summary by CodeRabbit
New Features
Refactor
Chores