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: go-openapi/swag
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.27.1
Choose a base ref
...
head repository: go-openapi/swag
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.27.2
Choose a head ref
  • 2 commits
  • 12 files changed
  • 3 contributors

Commits on Jul 20, 2026

  1. fix(loading): resolve absolute in-root paths under WithRoot (#224)

    os.Root only accepts paths relative to its root and rejects any absolute path,
    even one that points inside the root. But callers that normalize references to
    absolute paths before loading — notably github.com/go-openapi/spec, which
    resolves every $ref to an absolute path against the spec's base — then had every
    confined read rejected, making WithRoot unusable for its primary purpose:
    safely resolving references in an untrusted document.
    
    Rebase an absolute requested path onto the root (via filepath.Rel) before
    handing it to os.Root:
    
      - a relative path is passed through unchanged (os.Root confines it, including
        ".." traversal and symlink escapes);
      - an absolute path inside the root is rebased to a root-relative path and read;
      - an absolute path outside the root yields a "../" prefix and is rejected by
        os.Root;
      - a path that cannot be made relative to the root (e.g. a different volume on
        Windows) makes filepath.Rel return an error, which is propagated as a
        rejection rather than allowed to escape.
    
    Symlink-escape protection is preserved: the rebase is purely lexical; the actual
    open still goes through os.Root, which resolves every path component within the
    root. Default behavior (no WithRoot) is unchanged.
    
    Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
    Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    fredbi and claude authored Jul 20, 2026
    Configuration menu
    Copy the full SHA
    b0d2d9d View commit details
    Browse the repository at this point in the history
  2. chore: prepare release v0.27.2

    Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    bot-go-openapi[bot] authored and github-actions[bot] committed Jul 20, 2026
    Configuration menu
    Copy the full SHA
    c0c66d9 View commit details
    Browse the repository at this point in the history
Loading
⌂ 换网址