Skip to content

Updates the authorization model for batches and adds support for non-authorized, small batches#1406

Open
matsduf wants to merge 28 commits into
zonemaster:developfrom
matsduf:update-batch-auth
Open

Updates the authorization model for batches and adds support for non-authorized, small batches#1406
matsduf wants to merge 28 commits into
zonemaster:developfrom
matsduf:update-batch-auth

Conversation

@matsduf

@matsduf matsduf commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Purpose

This PR, firstly, moves away from authorization of batch creation by using username/password created through RPC API to using a token configured in the configuration file. Secondly, is supports the creation of small batches without authorization. In the latter case using undelegated data etc will not be supported.

When small batches without authorization can be created, that function is to be added to GUI.

  • Updates configuration/backend.md:
    • Updates table of contents
    • Deprecates "enable_add_batch_job"
    • Deprecates "enable_add_api_user"
    • Redefines "enable_batch_create" to replace "enable_add_batch_job"
    • Defines "enable_batch_create" and "enable_add_batch_job" to be conflicting.
    • Removes experimental "enable_user_create"
    • Defines "batch_api_key" for a token to authorize batch creation.
    • Defines "max_batch_size_non_auth" to set to number of domains in batches created without batch_api_key.
    • Editorial updates.
  • Updates rpcapi-reference.md
    • Updates table of contents
    • Defines data type "Batch API key"
    • Defines method "conf_max_batch_size_non_auth"
    • Deprecates methods "add_api_user" and "add_batch_job"
    • Redefines method "batch_create" to replace "add_batch_job"
    • Removes experimental "user_create"
    • Editorial updates
    • Deprecates "batch id" and introduces "hash batch id" which is the same kind of "hashed ID" as the test ID.
  • Removal of deprecated parts:
    • Parts deprecated by this PR are to be removed by release v2026.2.

When the changes in this PR are approved the following changes are to be created:

  • Updated docs/public/using/backend/Using-Zonemaster-Backend-for-batch-testing.md
  • Implement the updates in Backend.

Context

How to test this PR

Review the changes.

The purpose of the update is, firstly, to move away from authorization
of batch creation by using username/password created through RPC API
to using a token configured in the configuration file. Secondly, to
support the creation of small batches without authorization. In the
latter case using undelated data etc will not be supported.

* Updates configuration/backend.md:
  * Updates table of contents
  * Deprecates "enable_add_batch_job"
  * Deprecates "enable_add_api_user"
  * Redefines "enable_batch_create" to replace "enable_add_batch_job"
  * Defines "enable_batch_create" and "enable_add_batch_job" to be
    conflicting.
  * Removes experimental "enable_user_create"
  * Defines "batch_create_token" for a token to authorize batch creation.
  * Defines "batch_create_max_length_non_auth" to set to number of
    domains in batches created without token.
  * Editorial updates.
* Updates rpcapi-reference.md
  * Updates table of contents
  * Defines data type "Token"
  * Defines method "conf_batch_create_max_size_non_auth"
  * Deprecates methods "add_api_user" and "add_batch_job"
  * Redefines method "batch_create" to replace "add_batch_job"
  * Removes experimental "user_create"
  * Editorial updates
@matsduf matsduf added this to the v2025.2 milestone Jul 11, 2025
@matsduf matsduf added T-Feature Type: New feature in software or test case description A-Documentation Area: Documentation only. labels Jul 11, 2025
@matsduf matsduf force-pushed the update-batch-auth branch from 9231d6e to 1bf0947 Compare July 14, 2025 10:02
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
@matsduf matsduf requested a review from marc-vanderwal August 10, 2025 14:17
@matsduf matsduf added the RC-Features Release category: Features. label Aug 10, 2025
marc-vanderwal
marc-vanderwal previously approved these changes Aug 11, 2025
@matsduf

matsduf commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

Renames some methods and keys. No change of logic.

@matsduf matsduf requested review from marc-vanderwal and mattias-p and removed request for mattias-p September 4, 2025 21:34
Comment thread docs/public/configuration/backend.md Outdated
Comment thread docs/public/configuration/backend.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
matsduf and others added 2 commits September 8, 2025 19:51
Co-authored-by: Mattias Päivärinta <mattias@paivarinta.se>
Co-authored-by: Mattias Päivärinta <mattias@paivarinta.se>
matsduf and others added 2 commits October 27, 2025 17:31
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
@matsduf matsduf modified the milestones: v2025.2, v2026.1 Nov 13, 2025
Comment thread docs/public/configuration/backend.md Outdated
Comment on lines +73 to +75
Multiple `batch_api_key` is supported. All configured keys will be equal in
authorization. For each key `batch_api_key` is repeated on a new line in the
configuration file with the "Batch API Key" as value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So does that mean that something like this will work?

[RPCAPI]
batch_api_key = "NotSoSecret"
batch_api_key = "NotSoSecretEither"
batch_api_key = "LikewiseNotASecret"

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.

Yes.

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.

Do think the language should be clarified? Do you think it is a good or bad idea?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it’s a good idea because it helps avoid having shared secrets between more than two components.

Yes, maybe you could add an example like the one I gave in my previous comment in the text to make the syntax clearer.

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.

@marc-vanderwal, I like examples because it helps to understand. In that file we do not have much examples, but we have several examples in the zonemaster-backend:share/config.ini file. Do you agree that it would be better to put your examples in the ini file? It will be updated in an upcoming PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it’s best to have this example both in the documentation and in the example configuration file. The syntax is a bit unorthodox because configuration keys are usually unique within a file. It should be crystal clear for users that yes, you can have multiple batch_api_key variables and that it makes all API keys work, not just the first or last one.

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.

Updated as suggested.

Comment thread docs/public/configuration/backend.md Outdated
@matsduf matsduf modified the milestones: v2026.1, v2026.2 Feb 2, 2026
@matsduf matsduf requested review from marc-vanderwal and mattias-p and removed request for mattias-p April 9, 2026 15:01
@matsduf matsduf requested review from marc-vanderwal and removed request for marc-vanderwal May 5, 2026 11:36
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated
Comment thread docs/public/using/backend/rpcapi-reference.md Outdated

### API method: `get_batch_job_result`

*Deprecated. To be removed with release v2025.2* Replaced by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
*Deprecated. To be removed with release v2025.2* Replaced by
*Deprecated. To be removed with release v2026.2* Replaced by

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.

Already removed. I have to rebase the PR.

Comment on lines +1520 to +1525
#### `"result"`

An object with the following properties:

* `"batch_id"`: A [*hash batch id*][Hash batch id].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is confusing with the example. do we get

"result": "B-c45a3f8256c4a155"

or

"result": { "batch_id": "B-c45a3f8256c4a155" }

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.

Updates the specification. It should use the same model as "start_domain_test" and "add_batch_job".

Co-authored-by: MichaelTimbert <110017095+MichaelTimbert@users.noreply.github.com>
MichaelTimbert
MichaelTimbert previously approved these changes May 20, 2026

@MichaelTimbert MichaelTimbert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Look good for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Documentation Area: Documentation only. RC-Features Release category: Features. T-Feature Type: New feature in software or test case description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants