feat: add admin_token_hash attribute to dumpthings site-spec #5

Open
cmo wants to merge 1 commit from cmo/liab-deployments:admin-token-hash into main
First-time contributor

This PR adds the per-site attribute admin_token_hash to the dumpthings specification. The attribute is optional.
If provided, it should be a valid token hash; currently, this is a hex-encoded SHA-256 hash (64 digits) of the plain-text admin token. A valid token hash can be created with dump-things-hash-token <plain-text-token> (using the same version of dump-things-service).

For example, the following command would create the token hash for the token my-admin-token (DO NOT use this token hash in production systems because it is public now):

> dump-things-hash-token my-admin-token
05a6853495d2e60541027074d6bf7f11f13f266060d3817e131c4bd77d43f84f

This token hash could be added to a dumpthings-spec as follows:

...

{
    'dumpthings': {
        'sites': [
            {
                'serve_address': '127.0.0.1',
                'config_file_asset': 'assets/example_config.yaml',
                'user': ('test-user', 9999),
                'host_port': 8088,
                'collections': [
                    ('public', None),
                ],
                'admin_token_hash': '05a6853495d2e60541027074d6bf7f11f13f266060d3817e131c4bd77d43f84f',
            },
        ],
    },
},

...

For security reasons, there is currently no support for storing plain-text admin tokens in the configuration.

This PR adds the per-site attribute `admin_token_hash` to the `dumpthings` specification. The attribute is optional. If provided, it should be a valid token hash; currently, this is a hex-encoded SHA-256 hash (64 digits) of the plain-text admin token. A valid token hash can be created with `dump-things-hash-token <plain-text-token>` (using the same version of dump-things-service). For example, the following command would create the token hash for the token `my-admin-token` (DO NOT use this token hash in production systems because it is public now): ```bash > dump-things-hash-token my-admin-token 05a6853495d2e60541027074d6bf7f11f13f266060d3817e131c4bd77d43f84f ``` This token hash could be added to a dumpthings-spec as follows: ```python ... { 'dumpthings': { 'sites': [ { 'serve_address': '127.0.0.1', 'config_file_asset': 'assets/example_config.yaml', 'user': ('test-user', 9999), 'host_port': 8088, 'collections': [ ('public', None), ], 'admin_token_hash': '05a6853495d2e60541027074d6bf7f11f13f266060d3817e131c4bd77d43f84f', }, ], }, }, ... ``` For security reasons, there is currently no support for storing plain-text admin tokens in the configuration.
feat: add admin_token_hash attribute to dumpthings spec
All checks were successful
Codespell / Check for spelling errors (pull_request) Successful in 18s
b64fe72a44
This commit adds the attribute `admin_token_hash` to
the `dumpthings` specification. The attribute is optional.
If provided it should be a valid token-hash, currently
this is a hex-encoded sha256 hash (64 digits) of the plain
text admin token.

For security reasons, there is currently no support to store
plain text admin tokens in the configuration.
cmo changed title from feat: add admin_token_hash attribute to dumpthings spec to feat: add admin_token_hash attribute to dumpthings site-spec 2026-07-31 13:06:25 +00:00
All checks were successful
Codespell / Check for spelling errors (pull_request) Successful in 18s
This pull request has changes conflicting with the target branch.
  • liab_deployments/deploy/dumpthings.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'admin-token-hash:cmo-admin-token-hash'
git switch 'cmo-admin-token-hash'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'cmo-admin-token-hash'
git switch 'cmo-admin-token-hash'
git rebase 'main'
git switch 'main'
git merge --ff-only 'cmo-admin-token-hash'
git switch 'cmo-admin-token-hash'
git rebase 'main'
git switch 'main'
git merge --no-ff 'cmo-admin-token-hash'
git switch 'main'
git merge --squash 'cmo-admin-token-hash'
git switch 'main'
git merge --ff-only 'cmo-admin-token-hash'
git switch 'main'
git merge 'cmo-admin-token-hash'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab-in-a-box/liab-deployments!5
No description provided.