Harden agent SVG rendering, secret storage, and provider probes#311
Open
snowopsdev wants to merge 5 commits intoOpenCoworkAI:mainfrom
Open
Harden agent SVG rendering, secret storage, and provider probes#311snowopsdev wants to merge 5 commits intoOpenCoworkAI:mainfrom
snowopsdev wants to merge 5 commits intoOpenCoworkAI:mainfrom
Conversation
539e275 to
361dbb0
Compare
361dbb0 to
d65f359
Compare
Author
|
Addressed the CodeQL review comments on Validation after the change:
|
3fd4d44 to
498b983
Compare
498b983 to
3f7e1aa
Compare
Contributor
There was a problem hiding this comment.
Review mode: initial
Findings
- [Minor] Missing changeset for user-visible changes — The PR restores
safeStorageencryption for secrets, adds a newallowPrivateNetworkcheckbox in the custom provider modal, and modifies agent SVG rendering behavior. These are user-facing behavioral changes that should be accompanied by a changeset entry (pnpm changeset) to appear in the changelog. Without it, the changelog will miss the update.
Suggested next action: Runpnpm changesetand commit the generated file. Use apatchbump with a summary of the three hardening changes.
Questions (none)
Summary
- The PR addresses three separate security hardening concerns: sanitizing agent-supplied SVG before rendering in the privileged UI, restoring OS-backed encryption for new secrets (with migration for existing plaintext rows), and blocking private/LAN/metadata provider probes unless explicitly opted in via a new
allowPrivateNetworkflag. - The implementation is well-structured, with clear separation of concerns across
AskModal.tsx(SVG sanitization),keychain.ts(secret encryption), andconnection-ipc.ts(network target classification). - All three areas include new Vitest test coverage, and the existing test suites pass (as stated in the PR body).
- The CI workflow is also fixed to ensure the Electron binary is downloaded and installed, addressing a prior silent failure.
- The only actionable issue is the missing changeset. Once a changeset is added, this PR is ready to merge.
Testing
- New unit tests added for
sanitizeInlineSvg,classifyNetworkTarget,encryptSecret, andmigrateSecrets(with coverage for both encryption-available and encryption-unavailable paths). - Existing tests pass; the PR body notes two pre-existing test failures unrelated to these changes.
- No E2E tests added, but the scope (security hardening of existing paths) is adequately covered by unit tests.
Open-CoDesign Bot
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.
Summary
svg-optionsbefore rendering in the privileged desktop UI while keeping the existing wire shape.safeStorageencryption for newly saved secrets, with readable migration support for existingplain:rows and legacy safeStorage/base64 rows.Security Impact
plain:rows. After: OS-backedsafe:rows are written whensafeStorageencryption is available, and older readable rows migrate forward on boot.allowPrivateNetworksignal surfaced through the UI.Compatibility Notes
svg-optionskeeps its existing API shape.safe:rows, existingplain:rows, and legacy safeStorage/base64 rows. If OS encryption is unavailable, existing credentials are preserved and plaintext fallback writes log a warning.Test Plan
corepack pnpm --filter @open-codesign/desktop exec vitest run src/renderer/src/components/AskModal.test.ts src/main/keychain.test.ts src/main/connection-ipc.test.ts src/main/diagnostics-ipc.test.ts src/renderer/src/components/AddCustomProviderModal.test.tsx(161 passed)corepack pnpm --filter @open-codesign/desktop typecheckcorepack pnpm lintcorepack pnpm audit --prod --audit-level moderate(No known vulnerabilities found)corepack pnpm --filter @open-codesign/desktop buildgit diff --checkcorepack pnpm --filter @open-codesign/desktop testcurrently reports 1270/1272 passing with two failures outside this change set: anatimeMsstat equality assertion insrc/main/design-workspace.test.ts, and a Puppeteer browser launch failure insrc/main/preview-runtime.test.ts.corepack pnpm typecheckfails before TypeScript under Turbo withUnable to find package manager binary: cannot find binary path; package-level desktop typecheck passes.Manual Security Review
rg -n "dangerouslySetInnerHTML|innerHTML|outerHTML|insertAdjacentHTML|new Function|eval\(" apps packages --glob "!**/vendor/**". The remaining active renderer sink for agent SVG is now sanitized; other matches are tests, static packaged example thumbnails, sandbox/runtime execution paths, DOM capture snippets, or exporter-owned rendering.safe:whensafeStorage.isEncryptionAvailable()is true;plain:is fallback/legacy only.ciphertextas sensitive regardless of whether the stored row issafe:, legacy safeStorage, or fallbackplain:.PR Hygiene
security/harden-agent-svg-secrets-probesfix: sanitize agent svg options before renderingfix: restore encrypted secret storage migrationfix: guard private network provider probestest: cover security hardening pathsgit diff --statandgit diff --check. No generated diagnostic bundles or real secrets are included.