-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: address clawpatch security and reliability findings #6941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2c6831e
fix: return error from getPaths when ffmpeg/ffprobe not found in PATH
slick-daddy 5e2c7c9
fix: close CPU profile file descriptor after StopCPUProfile
slick-daddy 3bae450
fix: return error instead of panic for unknown file type in convertBa…
slick-daddy ea97d46
fix: correct install target source path on Windows and Unix
slick-daddy 30da922
fix: add generate-backend dependency to build-release to prevent para…
slick-daddy 8852f7f
fix: exit with non-zero code when any file fails in phasher
slick-daddy 04a9b78
test: replace empty TestStub with real tests for exitError, recoverPa…
slick-daddy dcd2957
fix: return error instead of panic for unknown file type in convertBa…
slick-daddy 57085cd
style: gofmt internal/api/models.go
slick-daddy b3a39a7
fix: address PR review comments from WithoutPants
slick-daddy d580955
revert convertBaseFiles to sliceutil.Map per review feedback
slick-daddy 6498a96
Revert unrelated line removals
WithoutPants File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,64 @@ | ||
| package main | ||
|
|
||
| import "testing" | ||
| import ( | ||
| "os" | ||
| "testing" | ||
|
|
||
| func TestStub(t *testing.T) { | ||
| "github.com/stashapp/stash/internal/log" | ||
| "github.com/stashapp/stash/pkg/logger" | ||
| ) | ||
|
|
||
| func TestExitError(t *testing.T) { | ||
| origCode := exitCode | ||
| origLogger := logger.Logger | ||
| defer func() { | ||
| exitCode = origCode | ||
| logger.Logger = origLogger | ||
| }() | ||
|
|
||
| l := log.NewLogger() | ||
| l.Init("", true, "Error", 0) | ||
| logger.Logger = l | ||
|
|
||
| exitCode = 0 | ||
| exitError(os.ErrInvalid) | ||
| if exitCode != 1 { | ||
| t.Errorf("exitError should set exitCode to 1, got %d", exitCode) | ||
| } | ||
| } | ||
|
|
||
| func TestRecoverPanic(t *testing.T) { | ||
| origCode := exitCode | ||
| origLogger := logger.Logger | ||
| defer func() { | ||
| exitCode = origCode | ||
| logger.Logger = origLogger | ||
| }() | ||
|
|
||
| l := log.NewLogger() | ||
| l.Init("", true, "Error", 0) | ||
| logger.Logger = l | ||
|
|
||
| exitCode = 0 | ||
| func() { | ||
| defer recoverPanic() | ||
| panic("test panic") | ||
| }() | ||
| if exitCode != 1 { | ||
| t.Errorf("recoverPanic should set exitCode to 1 after a panic, got %d", exitCode) | ||
| } | ||
| } | ||
|
|
||
| func TestInitLogTemp(t *testing.T) { | ||
| origLogger := logger.Logger | ||
| defer func() { logger.Logger = origLogger }() | ||
|
|
||
| logger.Logger = nil | ||
| l := initLogTemp() | ||
| if l == nil { | ||
| t.Fatal("initLogTemp should return a non-nil logger") | ||
| } | ||
| if logger.Logger == nil { | ||
| t.Error("initLogTemp should set the global logger.Logger") | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.