[bug] NodeInfo Content-Type parameters missing quotes #852

Closed
opened 2024-11-19 04:51:08 +00:00 by Steffo · 3 comments

Your setup

Docker

Extra details

No response

Version

fork based on c0a99df06a

PostgreSQL version

No response

What were you trying to do?

Get the NodeInfo document of my Akkoma instance to process it via a Rust program.

What did you expect to happen?

The content type to be the same defined in the protocol:

Content-Type: application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"

What actually happened?

The content type was:

Content-Type: application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#

Notice the missing quotes, which were causing header value validation issues when passed to the mediatype Rust crate:

-Content-Type: application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#; charset=utf-8
+Content-Type: application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"; charset=utf-8

Logs

No response

Severity

I can manage

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup Docker ### Extra details _No response_ ### Version fork based on c0a99df06a924e44d56d957c05af83f94cba16d3 ### PostgreSQL version _No response_ ### What were you trying to do? Get the NodeInfo document of my Akkoma instance to process it via a Rust program. ### What did you expect to happen? The content type to be the same defined [in the protocol](https://nodeinfo.diaspora.software/protocol.html): ``` Content-Type: application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#" ``` ### What actually happened? The content type was: ``` Content-Type: application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1# ``` Notice the missing quotes, which were causing header value validation issues when passed to the [mediatype Rust crate](https://docs.rs/crate/mediatype/latest): ```diff -Content-Type: application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#; charset=utf-8 +Content-Type: application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"; charset=utf-8 ``` ### Logs _No response_ ### Severity I can manage ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
Steffo added the
bug
label 2024-11-19 04:51:08 +00:00
Author

I deployed a temporary fix on my instance on my Caddy reverse proxy:

junimo.party {
    # ...
    header "/nodeinfo/2.0.json" "Content-Type" `application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"; charset=utf-8`
    header "/nodeinfo/2.1.json" "Content-Type" `application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"; charset=utf-8`
    # ...
}
I deployed a temporary fix on my instance on my Caddy reverse proxy: ```Caddyfile junimo.party { # ... header "/nodeinfo/2.0.json" "Content-Type" `application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"; charset=utf-8` header "/nodeinfo/2.1.json" "Content-Type" `application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"; charset=utf-8` # ... } ```
Oneric referenced this issue from a commit 2024-11-19 18:26:15 +00:00
Member

fork based on c0a99df06a

Thanks for reporting! But while it worked out fine here, please be more specific about which custom patches you’re using in the future. In particular upstream Akkoma currently returns a 2.0 Content-Type for bothe versions of NodeInfo while your patched version seems to have already changed something about this since it reportedly returns 2.1.

Fixed the version and missing quotes in #853

Btw, if you want to keep your program portable: IceShrimp.NET and Mastodon appear to not set the profile content-type parameter at all atm (Misskey does with correct version and quotation)

> fork based on c0a99df06a Thanks for reporting! But while it worked out fine here, please be more specific about which custom patches you’re using in the future. In particular upstream Akkoma currently returns a `2.0` Content-Type for bothe versions of NodeInfo while your patched version seems to have already changed something about this since it reportedly returns `2.1`. Fixed the version and missing quotes in #853 Btw, if you want to keep your program portable: IceShrimp.NET and Mastodon appear to not set the `profile` content-type parameter at all atm (Misskey does with correct version and quotation)
Author

please be more specific about which custom patches you’re using in the future

oh, i'm very sorry, my patches don't touch the Content-Type at all, so, since I made this issue while about to fall asleep, it's much more likely that I made a mess while writing the issue and copying the string from the debug output 😭

Fixed the version and missing quotes in #853

thank you for the super fast follow-up! :)

Btw, if you want to keep your program portable: IceShrimp.NET and Mastodon appear to not set the profile content-type parameter at all atm (Misskey does with correct version and quotation)

that's handled in my program, it was just the missing quotes combined with the slashes in the value that were apparently breaking mediatype's parameter parsing!

not having read the media type RFC i have no idea if the issue was on Akkoma's or mediatype's side, but having it be the same as specified solves the issue regardless :)


again, thank you!

> please be more specific about which custom patches you’re using in the future oh, i'm very sorry, my patches don't touch the Content-Type at all, so, since I made this issue while about to fall asleep, it's much more likely that I made a mess while writing the issue and copying the string from the debug output 😭 > Fixed the version and missing quotes in #853 thank you for the super fast follow-up! :) > Btw, if you want to keep your program portable: IceShrimp.NET and Mastodon appear to not set the profile content-type parameter at all atm (Misskey does with correct version and quotation) that's handled in my program, it was just the missing quotes combined with the slashes in the value that were apparently breaking [mediatype's parameter parsing](https://docs.rs/mediatype/latest/mediatype/struct.Params.html)! not having read the media type RFC i have no idea if the issue was on Akkoma's or mediatype's side, but having it be the same as specified solves the issue regardless :) --- again, thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#852
No description provided.