mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
* filer: assignment tokens and chunk proofs for scoped writes * filer: tighten scoped chunk identities and write boundaries * filer: apply gRPC key removal on config reload * filer: prevent scoped chunk alias and remote append data loss * filer: guard scoped writes across stored data representations * filer: preserve lazy scoped admission lookups * filer: avoid summing chunk counts for map capacity * filer: keep a scoped assign in its path's collection A scoped token could name another bucket's collection in AssignVolume and upload chunks there, charging that bucket's quota and losing them when that collection is deleted. A scoped caller now gets the collection its path resolves to; naming a different one is refused before the master call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: rotate gRPC keys and bind chunk proofs to collections --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package weed_server
|
|
|
|
import "context"
|
|
|
|
type scopeWriteAuthorityKey struct{}
|
|
|
|
// Only the authenticated interceptor supplies this authority. Proof maps stay
|
|
// on each request, so concurrent stream messages never share mutable proofs.
|
|
type scopeWriteAuthority struct {
|
|
s *filerGrpcScope
|
|
sc *scope
|
|
}
|
|
|
|
func (s *filerGrpcScope) withWriteAuthority(ctx context.Context, sc *scope) context.Context {
|
|
return context.WithValue(withScopeKeepOnly(ctx), scopeWriteAuthorityKey{}, &scopeWriteAuthority{s: s, sc: sc})
|
|
}
|
|
|
|
// scopeKeepOnlyContextKey marks a handler call admitted for a scoped token.
|
|
// It is deliberately unexported so callers cannot manufacture the marker
|
|
// through a public context contract; the gRPC scope interceptor is the only
|
|
// producer.
|
|
type scopeKeepOnlyContextKey struct{}
|
|
|
|
func withScopeKeepOnly(ctx context.Context) context.Context {
|
|
return context.WithValue(ctx, scopeKeepOnlyContextKey{}, true)
|
|
}
|
|
|
|
func scopeKeepOnly(ctx context.Context) bool {
|
|
keepOnly, _ := ctx.Value(scopeKeepOnlyContextKey{}).(bool)
|
|
return keepOnly
|
|
}
|