
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
github.com/marcosocram/fullcycle-weather-api
Advanced tools
Este serviço em Go consulta a temperatura atual para uma determinada localização com base no CEP fornecido. Utiliza a API do ViaCEP para buscar informações de localização e a API do WeatherAPI para consultar as temperaturas.
O serviço responde adequadamente para diferentes cenários:
{
"temp_C": 28.5,
"temp_F": 83.3,
"temp_K": 301.65
}
invalid zipcodecan not find zipcodeClone este repositório:
git clone https://github.com/marcosocram/fullcycle-weather-api.git
cd fullcycle-weather-api
Substitua a variável de ambiente WEATHER_API_KEY no docker-compose.yml com sua chave de API do WeatherAPI:
environment:
WEATHER_API_KEY: "sua_chave_api_aqui"
Inicie o serviço com Docker Compose:
docker-compose up --build
Isso construirá e executará o serviço na porta 8080.
Para verificar o funcionamento do serviço, você pode fazer uma requisição para o endpoint /weather com um CEP válido. Aqui estão alguns exemplos de como testar:
curl "http://localhost:8080/weather?cep=01001000"
{
"temp_C": 28.5,
"temp_F": 83.3,
"temp_K": 301.65
}
curl "http://localhost:8080/weather?cep=1234567"
invalid zipcode
curl "http://localhost:8080/weather?cep=99999999"
can not find zipcode
Para rodar os testes automatizados:
Configura a variável de ambiente WEATHER_API_KEY no arquivo tests/weather_test.go com sua chave de API do WeatherAPI:
t.Setenv("WEATHER_API_KEY", "sua_chave_api_aqui")
Execute os testes com o comando:
go test ./...
Isso executará os testes unitários, cobrindo:
Para parar o serviço e remover os containers, execute:
docker-compose down
https://fullcycle-weather-api-251071863407.us-central1.run.app/weather?cep=88110798
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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.