Romanitho / Winget-AutoUpdate

WAU daily updates apps as system and notify connected users. (Allowlist and Blocklist support)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: IWR for Test-Network detected as "bot" traffic

JamesDodds opened this issue · comments

The problem

A colleague and I use WAU to keep various software updated.
They noticed that it seemed to time out when trying to check the internet connection.

Through testing, we found that adding a user agent to the Invoke-WebRequest worked.
iwr -uri "http://www.msftconnecttest.com/connecttest.txt" -UseBasicParsing -TimeoutSec 5 -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)

It was being blocked by a firewall rule to stop suspicious potential botnets.

What version of WAU has the issue?

1.20.0

What version of Windows are you using (ex. Windows 11 22H2)?

Win 11 23H2

What version of winget are you using?

v1.22.10861.0

Log information

########################################################
#     CHECK FOR APP UPDATES (System context with ServiceUI) - 09/04/2024
########################################################
06:00:19 - Running Post Update actions:
06:00:19 - Checking if WinGet is installed/up to date.
06:00:19 - -> Downloading WinGet MSIXBundle for App Installer...
06:02:00 - -> Installing WinGet MSIXBundle for App Installer...
06:02:06 - -> WinGet MSIXBundle (v1.6.3133) for App Installer installed successfully!
06:02:06 - -> WinGet sources reset.
06:02:06 - -> Checking Mods Directory:
06:02:06 - -> The mods directory was already secured!
06:02:06 - -> C:\ProgramData\Winget-AutoUpdate\functions\Get-WinGetAvailableVersion.ps1 removed.
06:02:06 - -> C:\ProgramData\Winget-AutoUpdate\Version.txt removed.
06:02:08 - Post Update actions finished
06:02:08 - Notification Level: Full. Notification Language: English
06:02:08 - Checking internet connection...
06:26:11 - Notify 'No connection' sent.
08:26:05 - Timeout. No internet connection !
08:26:09 - End of process!

Additional information

No response

Hey @JamesDodds
Some time ago I suggested replacing manual checking of network/ping/low-level requests with a Win API call.
#486

Could you check that alternative test-network function on your end?
Maybe that would help you guys?

Thanks @AndrewDemski-ad-gmail-com. That also works in PoSH v5. I'll give it a wider test.

That also works in PoSH v5.

Well, let's face it, some companies are still using version 5.1
From the point of view of a locally executed script, this should not be a limitation.
The entire WAU project is written in PoSh 5 and interpretation using version 7 LTS will only be beneficial.

This is linked to your context, not a WAU "bug".
Anyway, we can change the way we check internet connectivity. Not sure that UserAgent would be enough for some other cases.
We could also add an option to bypass the connectivity check.

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.