Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/anybotics/afero-gdrive
It provides an afero filesystem implementation of a Google Drive backend.
This was created to provide a backend to the ftpserver but can definitely be used in any other code.
I'm very opened to any improvement through issues or pull-request that might lead to a better implementation or even better testing.
/a/b/c/file.txt
for writing will create at least 4 request, and the same will happen for reading.Note: Errors handling is skipped for brevity but you definitely have to handle it.
import (
"github.com/fclairamb/afero-gdrive/oauthhelper"
)
func main() {
// We declare the OAuh2 app
helper := oauthhelper.Auth{
ClientID: os.Getenv("GOOGLE_CLIENT_ID"),
ClientSecret: os.Getenv("GOOGLE_CLIENT_SECRET"),
Authenticate: func(url string) (string, error) {
return "", ErrNotSupported
},
}
// Pass a token
token, _ := base64.StdEncoding.DecodeString(os.Getenv("GOOGLE_TOKEN"))
helper.Token = new(oauth2.Token)
json.Unmarshal(token, helper.Token)
// Initialize the authenticated client
client, _ := helper.NewHTTPClient(context.Background())
// Initialize the FS from the athenticated http client
fs, _ := New(client)
// And use it
file, _ := fs.OpenFile("my_file.txt", os.O_WRONLY, 0777)
file.WriteString("Hello world !")
file.Close()
}
This is a fork from T4cC0re/gdriver which is itself a fork of eun/gdriver.
The code was massively modified. Most of the changes are improvements. The file listing API from the original implemented based on callbacks is much better though, but this was needed to respect the afero API.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.