• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dnsimple / dns_erlang / 21822629238
85%

Build:
DEFAULT BRANCH: main
Ran 09 Feb 2026 11:08AM UTC
Jobs 1
Files 13
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Feb 2026 11:07AM UTC coverage: 84.747% (+0.1%) from 84.613%
21822629238

push

github

web-flow
SVCB params validation (#109)

Fixes #110 and #111. Also adds:

    In SVCB/HTTPS service params, numeric keys 0–6 are reserved and equivalent to the named params (mandatory, alpn, no-default-alpn, port, ipv4hint, ech, ipv6hint). This PR makes the library treat them as such everywhere: name resolution, zone parsing, and JSON parsing all validate key0–key6 the same as their named forms and no longer allow them to be used as generic "unknown" keys.
    Note that this validation was already happening during encoding values back, either to be given on the wire or on the API, so with this change we now validate earlier, at ingestion.

    We also update the documentation generation for json at scripts/generate_json_docs.escript:

    Documented that key0–key6 are equivalent to the named params and are validated the same.
    Clarified no-default-alpn as null and updated the keyNNNN description (e.g. key format and that value is binary or null).

#110

## Summary

The `from_zone/2` function in `dns_svcb_params.erl` has two exception-throwing paths in the unknown-key branch (lines 207-217) that bypass the structured `{error, ...}` return convention used by every other branch in the function.

## Evidence

### 1. Brittle `string:split/3` pattern match (line 209)

```erlang
[KeyNumStr, ""] = string:split(RestStr, "=", leading),
```

If `RestStr` doesn't contain `=`, `string:split/3` returns a single-element list, causing a `badmatch` crash. Similarly, input like `key123=foo=bar` also crashes.

### 2. Unprotected `base64:decode` (line 212)

```erlang
ValueBin = base64:decode(Value),
```

Unlike the `ech=` branch (lines 198-206) which wraps `base64:decode` in a `try/catch` and returns `{error, MakeError(...)}`, the unknown-key branch calls `base64:decode/1` bare. Malformed base64 input raises an unhandled exception.

### 3. Caller doesn't catch exceptions (`dns_zone_decode.erl:1345`)

The caller handles `{ok, _}` and `{error, _}` returns but has no `try/catch`, ... (continued)

60 of 66 new or added lines in 2 files covered. (90.91%)

2617 of 3088 relevant lines covered (84.75%)

8354.39 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
6
93.36
-0.45% src/dns_svcb_params.erl
Jobs
ID Job ID Ran Files Coverage
1 21822629238.1 09 Feb 2026 11:08AM UTC 13
84.75
GitHub Action Run
Source Files on build 21822629238
  • Tree
  • List 13
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #21822629238
  • 223089c4 on github
  • Prev Build on main (#21820744355)
  • Next Build on main (#21823261186)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc