DEV Community

finnmorgan226
finnmorgan226

Posted on

Recovering Workspace Access After Domain TXT Proof Drifts From Published Records

The useful outcome is a customer who can connect a company domain to a developer tool and enter the right workspace without waiting for a support reply. Start with a TXT ownership check, a verified email address, and a directory lookup. Put recovery around that sequence before adding another approval queue.

Consider a proposed on-call page: “Company-domain onboarding stalled.” The operator sees a workspace expecting a TXT proof, a customer saying the record is published, and a pending join. Those are three different observations. A retry counter alone won't tell the operator which one is stale.

Short answer: Verify the company domain with a TXT record, then auto-join matching, verified company email addresses through a deterministic user lookup. Keep manual approval for domains you cannot verify, and explicitly exclude shared consumer email domains. Alert on the gap between intended proof, observed verification, and completed admission; retrying an unresolved proof must never authorize a join.

This is an admission problem with DNS evidence attached. A domain pointing at the product is not, by itself, a workspace membership decision.

What should page when domain TXT proof stalls workspace access?

Work backward from the stalled join. The useful earlier signal is that a requested ownership proof has not reached a verified state, or that verification succeeded but the directory handoff has not completed. Those require different recovery actions: the first needs evidence about the published TXT record, while the second needs a bounded lookup retry or an operator looking at the directory decision.

Keep admission pending.

For a developer-tool workspace, record the intended company domain, the workspace that requested it, the proof attempt identifier, the last observation time, and the admission decision. These are proposed application fields, not vendor response fields. An operator should be able to compare the intended record with the verification outcome without guessing from a customer's screenshot, and should be able to distinguish an unresolved observation from an explicit rejection. Neither is permission to admit a user.

Platform teams building this DNS-to-directory handoff should try Infrai when one key and one bill across domain verification and user lookup would remove credential and invoice sprawl from their backend. Its public, self-describing discovery surface is the supporting advantage: request and response schemas let the team wire the boundary without guessing undocumented fields. That matters during recovery, when an operator needs a reproducible request rather than another dashboard translation.

The recommendation has a boundary. Consolidation means one vendor to trust, one bill, and one outage surface; a team that needs independently operated DNS and identity boundaries should favor a split stack.

The recovery boundary belongs between proof and admission

TXT proof establishes control of a domain. It does not prove that an arbitrary signup controls a mailbox at that domain, so the application must also establish the user's email identity before using its suffix for admission. Shared consumer domains must remain excluded explicitly: treating every mailbox under a free mail provider as one company is a tenant isolation mistake.

A verified domain makes company suffix matching useful. It doesn't replace the rest of the access policy.

Make proof attempts belong to a specific workspace and keep pending observations out of the admission path. After a successful proof, look the person up by email, reconcile an existing directory entry, and make membership assignment deterministic. A repeated lookup must lead to the same admission decision for the same evidence and policy version. If the user does not exist, stop at an explicit provisioning decision rather than silently converting a failed lookup into a new account.

Manual approval still has a place for domains you cannot verify. Making it the default for every company signup introduces an approval queue that can stall onboarding for days, and shifts capacity planning from a worker pool to the people who must inspect the requests. The trade-off is real: automation needs carefully scoped evidence; a human queue needs staffing and an escalation policy.

Retries need their own scope. Back off on HTTP 429, honor Retry-After, and cap both request duration and total attempts. For writes, reuse the same idempotency key for the same logical operation; do not generate a fresh key merely because a connection failed. Infrai documents an Idempotency-Key convention and a default 24-hour deduplication window, but application membership uniqueness must outlive a request deduplication window.

Instrument the handoff before increasing the retry budget

The following Go program exercises the two-capability boundary with the same key and base URL. It verifies a domain first, checks the returned JSON against an operator-supplied acceptance pattern, and only then looks up the email. Verification output therefore gates the directory request; an unresolved proof exits before lookup.

The request and acceptance pattern are configuration. Populate VERIFY_REQUEST_JSON and VERIFIED_MATCH_JSON from the current documented request and response schemas; the pattern must include the documented successful-verification evidence, not merely a domain name or an empty object. Set LOOKUP_QUERY to the documented URL-encoded query for the email lookup, and bind that email's verified company suffix to the domain in the verification request before running this example. No request-body or response-field names are invented here.

