Skip to content

fix(security): 2 improvements across 2 files#807

Open
tomaioo wants to merge 2 commits into
AdguardTeam:mainfrom
tomaioo:fix/security/path-traversal-arbitrary-file-write-via-
Open

fix(security): 2 improvements across 2 files#807
tomaioo wants to merge 2 commits into
AdguardTeam:mainfrom
tomaioo:fix/security/path-traversal-arbitrary-file-write-via-

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented Apr 17, 2026

Summary

fix(security): 2 improvements across 2 files

Problem

Severity: High | File: scripts/services/restore-removed-services.js:L26

When restoring removed services, the output file path is built using removedObject.id directly. Because serviceSchema only enforces id as a string (no path-safe pattern), an id like ../../.github/workflows/pwn could cause writes outside sourceDirPath during build execution.

Solution

Validate removedObject.id against a strict allowlist regex (e.g. ^[a-z0-9_-]+$), build paths with path.resolve(sourceDirPath, ...), and enforce that the resolved path starts with the resolved sourceDirPath before writing.

Changes

  • scripts/services/restore-removed-services.js (modified)
  • scripts/services/merge-services-data.js (modified)

tomaioo added 2 commits April 17, 2026 11:15
- Security: Path traversal/arbitrary file write via unsanitized service ID
- Security: Prototype pollution risk in service merge logic

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
- Security: Path traversal/arbitrary file write via unsanitized service ID
- Security: Prototype pollution risk in service merge logic

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
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