-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add SSCS as scan type for the triage command (AST-72075) #1022
base: main
Are you sure you want to change the base?
Add SSCS as scan type for the triage command (AST-72075) #1022
Conversation
Great job, no security vulnerabilities found in this Pull Request |
1a51196
to
c22a73a
Compare
type ScanOverviewHTTPWrapper struct { | ||
path string | ||
} | ||
|
||
func NewHTTPScanOverviewWrapper(path string) ScanOverviewWrapper { | ||
validPath := configurePath(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configurePath
function is not defined within the provided diff. Ensure that the function exists and is properly implemented to handle the path
parameter. If it's defined in another file, make sure it is correctly imported and accessible in this context.
func TestWriteSingleConfigKeyStringNonExistingFile_CreatingTheFileAndWritesTheKey_Success(t *testing.T) { | ||
configFilePath := "non-existing-file" | ||
|
||
file, err := os.Open(configFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file handle file
is not closed after opening. Consider deferring the close operation immediately after checking the error from os.Open
to avoid resource leaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close th file
86b550a
to
2375f6f
Compare
|
||
file, err = os.Open(configFilePath) | ||
assert.NilError(t, err) | ||
defer func(file *os.File) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use file.Close()
and os.Remove(configFilePath)
directly without the anonymous function wrapper since there's no additional logic that requires the use of defer
in this context.
func TestWriteSingleConfigKeyStringNonExistingFile_CreatingTheFileAndWritesTheKey_Success(t *testing.T) { | ||
configFilePath := "non-existing-file" | ||
|
||
file, err := os.Open(configFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close th file
file, err := os.Open(configFilePath) | ||
asserts.NotNil(t, err) | ||
asserts.Nil(t, file) | ||
err = file.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attempting to close a file that failed to open is unnecessary and could lead to a nil pointer dereference. Remove the file.Close()
call and the subsequent error check.
ed90b74
to
2375f6f
Compare
2375f6f
to
0ade878
Compare
…for-the-triage-command
By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
References
Testing
Checklist