Comparing dev...main · brightdata/sdk-js · GitHub
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: brightdata/sdk-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: brightdata/sdk-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Jul 30, 2026

  1. Merge pull request #31 from brightdata/dev

    feat: Crawler API, CLI-credential auth, and platform fixes
    artemo-brd authored Jul 30, 2026
    Configuration menu
    Copy the full SHA
    add31dc View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2026

  1. fix: allow safe relative subfolders in filename while still blocking …

    …traversal
    
    The previous fix for path traversal (CWE-22) in FilenameSchema reduced any
    filename to its bare basename via path.basename(), which is more aggressive
    than necessary: it also strips legitimate relative subfolders developers
    commonly use (e.g. filename: 'output/data.json'), even though those never
    posed a traversal risk.
    
    FilenameSchema now allows relative subfolder segments, and instead
    explicitly rejects (with a clear ValidationError, not a silent rewrite):
      - '..' segments anywhere in the path
      - absolute paths (POSIX '/x', Windows 'C:\x', UNC '\\host\share')
    Backslashes are always treated as separators (not just on Windows), so a
    Windows-shaped traversal payload can't slip through on a POSIX host by
    switching separator style.
    
    getAbsAndEnsureDir (utils/files.ts) is the single chokepoint all three
    write paths converge on (saveResults, SnapshotAPI.download, and
    BaseResult.save() — the last of which accepts a raw path that never passes
    through FilenameSchema at all), so it now enforces containment itself
    rather than assuming callers already sanitized:
      1. Lexical containment: resolved candidate must stay under baseDir.
      2. Real-path containment: after mkdir, re-resolve via fs.realpath and
         re-check, so a subfolder that is (or contains) a symlink pointing
         outside baseDir can't be used to escape it — lexical resolution alone
         is blind to symlinks.
    Containment is only enforced for *relative* inputs: an absolute path is a
    deliberate choice by the calling code (same trust model as calling
    fs.writeFile directly) — BaseResult.save() has always supported writing to
    an arbitrary absolute destination, and that's preserved.
    
    Tests: rewrote tests/files.test.ts's FilenameSchema suite for the new
    allow-subfolders/reject-traversal behavior, added a dedicated
    getAbsAndEnsureDir suite (nested subfolders, relative-traversal rejection,
    explicit-absolute-path pass-through, symlink-escape rejection), extended
    saveResults integration tests (nested subfolder write, symlink-escape
    rejection) and added BaseResult.save() coverage for the schema-bypass path.
    artemo-brd committed Aug 2, 2026
    Configuration menu
    Copy the full SHA
    2012a94 View commit details
    Browse the repository at this point in the history
  2. test: skip symlink-creating tests on Windows (needs Developer Mode/ad…

    …min)
    
    fs.symlink() typically requires Developer Mode or admin rights on Windows,
    unrelated to whether the containment fix itself works there. Skip the two
    symlink-escape tests via it.skipIf(isWindows) instead of letting them fail
    on an environment limitation rather than an actual regression.
    artemo-brd committed Aug 2, 2026
    Configuration menu
    Copy the full SHA
    2102e54 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #32 from brightdata/fix/path-traversal-allow-safe-…

    …subfolders
    
    fix: allow safe relative subfolders in filename while still blocking traversal
    artemo-brd authored Aug 2, 2026
    Configuration menu
    Copy the full SHA
    0fd51aa View commit details
    Browse the repository at this point in the history
Loading