Skip to content

Add Developer Agreement API - #25418

Draft
chrstinalin wants to merge 1 commit into
mozilla:masterfrom
chrstinalin:#16377-dev-agreement
Draft

Add Developer Agreement API#25418
chrstinalin wants to merge 1 commit into
mozilla:masterfrom
chrstinalin:#16377-dev-agreement

Conversation

@chrstinalin

@chrstinalin chrstinalin commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes mozilla/addons#16377

Description

Adds developer agreement API.

Testing

At endpoint api/v5/developers/agreement --

  • Can GET to retrieve last_developer_agreement_change. Returns 200.
  • Can POST with display_name and last_developer_agreement_change to accept, if a) agreement was updated since the previous accept, or b) have not yet accepted before. Returns 202.
  • Otherwise returns a 400.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add or update relevant docs reflecting the changes made.

@diox

diox commented Sep 10, 2026

Copy link
Copy Markdown
Member

I think we'll want two three things here:

  • Something to prevent users from scripting their way around the agreement too easily. Maybe a simple GET API (requiring auth) to retrieve the date the agreement last changed (see implementation for has_read_developer_agreement()) and force them to pass that exact value via POST ?
  • Rate limiting (on both endpoints if going that route)
  • Checking RestrictionChecker(request=request).is_submission_allowed() and returning a 400 with the error message if the user is not allowed to submit, like render_agreement() currently does

@chrstinalin
chrstinalin marked this pull request as draft September 10, 2026 12:07
@chrstinalin
chrstinalin force-pushed the #16377-dev-agreement branch 6 times, most recently from bff56f5 to e284efe Compare September 10, 2026 18:13
@chrstinalin
chrstinalin requested review from a team and nothingrandom and removed request for a team September 10, 2026 18:16
@chrstinalin
chrstinalin marked this pull request as ready for review September 10, 2026 18:16
Comment on lines +17 to +25
.. http:post:: /api/v5/developers/agreement

:>json string display_name: User's chosen display name.
:>json string last_developer_agreement_change: The date of the last agreement change.

.. http:get:: /api/v5/developers/agreement

Returns the date of the last agreement change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this feedback is targeted more towards the ticket itself than this work, but this doesn't match what I had in mind (and again, we should have fleshed this out better - one for a team retro imo).

Feel free to turn this into a proper discussion, I might have misunderstood things.

My expectations (these are just examples, I haven't validated these are real);

http:post::
  :>json string user_uuid: something unique to identify the user with
  :>json string accepted_agreement_version: version of the developer agreement accepted (or YYYY-MM-DD)
  server inferred; UTC date developer agreement accepted

http:get:: (should be public, not internal only per ticket comment from @diox)
  :>query/parameter:>json string user_uuid
  :>returns: is_latest_accepted: boolean
  :>returns: agreement_version: version of the developer agreement  (or YYYY-MM-DD)
  :>optional return (as in I'm questioning the value of this): agreement_content: markdown content of the latest developer agreement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should be public, not internal only

Right now it (and the other API work I've done so far) are generally exclusively using SessionIDAuthentication, i.e. 'internal use'. Making it external is mainly adding JWT auth. Is that more in line with what would be needed? In which case I'd need to update those endpoints as well.

See: #25374 (comment)

@chrstinalin
chrstinalin marked this pull request as draft September 11, 2026 18:25
@chrstinalin
chrstinalin force-pushed the #16377-dev-agreement branch 2 times, most recently from dbdc51d to 5767296 Compare September 11, 2026 20:22
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.

[Task]: Add API for developer agreement

3 participants