Feature request: Wildcard logic for token policies

Open
#1,007 8 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 14 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start by reading the token-policy implementation and its tests in the repository; the issue does not name specific files or entry points. Determine how policies match DNS subnames and whether the existing tests cover parent and wildcard records. Done means a policy can explicitly include descendants of _domainkey without granting access to unrelated TXT records, with tests demonstrating both allowed and denied writes.

Written by the indexing model from the issue text.

Description

help wanted

I would like to automate DKIM key rotation and create a suitably restricted token for this purpose, i.e. allow writing TXT records under any subname like <selector>._domainkey but nothing else. Unfortunately, token policies currently do not allow that.

Setting a policy for subname _domainkey does not allow writing to its "children".
Setting a policy for *._domainkey only allows writing the wildcard record.
Setting a policy for every selector I need in advance would work but is infeasible (DKIM selectors are commonly dates or random strings).
Setting a policy without a subname works, but obviously also allows writing unrelated TXT records (e.g. DMARC policy, SPF, site verifications, ACME and whatnot). I can block some other subnames with additional policies, but that seems error-prone.

I'd be great if token policies could be extended to have a "and children"-bit. That way I could set up a policy that allows writing to _domainkey "and children".
Given the hierarchical structure of DNS, I believe this might have sensible applications beside DKIM key rotation.

Dominant language
Python
Stars
678
Forks
74
Avg merge
7d 23h
Merged PRs (30d)
1

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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 desec-io/desec-stack

All issues in desec-io/desec-stack

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.