René's URL Explorer Experiment


Title: Message.toWire(Message.MAXLENGTH) can generate byte[] > Message.MAXLENGTH · Issue #355 · dnsjava/dnsjava · GitHub

Open Graph Title: Message.toWire(Message.MAXLENGTH) can generate byte[] > Message.MAXLENGTH · Issue #355 · dnsjava/dnsjava

X Title: Message.toWire(Message.MAXLENGTH) can generate byte[] > Message.MAXLENGTH · Issue #355 · dnsjava/dnsjava

Description: Hello! So I was investigating a failed update to a BIND nameserver that returned FORMERR. Looking with the debugger, I've noticed that the generated wire format was > 65535 here. After more investigation, I think I identified the issue: ...

Open Graph Description: Hello! So I was investigating a failed update to a BIND nameserver that returned FORMERR. Looking with the debugger, I've noticed that the generated wire format was > 65535 here. After more investi...

X Description: Hello! So I was investigating a failed update to a BIND nameserver that returned FORMERR. Looking with the debugger, I've noticed that the generated wire format was > 65535 here. After more ...

Opengraph URL: https://github.com/dnsjava/dnsjava/issues/355

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Message.toWire(Message.MAXLENGTH) can generate byte[] \u003e Message.MAXLENGTH","articleBody":"Hello!\r\n\r\nSo I was investigating a failed update to a BIND nameserver that returned FORMERR. Looking with the debugger, I've noticed that the generated wire format was \u003e 65535 [here](https://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/SimpleResolver.java#L356).\r\n\r\nAfter more investigation, I think I identified the issue: I am using a resolver with tsig with algorithm `HMAC_SHA384`, and the calculation that is made in [TSIG.recordLength()](https://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/TSIG.java#L761) is wrong. More specifically, it considers a MAC size of 16 bytes. While this is true for MD5, it doesn't work for other algorithms such as `HMAC_SHA384`, where the hash is greater in length.\r\n\r\nThis is a small repro (in Kotlin) showing the generated message is higher than the allowed DNS message size of 65535:\r\n\r\n```kotlin\r\nimport org.xbill.DNS.DClass\r\nimport org.xbill.DNS.Message\r\nimport org.xbill.DNS.Name\r\nimport org.xbill.DNS.SimpleResolver\r\nimport org.xbill.DNS.TSIG\r\nimport org.xbill.DNS.TXTRecord\r\nimport org.xbill.DNS.Update\r\nimport org.xbill.DNS.io.IoClientFactory\r\nimport org.xbill.DNS.io.TcpIoClient\r\nimport org.xbill.DNS.io.UdpIoClient\r\nimport java.util.concurrent.CompletableFuture\r\n\r\n\r\nfun main() {\r\n    val update = Update(Name.fromConstantString(\"zone.example.com.\"))\r\n\r\n    repeat(2000) { i -\u003e\r\n        val record = TXTRecord(\r\n            Name.fromConstantString(\"name-$i.zone.example.com.\"),\r\n            DClass.IN,\r\n            900,\r\n            \"a\",\r\n        )\r\n        update.absent(record.name, record.type)\r\n        update.add(record)\r\n    }\r\n\r\n    val resolver = SimpleResolver().apply {\r\n        tsigKey = TSIG(TSIG.HMAC_SHA384, \"zone.example.com.\", \"c2VjcmU=\")\r\n        ioClientFactory = object : IoClientFactory {\r\n            override fun createOrGetTcpClient(): TcpIoClient {\r\n                return TcpIoClient { local, remote, query, data, timeout -\u003e\r\n                    println(\"Sending data of length: ${data.size}\")\r\n                    println(\"Is data \u003e max message size (${Message.MAXLENGTH})? ${data.size \u003e Message.MAXLENGTH}\")\r\n                    CompletableFuture.failedFuture(Exception())\r\n                }\r\n            }\r\n\r\n            override fun createOrGetUdpClient(): UdpIoClient {\r\n                TODO(\"Not yet implemented\")\r\n            }\r\n        }\r\n    }\r\n\r\n    resolver.send(update)\r\n}\r\n``` \r\n\r\nThis outputs:\r\n```\r\nSending data of length: 65544\r\nIs data \u003e max message size (65535)? true\r\n```\r\n\r\nThe FORMERR we got is because the data of 65544 bytes exceeds what can be stored in two bytes so [this computation](https://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/NioTcpClient.java#L101,L102) rolls over, so the message gets truncated at a random point and cannot be interpreted by the receiver.\r\n\r\n---\r\n\r\nI believe an easy fix for this would be to either give more slack in the calculation and put the max of all supported algorithms, or put the correct number based on the algorithm used.","author":{"url":"https://github.com/MMauro94","@type":"Person","name":"MMauro94"},"datePublished":"2024-12-05T17:10:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/355/dnsjava/issues/355"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b380fbdf-3bc5-9bb6-39ff-bf0a4cc7da32
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA6BC:3DC8AB:124E813:18EEFBE:69700542
html-safe-nonce40b0025de9aee46086718065da9a005f13bd95d7a1a1ab031bfd73a69b7b9248
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkJDOjNEQzhBQjoxMjRFODEzOjE4RUVGQkU6Njk3MDA1NDIiLCJ2aXNpdG9yX2lkIjoiMzYyMDM0MjY1ODQzODc5MjUxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace9fb2fa5783e5399ed0935984596fd5b2a1e1037a295661855f6e212ee860fc1
hovercard-subject-tagissue:2720973617
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/dnsjava/dnsjava/355/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e63a3877c517af2e475f39ee750ec0d56c2abeb3f550ea505609f880502bf594/dnsjava/dnsjava/issues/355
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e63a3877c517af2e475f39ee750ec0d56c2abeb3f550ea505609f880502bf594/dnsjava/dnsjava/issues/355
og:image:altHello! So I was investigating a failed update to a BIND nameserver that returned FORMERR. Looking with the debugger, I've noticed that the generated wire format was > 65535 here. After more investi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameMMauro94
hostnamegithub.com
expected-hostnamegithub.com
None0366807b865cee6776368231232f84d6c8096e6bce43f701a4fb28ea795ec427
turbo-cache-controlno-preview
go-importgithub.com/dnsjava/dnsjava git https://github.com/dnsjava/dnsjava.git
octolytics-dimension-user_id6755615
octolytics-dimension-user_logindnsjava
octolytics-dimension-repository_id17084567
octolytics-dimension-repository_nwodnsjava/dnsjava
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id17084567
octolytics-dimension-repository_network_root_nwodnsjava/dnsjava
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release33f356bb2fb58726ccb2f26395bf8ddc9a2d9eaa
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/dnsjava/dnsjava/issues/355#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdnsjava%2Fdnsjava%2Fissues%2F355
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2Fdnsjava%2Fdnsjava%2Fissues%2F355
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=dnsjava%2Fdnsjava
Reloadhttps://github.com/dnsjava/dnsjava/issues/355
Reloadhttps://github.com/dnsjava/dnsjava/issues/355
Reloadhttps://github.com/dnsjava/dnsjava/issues/355
dnsjava https://github.com/dnsjava
dnsjavahttps://github.com/dnsjava/dnsjava
Notifications https://github.com/login?return_to=%2Fdnsjava%2Fdnsjava
Fork 259 https://github.com/login?return_to=%2Fdnsjava%2Fdnsjava
Star 1.1k https://github.com/login?return_to=%2Fdnsjava%2Fdnsjava
Code https://github.com/dnsjava/dnsjava
Issues 13 https://github.com/dnsjava/dnsjava/issues
Pull requests 2 https://github.com/dnsjava/dnsjava/pulls
Actions https://github.com/dnsjava/dnsjava/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/dnsjava/dnsjava/security
Please reload this pagehttps://github.com/dnsjava/dnsjava/issues/355
Insights https://github.com/dnsjava/dnsjava/pulse
Code https://github.com/dnsjava/dnsjava
Issues https://github.com/dnsjava/dnsjava/issues
Pull requests https://github.com/dnsjava/dnsjava/pulls
Actions https://github.com/dnsjava/dnsjava/actions
Security https://github.com/dnsjava/dnsjava/security
Insights https://github.com/dnsjava/dnsjava/pulse
New issuehttps://github.com/login?return_to=https://github.com/dnsjava/dnsjava/issues/355
New issuehttps://github.com/login?return_to=https://github.com/dnsjava/dnsjava/issues/355
Message.toWire(Message.MAXLENGTH) can generate byte[] > Message.MAXLENGTHhttps://github.com/dnsjava/dnsjava/issues/355#top
https://github.com/ibauersachs
bughttps://github.com/dnsjava/dnsjava/issues?q=state%3Aopen%20label%3A%22bug%22
v3.6.3https://github.com/dnsjava/dnsjava/milestone/20
https://github.com/MMauro94
https://github.com/MMauro94
MMauro94https://github.com/MMauro94
on Dec 5, 2024https://github.com/dnsjava/dnsjava/issues/355#issue-2720973617
herehttps://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/SimpleResolver.java#L356
TSIG.recordLength()https://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/TSIG.java#L761
this computationhttps://github.com/dnsjava/dnsjava/blob/master/src/main/java/org/xbill/DNS/NioTcpClient.java#L101,L102
ibauersachshttps://github.com/ibauersachs
bughttps://github.com/dnsjava/dnsjava/issues?q=state%3Aopen%20label%3A%22bug%22
v3.6.3https://github.com/dnsjava/dnsjava/milestone/20
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.