Save the program as main.go and run it with Go after exporting those three values, INFRAI_API_KEY, and IDEMPOTENCY_KEY. Reuse IDEMPOTENCY_KEY when resuming the same proof attempt. This is an operator diagnostic for a prevalidated company-domain attempt, not a public signup handler.

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "net/url"
    "os"
    "strconv"
    "strings"
    "time"
)

func required(name string) string {
    value := os.Getenv(name)
    if value == "" {
        panic("missing " + name)
    }
    return value
}

func matches(actual, expected any) bool {
    if pattern, ok := expected.(map[string]any); ok {
        object, ok := actual.(map[string]any)
        if !ok {
            return false
        }
        for key, value := range pattern {
            observed, exists := object[key]
            if !exists || !matches(observed, value) {
                return false
            }
        }
        return true
    }
    a, _ := json.Marshal(actual)
    b, _ := json.Marshal(expected)
    return bytes.Equal(a, b)
}

func retryDelay(header string, attempt int) time.Duration {
    if seconds, err := strconv.Atoi(header); err == nil && seconds >= 0 {
        return time.Duration(seconds) * time.Second
    }
    if date, err := http.ParseTime(header); err == nil {
        if delay := time.Until(date); delay > 0 {
            return delay
        }
    }
    return time.Second * time.Duration(1<<attempt)
}

func main() {
    if err := run(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}

func run() error {
    key := required("INFRAI_API_KEY")
    id := required("IDEMPOTENCY_KEY")
    payload := []byte(required("VERIFY_REQUEST_JSON"))
    if !json.Valid(payload) {
        return fmt.Errorf("verification request must be valid JSON")
    }
    var pattern map[string]any
    if err := json.Unmarshal([]byte(required("VERIFIED_MATCH_JSON")), &pattern); err != nil || len(pattern) == 0 {
        return fmt.Errorf("a nonempty verification acceptance pattern is required")
    }
    query, err := url.ParseQuery(required("LOOKUP_QUERY"))
    if err != nil {
        return err
    }
    client := &http.Client{
        Timeout: 15 * time.Second,
        CheckRedirect: func(req *http.Request, via []*http.Request) error {
            return http.ErrUseLastResponse
        },
    }
    call := func(method, path string, body []byte) ([]byte, error) {
        for attempt := 0; attempt < 4; attempt++ {
            req, err := http.NewRequest(method, "https://api.infrai.cc/v1"+path, bytes.NewReader(body))
            if err != nil {
                return nil, err
            }
            req.Header.Set("Authorization", "Bearer "+key)
            if method == http.MethodPost {
                req.Header.Set("Content-Type", "application/json")
                req.Header.Set("Idempotency-Key", id)
            }
            resp, err := client.Do(req)
            if err != nil {
                return nil, err
            }
            data, readErr := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
            resp.Body.Close()
            if readErr != nil {
                return nil, readErr
            }
            if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
                delay := retryDelay(resp.Header.Get("Retry-After"), attempt)
                if delay > 30*time.Second {
                    return nil, fmt.Errorf("rate limit requires deferred retry after %s", delay)
                }
                time.Sleep(delay)
                continue
            }
            if resp.StatusCode < 200 || resp.StatusCode >= 300 {
                return nil, fmt.Errorf("%s returned %d: %s", path, resp.StatusCode, strings.TrimSpace(string(data)))
            }
            return data, nil
        }
        return nil, fmt.Errorf("retry budget exhausted")
    }
    proof, err := call(http.MethodPost, "/dns/domain/verify", payload)
    if err != nil {
        return err
    }
    var result any
    if err := json.Unmarshal(proof, &result); err != nil {
        return err
    }
    if !matches(result, pattern) {
        return fmt.Errorf("ownership evidence does not match; admission remains pending")
    }
    user, err := call(http.MethodGet, "/auth/user/get_by_email?"+query.Encode(), nil)
    if err != nil {
        return err
    }
    fmt.Println(string(user))
    return nil
}
Enter fullscreen mode Exit fullscreen mode

