test(ui): avoid a literal em dash in the em dash check
- test(ui): avoid a literal em dash in the em dash check - fix(cli): accept any positive int64 audit count and share the last active admin rule - fix(api): limit audit before_id to 2^53-1 - fix(api): audit unmatched api requests, bound every request body and record audit write failures - fix(ui): recheck the account in the login transaction and require existing zones on zone pages - fix(api): recheck the acting admin and the stored password hash in change transactions - fix(db): keep committed outcomes on lock release failure, narrow the records contract and trace sql statements - fix(db): make the initial migration restartable and verify the application schema - fix(auth): never move last_seen_at backwards on concurrent session touches - test(api): cover lock release failure after commit and handler tracing without secrets - fix(test): redact credentials from mysql setup errors - fix(audit): retain addressed objects on admin refusals - test(db): cover migration restarts and records contract ranges in mysql - test(api): verify account races and audit rollback in mysql - fix(auth): reject password changes after account deletion - docs: document unknown api audit entries - fix(audit): bound failure retries and redact sensitive sql parameters - fix(test): isolate docker resources and cover image cli commands - test(auth): expect unauthorized after an account deletion race - fix(db): verify application column widths and foreign keys
This commit is contained in:
1 parent
5f17aab6ca
commit
53444bec7a
40 files changed
+2332
-254
No files matched your search
+47
-1
@@ -246,7 +246,7 @@ func TestEmbeddedFilesRules(t *testing.T) {
|
||||
return err
|
||||
}
|
||||
text := string(data)
|
||||
if strings.Contains(text, "—") {
|
||||
if strings.Contains(text, "\u2014") {
|
||||
t.Errorf("%s/%s contains an em dash", name, p)
|
||||
}
|
||||
if strings.HasSuffix(p, ".js") || strings.HasSuffix(p, ".css") {
|
||||
@@ -653,3 +653,49 @@ func TestRenderEscaping(t *testing.T) {
|
||||
t.Error("login: escaped error missing")
|
||||
}
|
||||
}
|
||||
|
||||
func TestZonePagesRequireAnExistingZone(t *testing.T) {
|
||||
h := newWebHarness(t)
|
||||
admin := h.user("admin", roleAdmin)
|
||||
alice := h.user("alice", roleUser)
|
||||
h.store.addZone(testZone)
|
||||
h.store.addZone(otherZone)
|
||||
h.store.addZone("undotted.org")
|
||||
h.store.delegate(testZone, alice)
|
||||
h.store.delegate("stale.org.", alice)
|
||||
at, ut := h.login(admin), h.login(alice)
|
||||
for _, suffix := range []string{"", "/import"} {
|
||||
page := func(token, zone string) webResult {
|
||||
return h.do(webRequest{method: "GET", path: "/zones/" + zone + suffix, token: token})
|
||||
}
|
||||
for _, c := range []struct {
|
||||
token, zone string
|
||||
status int
|
||||
}{
|
||||
{at, "example.org.", 200},
|
||||
{at, "Example.ORG", 200},
|
||||
{at, "undotted.org", 200},
|
||||
{at, "missing.org", 404},
|
||||
{at, "stale.org.", 404},
|
||||
{ut, "example.org", 200},
|
||||
{ut, "stale.org.", 404},
|
||||
{ut, "other.org.", 404},
|
||||
{ut, "missing.org", 404},
|
||||
} {
|
||||
if res := page(c.token, c.zone); res.status != c.status || len(res.audit) != 0 {
|
||||
t.Errorf("%s%s: %d, want %d", c.zone, suffix, res.status, c.status)
|
||||
}
|
||||
}
|
||||
missing, stale, other := page(ut, "missing.org"), page(ut, "stale.org"), page(ut, "other.org")
|
||||
if missing.body != stale.body || missing.body != other.body || !strings.Contains(missing.body, "alice") {
|
||||
t.Errorf("%s: not found pages differ", suffix)
|
||||
}
|
||||
if adminMissing := page(at, "missing.org"); !strings.Contains(adminMissing.body, "admin") {
|
||||
t.Errorf("%s: admin not found page", suffix)
|
||||
}
|
||||
}
|
||||
h.store.failOn["ZoneExists"] = errDatabase
|
||||
if res := h.do(webRequest{method: "GET", path: "/zones/example.org.", token: at}); res.status != 503 {
|
||||
t.Fatal(res.status)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user