René's URL Explorer Experiment


Title: DownloadManager: add redact_url= kwarg to hide auth-bearing URLs in logs by bitcoin3us · Pull Request #136 · MicroPythonOS/MicroPythonOS · GitHub

Open Graph Title: DownloadManager: add redact_url= kwarg to hide auth-bearing URLs in logs by bitcoin3us · Pull Request #136 · MicroPythonOS/MicroPythonOS

X Title: DownloadManager: add redact_url= kwarg to hide auth-bearing URLs in logs by bitcoin3us · Pull Request #136 · MicroPythonOS/MicroPythonOS

Description: Summary DownloadManager.download_url prints the full request URL three times per download (start, finished, exception path) plus the entire response-headers dict. Great for the typical callers fetching public URLs (app icons, OS updates, weather), but it silently leaks any auth secret embedded in the URL's path or query string. Two real cases motivating this PR: Lightning Piggy's on-chain wallet (LightningPiggyApp PR #25) queries https://btc1.trezor.io/api/v2/xpub/zpub6q…?details=txs&tokens=derived to fetch balance + transactions for a watch-only xpub. The xpub itself sits in the URL path. A leaked xpub exposes the wallet's entire past + future address derivation tree to whoever reads the log — non-recoverable confidentiality damage even though funds custody is unaffected. The app already scrubs xpubs from its own print() calls, but DownloadManager's prints sit below that and re-leak on every poll. Any future caller using API-key-in-URL or token-in-URL auth. Common pattern (LNBits, BlueWallet's LNDHub, some HTTPS RPC endpoints) — the leak surface is wider than just Lightning Piggy. Behaviour Adds a redact_url=False kwarg (default preserves current behaviour). When True: URL logged as scheme://host[:port]/...REDACTED... instead of full. The host is intentionally kept so failure triage (DNS / connectivity / wrong endpoint) is still possible. Response-headers dump is suppressed entirely (replaced with ). Response headers often carry set-cookie, cf-ray, and other correlatable session tokens. Exception messages have the URL substring scrubbed before printing (aiohttp's ClientConnectorError typically embeds the URL). Default False is deliberate — most callers fetch public URLs and want the full log line for diagnostics. Callers explicitly opt in: await DownloadManager.download_url(url, redact_url=True) Tests tests/test_download_manager.py — added 3 new test classes (10 tests): TestSafeUrl (6 tests) for the new _safe_url helper — path-with-query strip, port handling, naked-host pass-through, malformed-URL placeholder, belt-and-braces "secret substrings never appear in output" guard. TestRedactUrlKwarg (2 tests) confirming the kwarg flows through the call surface (sync wrapper + async impl + mock) and defaults to False. TestRedactedExceptionPath (2 tests, commit 64963f9) — end-to-end coverage of the URL-bearing exception scrubbing path. Installs a fake aiohttp into sys.modules so the function-local import aiohttp resolves to a stub whose ClientSession.get() raises RuntimeError(message) with the full URL in the message (mimics aiohttp's ClientConnectorError without needing the network), then captures print(...) and asserts the secret-bearing substring is scrubbed under redact_url=True and preserved under redact_url=False. All 22 existing tests continue to pass (default behaviour unchanged): $ bash tests/unittest.sh tests/test_download_manager.py Ran 32 tests OK Follow-up Lightning Piggy's on-chain wallet (PR #25) will follow up on its side to pass redact_url=True once this lands. That's a one-line change in onchain_wallet.py:fetch_balance_and_payments(). Test plan All 32 tests pass on macOS desktop (bash tests/unittest.sh tests/test_download_manager.py) Existing tests (default behaviour) unchanged URL-bearing exception path covered by unit tests (commit 64963f9): fake-aiohttp injection deterministically exercises the except Exception as e: ... url in err_str branch and verifies both the scrubbed (redact_url=True) and preserved (redact_url=False) print output Hardware end-to-end smoke test: an LP onchain wallet call with redact_url=True shows https://btc1.trezor.io/...REDACTED... in serial logs. Gated on LightningPiggy #25 follow-up adding the kwarg — will tick once that lands and the integrated build is exercised on device 🤖 Generated with Claude Code

Open Graph Description: Summary DownloadManager.download_url prints the full request URL three times per download (start, finished, exception path) plus the entire response-headers dict. Great for the typical callers fetc...

X Description: Summary DownloadManager.download_url prints the full request URL three times per download (start, finished, exception path) plus the entire response-headers dict. Great for the typical callers fetc...

Opengraph URL: https://github.com/MicroPythonOS/MicroPythonOS/pull/136

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ee5742e7-0c14-b3aa-2ee9-d990a0445259
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC310:E2378:754075D:A44D64E:6A4FDFB6
html-safe-noncea897f6495119abfad651ce4de26580e942030e6f3fe85a7057700f3b438fed9f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzEwOkUyMzc4Ojc1NDA3NUQ6QTQ0RDY0RTo2QTRGREZCNiIsInZpc2l0b3JfaWQiOiI2Mjg5NDYwMTA0NzExMzY0NTM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5ecb7d646357cab022be7ac31ed315003ce2e5d284c6b0c0900258b82b5ee6bb
hovercard-subject-tagpull_request:3676791738
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
twitter:imagehttps://avatars.githubusercontent.com/u/115934595?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/115934595?s=400&v=4
og:image:altSummary DownloadManager.download_url prints the full request URL three times per download (start, finished, exception path) plus the entire response-headers dict. Great for the typical callers fetc...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None19b98c3d9767bb8a56238a89ff8401d1cbdf3bc5c353799aacf49fe6c76b4b7c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/MicroPythonOS/MicroPythonOS git https://github.com/MicroPythonOS/MicroPythonOS.git
octolytics-dimension-user_id213598128
octolytics-dimension-user_loginMicroPythonOS
octolytics-dimension-repository_id975472483
octolytics-dimension-repository_nwoMicroPythonOS/MicroPythonOS
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id975472483
octolytics-dimension-repository_network_root_nwoMicroPythonOS/MicroPythonOS
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release142593e66413bbae27fd485859993597d5a3b104
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMicroPythonOS%2FMicroPythonOS%2Fpull%2F136%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMicroPythonOS%2FMicroPythonOS%2Fpull%2F136%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=MicroPythonOS%2FMicroPythonOS
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
MicroPythonOS https://github.com/MicroPythonOS
MicroPythonOShttps://github.com/MicroPythonOS/MicroPythonOS
Notifications https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Fork 82 https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Star 737 https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Code https://github.com/MicroPythonOS/MicroPythonOS
Issues 23 https://github.com/MicroPythonOS/MicroPythonOS/issues
Pull requests 7 https://github.com/MicroPythonOS/MicroPythonOS/pulls
Discussions https://github.com/MicroPythonOS/MicroPythonOS/discussions
Actions https://github.com/MicroPythonOS/MicroPythonOS/actions
Projects https://github.com/MicroPythonOS/MicroPythonOS/projects
Security and quality 0 https://github.com/MicroPythonOS/MicroPythonOS/security
Insights https://github.com/MicroPythonOS/MicroPythonOS/pulse
Code https://github.com/MicroPythonOS/MicroPythonOS
Issues https://github.com/MicroPythonOS/MicroPythonOS/issues
Pull requests https://github.com/MicroPythonOS/MicroPythonOS/pulls
Discussions https://github.com/MicroPythonOS/MicroPythonOS/discussions
Actions https://github.com/MicroPythonOS/MicroPythonOS/actions
Projects https://github.com/MicroPythonOS/MicroPythonOS/projects
Security and quality https://github.com/MicroPythonOS/MicroPythonOS/security
Insights https://github.com/MicroPythonOS/MicroPythonOS/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FMicroPythonOS%2FMicroPythonOS%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS%2Fissues%2Fnew%2Fchoose
ThomasFarstrikehttps://github.com/ThomasFarstrike
MicroPythonOS:mainhttps://github.com/MicroPythonOS/MicroPythonOS/tree/main
bitcoin3us:security/download-manager-redact-urlhttps://github.com/bitcoin3us/MicroPythonOS/tree/security/download-manager-redact-url
Conversation 1 https://github.com/MicroPythonOS/MicroPythonOS/pull/136
Commits 2 https://github.com/MicroPythonOS/MicroPythonOS/pull/136/commits
Checks 5 https://github.com/MicroPythonOS/MicroPythonOS/pull/136/checks
Files changed https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
DownloadManager: add redact_url= kwarg to hide auth-bearing URLs in logs https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#top
Show all changes 2 commits https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
e608c65 DownloadManager: add redact_url= kwarg to hide auth-bearing URLs in logs May 13, 2026 https://github.com/MicroPythonOS/MicroPythonOS/pull/136/commits/e608c658dc8be0a88a9900f558ee5ce689ad8e5e
64963f9 DownloadManager: cover redact_url exception-path scrubbing with tests May 14, 2026 https://github.com/MicroPythonOS/MicroPythonOS/pull/136/commits/64963f943e9b47bc7dfa13d6b0282e4d02afbc80
Clear filters https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
CHANGELOG.md https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
download_manager.py https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
mocks.py https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-0871389dfe0ce27fe110ad15f15e3b70615480567f886ac0d570ec28c5b8308e
test_download_manager.py https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-997d9a4173ac7af7c5e38c2c569d9284891217d64d28cb2d56d65b8f33ae5063
CHANGELOG.mdhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
View file https://github.com/bitcoin3us/MicroPythonOS/blob/64963f943e9b47bc7dfa13d6b0282e4d02afbc80/CHANGELOG.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/{{ revealButtonHref }}
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
internal_filesystem/lib/mpos/net/download_manager.pyhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
View file https://github.com/bitcoin3us/MicroPythonOS/blob/64963f943e9b47bc7dfa13d6b0282e4d02afbc80/internal_filesystem/lib/mpos/net/download_manager.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/{{ revealButtonHref }}
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-48f17697c181e014409ed7247cb919263456afb690f1f7f1457d6bd7ac5546fd
internal_filesystem/lib/mpos/testing/mocks.pyhttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-0871389dfe0ce27fe110ad15f15e3b70615480567f886ac0d570ec28c5b8308e
View file https://github.com/bitcoin3us/MicroPythonOS/blob/64963f943e9b47bc7dfa13d6b0282e4d02afbc80/internal_filesystem/lib/mpos/testing/mocks.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/{{ revealButtonHref }}
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-0871389dfe0ce27fe110ad15f15e3b70615480567f886ac0d570ec28c5b8308e
https://github.com/MicroPythonOS/MicroPythonOS/pull/136/files#diff-0871389dfe0ce27fe110ad15f15e3b70615480567f886ac0d570ec28c5b8308e
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/136/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.