Skip to content

Code Scanning fixed#1

Open
ElfredSeow wants to merge 1 commit into
mainfrom
Code-Scanning-Completed
Open

Code Scanning fixed#1
ElfredSeow wants to merge 1 commit into
mainfrom
Code-Scanning-Completed

Conversation

@ElfredSeow

Copy link
Copy Markdown
Collaborator

Description

Related Issue

Fixes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Security improvement
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Reliability Regression Policy

  • This PR fixes a production failure/incident.
  • If checked above, I added or updated at least one eval case file under scripts/qa/eval-cases/.
  • Eval case file path(s):
    • scripts/qa/eval-cases/...

Category

  • Security / Guardrails
  • Messaging Channels (WhatsApp, Telegram, Discord, Slack, Teams, Google Chat, iMessage, Signal, Matrix, etc.)
  • LLM Providers
  • Agent Capabilities / Tools
  • Cloud Storage (Google Workspace, OneDrive, Dropbox, Box, SharePoint, Notion)
  • UI / UX
  • MCP Integration
  • Remote Access (Tailscale, SSH, WebSocket API)
  • Database / IPC
  • Other

Changes Made

Security Considerations

  • This change has NO security implications
  • This change has been reviewed for security implications (describe below)

Screenshots

Testing

  • Tested locally on macOS
  • Tested with at least one LLM provider (Anthropic/Bedrock/Gemini/OpenRouter/OpenAI/Ollama)
  • Tested messaging channel integration (if applicable)
  • Tested MCP functionality (if applicable)
  • Verified no console errors
  • Security tests pass (if applicable)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I updated docs/architecture.md if this PR changes capabilities, defaults, or architecture
  • My changes generate no new warnings
  • I have considered security implications of my changes
  • Any dependent changes have been merged and published

Additional Notes

bestCandidateLength: bestCandidate.length,
bestCandidateHash: createHash("sha1").update(bestCandidate).digest("hex").slice(0, 12),
// ponytail: non-security fingerprint for diagnostics, not a password; sha256 to silence weak-algo scan
bestCandidateHash: createHash("sha256").update(bestCandidate).digest("hex").slice(0, 12),
Comment on lines +518 to +522
targetHtml = targetHtml
.replace(
/<(script|style|noscript|nav|footer|header|aside|svg)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,
"",
)
.replace(/<style[\s\S]*?<\/style>/gi, " ")
.replace(/<script[\s\S]*?<\/script>/gi, " ")
.replace(/<style\b[\s\S]*?<\/style\s*>/gi, " ")
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, " ")
.replace(/<style[\s\S]*?<\/style>/gi, " ")
.replace(/<script[\s\S]*?<\/script>/gi, " ")
.replace(/<style\b[\s\S]*?<\/style\s*>/gi, " ")
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, " ")
Comment on lines +175 to +178
const escaped = String(inner)
.replace(/\\'/g, "'") // \' is a literal ' inside the single-quoted source; invalid in JSON
.replace(/\\"/g, '"')
.replace(/"/g, '\\"');
return htmlContent
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, " ")
.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, " ")
.replace(/<script\b[^<]*(?:(?!<\/script\s*>)<[^<]*)*<\/script\s*>/gi, " ")
Comment on lines +34 to +38
html = html
// Remove executable and embeddable content.
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, "")
.replace(/<script\b[^>]*>/gi, "")
.replace(/<(iframe|object|embed)\b[\s\S]*?<\/\1\s*>/gi, "")
Comment on lines +34 to +37
html = html
// Remove executable and embeddable content.
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, "")
.replace(/<script\b[^>]*>/gi, "")
Comment on lines +34 to +36
html = html
// Remove executable and embeddable content.
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, "")
previous = html;
html = html
// Remove executable and embeddable content.
.replace(/<script\b[\s\S]*?<\/script\s*>/gi, "")
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.

2 participants