Skip to content

client: Accept application/json as Text#537

Merged
bilelmoussaoui merged 1 commit into
linux-credentials:mainfrom
diwangs:fix-content-type
Jul 24, 2026
Merged

client: Accept application/json as Text#537
bilelmoussaoui merged 1 commit into
linux-credentials:mainfrom
diwangs:fix-content-type

Conversation

@diwangs

@diwangs diwangs commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ContentType currently does not accept application/json MIME type, which breaks apps like aws-vault.

This PR adds application/json as an acceptable Text secret (since JSON is always a valid UTF-8) and keeps the Text/Blob distinction and MIME parameter parsing intact.

Tested with aws-vault in my NixOS setup:

  • Adding secret with it no longer throws aws-vault: error: add: Invalid content type: application/json
  • Exporting secret and requesting STS token through it works normally

A more generic fix for this type of errors might be to map every unrecognized content type to Blob instead of rejecting them.

Let me know what you think!

@bilelmoussaoui

Copy link
Copy Markdown
Collaborator

Right, defaulting to blob seems sane but i kind of intentionally made it crash on early versions of the daemon to collect what mimetypes are out there in the wild so i can design the API better in the future.

@diwangs

diwangs commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Understandable. In that case, consider application/json as another data point. Do you have any comment about the PR itself?

@bilelmoussaoui

Copy link
Copy Markdown
Collaborator

Understandable. In that case, consider application/json as another data point. Do you have any comment about the PR itself?

that would require pulling serde_json, so for now let us keep it as is and we will see later.

@bilelmoussaoui
bilelmoussaoui merged commit ee9c75b into linux-credentials:main Jul 24, 2026
15 of 17 checks passed
@diwangs
diwangs deleted the fix-content-type branch July 24, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants