/
githubmirror
/
kubernetes
Обзор
Документация
Войти
/
githubmirror
/
kubernetes
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
vendor/github.com/go-openapi/swag/loading/doc.go
29 строк
1 KB
Davanum Srinivas
Update k8s.io/kube-openapi to v0.0.0-20260721132016-d427ff9ee9ad
21 июл 2026, 16:56
Не верифицирован
21 июл 2026, 16:56
0706a3b
Код
Авторство
О чём код?
// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers // SPDX-License-Identifier: Apache-2.0 // Package loading provides tools to load a file from http or from a local file system. // // # Security // // By default, the local loader reads any path the process can access, including absolute // paths and "file://" URIs (for example "file:///etc/passwd"). Applications that pass // untrusted input to [LoadFromFileOrHTTP], [JSONDoc] (or to downstream consumers such as // go-openapi/loads) must confine local loading to a trusted directory. // // Use [WithRoot] to do so: it resolves every requested path relative to a chosen directory // and rejects anything that escapes it, including via symlink. It is built on [os.Root] // and is therefore safer than passing an [os.DirFS] to [WithFS], which does not block // symlink escapes. // // Remote loading uses a standard [net/http] client. // By default it follows redirects and performs no destination filtering — exactly like [net/http.DefaultClient]. // // A caller-controlled URL may therefore reach internal services or cloud metadata endpoints // (server-side request forgery). // // This package does not, and should not, embed a network policy: // when the URL may derive from untrusted input, supply a restricted client with // [WithHTTPClient] whose transport rejects unwanted destinations at dial time — which also // covers redirects and DNS rebinding. // See the example on [LoadFromFileOrHTTP]. package loading