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
+20
-2
@@ -61,7 +61,9 @@ type fakeWebStore struct {
|
||||
mu sync.Mutex
|
||||
state fakeWebState
|
||||
failOn map[string]error
|
||||
failTimes map[string]int
|
||||
onLock func(state *fakeWebState)
|
||||
onTx func(state *fakeWebState)
|
||||
calls []string
|
||||
zoneLocks []string
|
||||
commits int
|
||||
@@ -75,7 +77,8 @@ func newFakeWebStore() *fakeWebStore {
|
||||
delegations: map[delegationKey]delegationRow{},
|
||||
zones: map[string]bool{},
|
||||
},
|
||||
failOn: map[string]error{},
|
||||
failOn: map[string]error{},
|
||||
failTimes: map[string]int{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +94,12 @@ func (f *fakeWebStore) view() *fakeWebView {
|
||||
|
||||
func (v *fakeWebView) call(name string) error {
|
||||
v.store.calls = append(v.store.calls, name)
|
||||
if n, limited := v.store.failTimes[name]; limited {
|
||||
if n <= 0 {
|
||||
return nil
|
||||
}
|
||||
v.store.failTimes[name] = n - 1
|
||||
}
|
||||
return v.store.failOn[name]
|
||||
}
|
||||
|
||||
@@ -220,7 +229,7 @@ func (v *fakeWebView) TouchSession(ctx context.Context, tokenHash []byte, now ti
|
||||
if err := v.call("TouchSession"); err != nil {
|
||||
return err
|
||||
}
|
||||
if s, ok := v.state.sessions[string(tokenHash)]; ok {
|
||||
if s, ok := v.state.sessions[string(tokenHash)]; ok && !s.LastSeenAt.After(now.Add(-sessionTouchInterval)) {
|
||||
s.LastSeenAt = now
|
||||
v.state.sessions[string(tokenHash)] = s
|
||||
}
|
||||
@@ -341,6 +350,10 @@ func (f *fakeWebStore) InTx(ctx context.Context, fn func(tx webTx) error) error
|
||||
if err := f.failOn["InTx"]; err != nil {
|
||||
return err
|
||||
}
|
||||
if hook := f.onTx; hook != nil {
|
||||
f.onTx = nil
|
||||
hook(&f.state)
|
||||
}
|
||||
working := f.state.clone()
|
||||
if err := fn(&fakeWebView{store: f, state: &working, inTx: true}); err != nil {
|
||||
f.rollbacks++
|
||||
@@ -699,6 +712,7 @@ type webRequest struct {
|
||||
header map[string]string
|
||||
remote string
|
||||
rawBody io.Reader
|
||||
chunked bool
|
||||
}
|
||||
|
||||
type webResult struct {
|
||||
@@ -718,6 +732,10 @@ func (h *webHarness) do(req webRequest) webResult {
|
||||
if req.body == "" && req.rawBody == nil {
|
||||
r = httptest.NewRequest(req.method, req.path, nil)
|
||||
}
|
||||
if req.chunked {
|
||||
r = httptest.NewRequest(req.method, req.path, io.MultiReader(body))
|
||||
r.TransferEncoding = []string{"chunked"}
|
||||
}
|
||||
r.RemoteAddr = "192.0.2.10:40000"
|
||||
if req.remote != "" {
|
||||
r.RemoteAddr = req.remote
|
||||
|
||||
Reference in new issue
Block a user