Safari breaks with TypeError when authenticatorAttachment is null

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
documentation

Research direction

Read the authenticator registration page, especially its creation request section. The original thread says the serializer context option AbstractObjectNormalizer::SKIP_NULL_VALUES => true already solves the issue and that the option needs clearer documentation. Done means the relevant documentation explains this option to users who serialize options with the library.

Written by the indexing model from the issue text.

Description

When setting AUTHENTICATOR_ATTACHMENT_NO_PREFERENCE authenticatorAttachment becomes null in the serialized output. Safari breaks with a TypeError if this happens. authenticatorAttachment should instead be removed from the output, null is not a valid value, according to Safari.


From the original thread

Spomky — 2025-01-08

Hi @tomsommer,

Do you use the Symfony Bundle with custom option handlers or the library?
Normally, null values are not in the serialized options. See DefaultCreationOptionsHandler.php#L29 or DefaultRequestOptionsHandler.php#L29

tomsommer — 2025-01-08

I don't use any bundle, I just do
(new WebauthnSerializerFactory(AttestationStatementSupportManager::create()))->create()->serialize(.... ,'json')

Spomky — 2025-01-08

OK, then can you try using the context options:

use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;

(new WebauthnSerializerFactory(AttestationStatementSupportManager::create()))->create()->serialize(.... ,'json', [AbstractObjectNormalizer::SKIP_NULL_VALUES => true])

tomsommer — 2025-01-08

This solves it. I would suggest this be the default then, since it will not produce valid output otherwise :)

Or at least note it somewhere in the docs, so other people won't hit the same issue.

Spomky — 2025-01-08

👍Perfect. Many thanks for the confirmation.
This context argument is used in the documentation, but not highlighted as it should be.
I move this issue to the doc repository and will update some pages.


Copied from web-auth/doc#34, opened by @tomsommer on 2025-01-08. The documentations of Slabs now share one site and one repository, and the former one is being retired — nothing was lost, and this is where the thread continues.

Dominant language
Python
Stars
0
Forks
0
Avg merge
34m
Merged PRs (30d)
40

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Spomky-Labs/docs

All issues in Spomky-Labs/docs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.