aaronparker / evergreen

Create evergreen Windows image build pipelines with the latest version numbers and download URLs for common applications
http://stealthpuppy.com/evergreen/
MIT License
369 stars 63 forks source link

[Bug]: API request by Powershell returns 403 #726

Open ricoroodenburg opened 1 month ago

ricoroodenburg commented 1 month ago

What happened?

Invoke-RestMethod -Uri "https://evergreen-api.stealthpuppy.com/app/omnissahorizonclient" -Method Get

Invoke-RestMethod : The remote server returned an error: (403) Forbidden. At line:1 char:1

Version

API

What PowerShell edition/s are you running Evergreen on?

Windows PowerShell

Which operating system/s are you running Evergreen on?

Windows 10+, Windows Server 2016+

Have you reviewed the documentation?

Verbose output

VERBOSE: GET with 0-byte payload
Invoke-RestMethod : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ Invoke-RestMethod -Uri "https://evergreen-api.stealthpuppy.com/app/om ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ricoroodenburg commented 1 month ago

I think this issue is releated to https://github.com/aaronparker/evergreen/issues/660

aaronparker commented 1 month ago

The API is currently being abused (in the range of 300,000-400,000 requests per day) by some type of script, so I've blocked the default PowerShell user agent to prevent the requests from hitting the API.

You can use Get-EvergreenAppFromApi or specify a custom user agent in your call to the API. If you use a custom user agent, please ensure it's something unique so that I can identify in the logs if I need to add more filtering in the future.

660 is a slightly different issue that seems to affect calls from within Azure only.

ricoroodenburg commented 1 month ago

The API is currently being abused (in the range of 300,000-400,000 requests per day) by some type of script, so I've blocked the default PowerShell user agent to prevent the requests from hitting the API.

You can use Get-EvergreenAppFromApi or specify a custom user agent in your call to the API. If you use a custom user agent, please ensure it's something unique so that I can identify in the logs if I need to add more filtering in the future.

660 is a slightly different issue that seems to affect calls from within Azure only.

Ah that's terrible. I hope it wasn't me :). We only use it once a month for our lifecycle change.

I have changed the UserAgent to something unique with this Issue ID, it is working now. Please check your backend if you can see requests from my end. Thanks!!