Skip to content

List Translator and Language Detector APIs restricted to secure contexts #40307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 13, 2025

Conversation

michaelwasserman
Copy link
Contributor

Description

List Translator and Language Detector APIs restricted to secure contexts

Motivation

Match the Spec:
https://webmachinelearning.github.io/translation-api/#translator-api
https://webmachinelearning.github.io/translation-api/#language-detector-api

Additional details

Perhaps the API docs should also be updated?
https://developer.mozilla.org/en-US/docs/Web/API/Translator_and_Language_Detector_APIs

Related issues and pull requests

Reported via Chromium issue:
https://issues.chromium.org/u/1/issues/428561254

@michaelwasserman michaelwasserman requested a review from a team as a code owner July 10, 2025 17:57
@michaelwasserman michaelwasserman requested review from hamishwillee and removed request for a team July 10, 2025 17:57
@github-actions github-actions bot added Content:Security Security docs size/xs [PR only] 0-5 LoC changed labels Jul 10, 2025
michaelwasserman and others added 2 commits July 10, 2025 10:59
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@michaelwasserman
Copy link
Contributor Author

FYI @chrisdavidmills and @tomayac

Copy link
Contributor

github-actions bot commented Jul 11, 2025

Preview URLs (37 pages)

(comment last updated: 2025-07-11 05:14:26)

@hamishwillee hamishwillee requested a review from a team as a code owner July 11, 2025 01:03
@hamishwillee hamishwillee requested review from wbamberg and removed request for a team July 11, 2025 01:03
@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Jul 11, 2025
@hamishwillee
Copy link
Collaborator

@michaelwasserman Thankyou for this. A bit more had to be done, which was adding the secure context headers. I've added to overview page, properties, methods.

  1. It wasn't clear to me if the destroy() methods need secure context. If they don't, you could drop the last commit in which they were added (separately)
  2. Is there anything missing? (Can you sanity check?)
  3. Some of the methods already had secure context. That makes me worry that perhaps the specification changed since this was implemented, and perhaps there are versions in which secure context only applies to some things and not others. Can you confirm that this is not the case? [if it is, we need to add information to the browser compatibility data as well]

Copy link
Contributor

@tomayac tomayac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a non-owner

@michaelwasserman
Copy link
Contributor Author

Thanks for the additional fixes! Everything lgtm, responses:

  1. It wasn't clear to me if the destroy() methods need secure context. If they don't, you could drop the last commit in which they were added (separately)

AFAIK, the entire interface and everything therein is SecureContext in spec and impl.

  1. Is there anything missing? (Can you sanity check?)

I did a pass over the live pages and changes. This looks complete, thank you!

  1. Some of the methods already had secure context. That makes me worry that perhaps the specification changed since this was implemented, and perhaps there are versions in which secure context only applies to some things and not others. Can you confirm that this is not the case? [if it is, we need to add information to the browser compatibility data as well]

This seems to be a documentation discrepancy, the interfaces themselves have been SecureContext from initial spec work, and before Chrome origin trials and launches.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelwasserman @tomayac Thanks both of you for confirmations and for reporting. This is good to go!

@hamishwillee hamishwillee merged commit aed5660 into mdn:main Jul 13, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Security Security docs Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants