Skip to content

Commit 9bbc5e5

Browse files
committed
Revert file fetcher HTTP URL handling
The filepath.Base() code for HTTP URLs in newFileFetcher was dead code. No test or production path sends an HTTP URL to a file-based fetcher. The enclave fetches binaries via its own BinaryFetcher, independent of the node syncer's fetcher.
1 parent e7a3894 commit 9bbc5e5

2 files changed

Lines changed: 12 additions & 26 deletions

File tree

core/services/workflows/syncer/fetcher.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,12 @@ func newFileFetcher(basePath string, lggr logger.Logger) types.FetcherFunc {
178178
return nil, fmt.Errorf("invalid URL: %w", err)
179179
}
180180

181-
var fullPath string
182-
if u.Scheme == "http" || u.Scheme == "https" {
183-
// For HTTP(S) URLs, extract just the filename and resolve against basePath.
184-
// This supports confidential workflows where the on-chain URL must be HTTP
185-
// (so the enclave can fetch the binary), but the syncer reads from the local filesystem.
186-
fullPath = filepath.Join(basePath, filepath.Base(u.Path))
187-
} else {
188-
fullPath = filepath.Clean(u.Path)
189-
// ensure that the incoming request URL is either relative or absolute but within the basePath
190-
if !filepath.IsAbs(fullPath) {
191-
// If it's not absolute, we assume it's relative to the basePath
192-
fullPath = filepath.Join(basePath, fullPath)
193-
}
181+
fullPath := filepath.Clean(u.Path)
182+
183+
// ensure that the incoming request URL is either relative or absolute but within the basePath
184+
if !filepath.IsAbs(fullPath) {
185+
// If it's not absolute, we assume it's relative to the basePath
186+
fullPath = filepath.Join(basePath, fullPath)
194187
}
195188
if !strings.HasPrefix(fullPath, basePath) {
196189
return nil, fmt.Errorf("request URL %s is not within the basePath %s", fullPath, basePath)

core/services/workflows/syncer/v2/fetcher.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,12 @@ func newFileFetcher(basePath string, lggr logger.Logger) types.FetcherFunc {
212212
return nil, fmt.Errorf("invalid URL: %w", err)
213213
}
214214

215-
var fullPath string
216-
if u.Scheme == "http" || u.Scheme == "https" {
217-
// For HTTP(S) URLs, extract just the filename and resolve against basePath.
218-
// This supports confidential workflows where the on-chain URL must be HTTP
219-
// (so the enclave can fetch the binary), but the syncer reads from the local filesystem.
220-
fullPath = filepath.Join(basePath, filepath.Base(u.Path))
221-
} else {
222-
fullPath = filepath.Clean(u.Path)
223-
// ensure that the incoming request URL is either relative or absolute but within the basePath
224-
if !filepath.IsAbs(fullPath) {
225-
// If it's not absolute, we assume it's relative to the basePath
226-
fullPath = filepath.Join(basePath, fullPath)
227-
}
215+
fullPath := filepath.Clean(u.Path)
216+
217+
// ensure that the incoming request URL is either relative or absolute but within the basePath
218+
if !filepath.IsAbs(fullPath) {
219+
// If it's not absolute, we assume it's relative to the basePath
220+
fullPath = filepath.Join(basePath, fullPath)
228221
}
229222
if !strings.HasPrefix(fullPath, basePath) {
230223
return nil, fmt.Errorf("request URL %s is not within the basePath %s", fullPath, basePath)

0 commit comments

Comments
 (0)