
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
github.com/gustavo-villar/go-multithreading-api-calls
This project is a Go application that retrieves address information based on a provided Brazilian postal code (CEP) by querying two different APIs concurrently. The program returns the address data from the API that responds the fastest, ensuring a quick and efficient result.
The application sends concurrent requests to the following APIs:
It uses the API that provides the first response, ignoring the slower one. The program also includes a timeout mechanism to ensure the entire process completes within 1 second. If neither API responds within the time limit, a timeout message is displayed.
go run main.go [CEP]
Replace [CEP] with the desired Brazilian postal code. If no CEP is provided, the application defaults to 01153000.
The application prints the fetched address to the command line with the following format:
Endereço (API): Logradouro, Bairro, Localidade - UF
If the request exceeds the 1-second timeout or an error occurs, the program will print a corresponding error message.
go run main.go 01001000
Expected output:
// BrasilAPI
Endereço (Brasil API): Praça da Sé, Sé, São Paulo - SP
or
// ViaCEP
Endereço (ViaCEP): Praça da Sé, Sé, São Paulo - SP
If a timeout occurs:
// ViaCEP
Timeout: Nenhuma das APIs respondeu em tempo hábil.
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.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.