Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
0980c35f59 build(deps): bump github/codeql-action from 4.31.2 to 4.32.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.2 to 4.32.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0499de31b9...89a39a4e59)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 11:26:32 +00:00
3 changed files with 9 additions and 32 deletions

View File

@@ -29,10 +29,10 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5 uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }} build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5 uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5

View File

@@ -25,7 +25,6 @@ var client *http.Client
func init() { func init() {
dialer := &net.Dialer{ dialer := &net.Dialer{
LocalAddr: nil, LocalAddr: nil,
Timeout: time.Second * 30,
} }
trnspt := http.DefaultTransport.(*http.Transport).Clone() trnspt := http.DefaultTransport.(*http.Transport).Clone()
@@ -56,8 +55,10 @@ func init() {
} }
client = &http.Client{ client = &http.Client{
Timeout: time.Hour * 2, Timeout: time.Hour * 12,
Transport: trnspt, Transport: trnspt,
// Disallow any redirect on an HTTP call. This is a security requirement: do not modify // Disallow any redirect on an HTTP call. This is a security requirement: do not modify
// this logic without first ensuring that the new target location IS NOT within the current // this logic without first ensuring that the new target location IS NOT within the current
// instance's local network. // instance's local network.
@@ -191,10 +192,7 @@ func (dl *Download) Execute() error {
req.Header.Set("User-Agent", "Pterodactyl Panel (https://pterodactyl.io)") req.Header.Set("User-Agent", "Pterodactyl Panel (https://pterodactyl.io)")
res, err := client.Do(req) res, err := client.Do(req)
if err != nil { if err != nil {
if IsDownloadError(err) { return ErrDownloadFailed
return err
}
return errors.Wrap(err, ErrDownloadFailed.Error())
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
@@ -337,7 +335,3 @@ func mustParseCIDR(ip string) *net.IPNet {
} }
return block return block
} }
func IsDownloadError(err error) bool {
return errors.Is(err, ErrDownloadFailed) || errors.Is(err, ErrInvalidIPAddress) || errors.Is(err, ErrInternalResolution)
}

View File

@@ -328,15 +328,13 @@ func postServerPullRemoteFile(c *gin.Context) {
download := func() error { download := func() error {
s.Log().WithField("download_id", dl.Identifier).WithField("url", u.String()).Info("starting pull of remote file to disk") s.Log().WithField("download_id", dl.Identifier).WithField("url", u.String()).Info("starting pull of remote file to disk")
if err := dl.Execute(); err != nil { if err := dl.Execute(); err != nil {
if !downloader.IsDownloadError(err) { s.Log().WithField("download_id", dl.Identifier).WithField("error", err).Error("failed to pull remote file")
s.Log().WithField("download_id", dl.Identifier).WithField("error", err).Error("failed to pull remote file")
}
return err return err
} else {
s.Log().WithField("download_id", dl.Identifier).Info("completed pull of remote file")
} }
s.Log().WithField("download_id", dl.Identifier).Info("completed pull of remote file")
return nil return nil
} }
if !data.Foreground { if !data.Foreground {
go func() { go func() {
_ = download() _ = download()
@@ -348,21 +346,6 @@ func postServerPullRemoteFile(c *gin.Context) {
} }
if err := download(); err != nil { if err := download(); err != nil {
if downloader.IsDownloadError(err) {
var message = "The URL or IP address provided could not be resolved to a valid destination."
if errors.Is(err, downloader.ErrDownloadFailed) {
s.Log().WithField("identifier", dl.Identifier).WithField("error", err).Warn("failed to download remote file")
message = "An error was encountered while trying to download this file. Please try again later."
}
c.JSON(http.StatusBadRequest, gin.H{
"identifier": dl.Identifier,
"message": message,
})
return
}
middleware.CaptureAndAbort(c, err) middleware.CaptureAndAbort(c, err)
return return
} }