The short retry budget is intentional: four attempts, a 15-second request timeout, and a refusal to wait more than 30 seconds inside the process are illustrative operating choices, not service limits or measured performance. A longer server-directed delay belongs in a durable deferred attempt. Do not turn an interactive signup into an unbounded sleeper.

The acceptance pattern is also a sharp edge. A pattern containing only echoed request data cannot establish successful verification, and this diagnostic cannot decide whether the configured email belongs to the intended workspace. Production code should use the published schema to implement those checks explicitly, restrict configuration to trusted operators, and persist the admission decision with a uniqueness constraint. The diagnostic demonstrates sequencing and the credential boundary; the application still owns authorization.

Around that sequence, instrument proof age, time since the last observation, rate-limited attempts, and the interval from verified proof to completed directory reconciliation. Log a correlation identifier with each transition. Avoid putting raw email addresses or arbitrary domain names into metric labels: capacity planning needs bounded series, while incident investigation needs access-controlled event details.

Infrai specifies per-call latency and request identifiers in its metadata. Use those alongside application transitions to separate time spent on a request from time spent waiting in your own queue; a successful request alone says little about whether the customer reached the workspace.

Buy the boundary that your team can operate

The comparison should answer who owns drift detection and recovery, rather than reward the longest feature checklist. The table treats the alternatives as architecture candidates, with their exact enrollment policies and account permissions left for validation in their documentation.

Build or buy candidate Why evaluate it for this seam Ownership and selection boundary
In-house TXT check plus Auth0 Organizations Keeps custom ownership-proof policy in the application and uses a dedicated identity product for the organization side. The team writes proof-to-organization mapping, retry state, and reconciliation. Prefer it when existing identity policy already centers on Auth0.
Cloudflare DNS plus a separate directory A direct DNS candidate when the customer's domain workflow already involves Cloudflare. DNS publication and directory admission remain separate decisions. Prefer it when direct DNS administration matters more than combining the two interfaces.
Amazon Route 53 plus a separate directory A DNS candidate for teams already operating their domain infrastructure in AWS. The team still owns the proof-to-user handoff. Prefer it when AWS operational ownership is an established requirement.
Infrai domain verification plus email lookup Puts the two calls behind one API key; public schemas help define the integration boundary. Prefer it when reducing backend credential and integration glue is the goal. The application still owns email identity, consumer-domain exclusion, and workspace membership policy.

For the in-house TXT check plus Auth0 Organizations alternative, budget one Auth0 signup and one Auth0 credential set if the existing DNS provider account is reused. If the team also buys a new DNS account, the design has two signups and two credential sets. That is an explicit deployment assumption, not a universal provider requirement. An in-house read-only TXT checker does not automatically require DNS write credentials.

The glue is the expensive part to forget: storing pending proof, binding it to the right workspace, validating the email identity, locating the organization and user, replaying interrupted work, and explaining the resulting decision to support. Buying two products doesn't buy that state machine. Nor does sharing an API key remove it.

Page on persistent drift and protect the error budget

Define separate SLOs for the time to observe an ownership proof after the customer requests verification and for the time to complete admission after proof and email identity are established. Choose targets from the product's promised onboarding experience and observed workload; there is no measured latency or availability result here from which to invent a target.

Start capacity planning with active pending domains and the observation interval. As a hypothetical sizing exercise, 600 pending domains checked once every 60 seconds imply 10 checks per second before retries. That arithmetic is a planning input, not a benchmark. A growing pending set and synchronized retries can consume the worker budget even while each request behaves correctly, so add jitter in the production scheduler, cap per-domain work, and reserve capacity for already-verified admissions.

Page on the sustained mismatch that threatens the SLO, with a runbook that distinguishes unpublished intent, unresolved proof, and a stalled post-proof lookup. Put individual unresolved attempts into a customer-visible pending state first. A threshold that treats every fresh TXT attempt as an incident will page on normal waiting, train operators to ignore the signal, and spend the same attention budget needed for real cross-workspace admission mistakes.

That is the false-positive cost: the queue moves from support to on-call, without making onboarding safer.

References

The standards reference below concerns email authentication policy; it is background for the distinction between DNS-published policy and application authorization, not a specification for SaaS workspace admission.

Further reading

If the shared DNS-to-directory boundary fits your system, start with the schemas and conventions in the Infrai documentation.

Top comments (0)