fix xsrf and added nonce
This commit is contained in:
parent
6476ebc781
commit
809627b538
208 changed files with 7166 additions and 4278 deletions
61
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
61
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
|
|
@ -19,7 +19,6 @@ import (
|
|||
"google.golang.org/protobuf/internal/pragma"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
// Edition is an Enum for proto2.Edition
|
||||
|
|
@ -73,9 +72,10 @@ type (
|
|||
EditionFeatures EditionFeatures
|
||||
}
|
||||
FileL2 struct {
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Imports FileImports
|
||||
Locations SourceLocations
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Imports FileImports
|
||||
OptionImports func() protoreflect.FileImports
|
||||
Locations SourceLocations
|
||||
}
|
||||
|
||||
// EditionFeatures is a frequently-instantiated struct, so please take care
|
||||
|
|
@ -127,12 +127,9 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
|
|||
func (fd *File) Parent() protoreflect.Descriptor { return nil }
|
||||
func (fd *File) Index() int { return 0 }
|
||||
func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
|
||||
|
||||
// Not exported and just used to reconstruct the original FileDescriptor proto
|
||||
func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
|
||||
func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
|
||||
func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
|
||||
func (fd *File) IsPlaceholder() bool { return false }
|
||||
func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
|
||||
func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
|
||||
func (fd *File) IsPlaceholder() bool { return false }
|
||||
func (fd *File) Options() protoreflect.ProtoMessage {
|
||||
if f := fd.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
|
|
@ -151,6 +148,16 @@ func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatD
|
|||
func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
|
||||
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// The next two are not part of the FileDescriptor interface. They are just used to reconstruct
|
||||
// the original FileDescriptor proto.
|
||||
func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
|
||||
func (fd *File) OptionImports() protoreflect.FileImports {
|
||||
if f := fd.lazyInit().OptionImports; f != nil {
|
||||
return f()
|
||||
}
|
||||
return emptyFiles
|
||||
}
|
||||
|
||||
func (fd *File) lazyInit() *FileL2 {
|
||||
if atomic.LoadUint32(&fd.once) == 0 {
|
||||
fd.lazyInitOnce()
|
||||
|
|
@ -183,9 +190,9 @@ type (
|
|||
L2 *EnumL2 // protected by fileDesc.once
|
||||
}
|
||||
EnumL1 struct {
|
||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||
|
||||
EditionFeatures EditionFeatures
|
||||
Visibility int32
|
||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||
}
|
||||
EnumL2 struct {
|
||||
Options func() protoreflect.ProtoMessage
|
||||
|
|
@ -220,6 +227,11 @@ func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit()
|
|||
func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
||||
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||
func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
|
||||
|
||||
// This is not part of the EnumDescriptor interface. It is just used to reconstruct
|
||||
// the original FileDescriptor proto.
|
||||
func (ed *Enum) Visibility() int32 { return ed.L1.Visibility }
|
||||
|
||||
func (ed *Enum) lazyInit() *EnumL2 {
|
||||
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return ed.L2
|
||||
|
|
@ -245,13 +257,13 @@ type (
|
|||
L2 *MessageL2 // protected by fileDesc.once
|
||||
}
|
||||
MessageL1 struct {
|
||||
Enums Enums
|
||||
Messages Messages
|
||||
Extensions Extensions
|
||||
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||
|
||||
Enums Enums
|
||||
Messages Messages
|
||||
Extensions Extensions
|
||||
EditionFeatures EditionFeatures
|
||||
Visibility int32
|
||||
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||
}
|
||||
MessageL2 struct {
|
||||
Options func() protoreflect.ProtoMessage
|
||||
|
|
@ -275,7 +287,6 @@ type (
|
|||
Kind protoreflect.Kind
|
||||
StringName stringName
|
||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||
IsWeak bool // promoted from google.protobuf.FieldOptions
|
||||
IsLazy bool // promoted from google.protobuf.FieldOptions
|
||||
Default defaultValue
|
||||
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||
|
|
@ -321,6 +332,11 @@ func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L
|
|||
func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
|
||||
func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
|
||||
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||
|
||||
// This is not part of the MessageDescriptor interface. It is just used to reconstruct
|
||||
// the original FileDescriptor proto.
|
||||
func (md *Message) Visibility() int32 { return md.L1.Visibility }
|
||||
|
||||
func (md *Message) lazyInit() *MessageL2 {
|
||||
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return md.L2
|
||||
|
|
@ -369,7 +385,7 @@ func (fd *Field) IsPacked() bool {
|
|||
return fd.L1.EditionFeatures.IsPacked
|
||||
}
|
||||
func (fd *Field) IsExtension() bool { return false }
|
||||
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
||||
func (fd *Field) IsWeak() bool { return false }
|
||||
func (fd *Field) IsLazy() bool { return fd.L1.IsLazy }
|
||||
func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() }
|
||||
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
||||
|
|
@ -396,11 +412,6 @@ func (fd *Field) Enum() protoreflect.EnumDescriptor {
|
|||
return fd.L1.Enum
|
||||
}
|
||||
func (fd *Field) Message() protoreflect.MessageDescriptor {
|
||||
if fd.L1.IsWeak {
|
||||
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
||||
return d.(protoreflect.MessageDescriptor)
|
||||
}
|
||||
}
|
||||
return fd.L1.Message
|
||||
}
|
||||
func (fd *Field) IsMapEntry() bool {
|
||||
|
|
|
|||
14
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
14
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
|
|
@ -284,6 +284,13 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl
|
|||
case genid.EnumDescriptorProto_Value_field_number:
|
||||
numValues++
|
||||
}
|
||||
case protowire.VarintType:
|
||||
v, m := protowire.ConsumeVarint(b)
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.EnumDescriptorProto_Visibility_field_number:
|
||||
ed.L1.Visibility = int32(v)
|
||||
}
|
||||
default:
|
||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||
b = b[m:]
|
||||
|
|
@ -365,6 +372,13 @@ func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor
|
|||
md.unmarshalSeedOptions(v)
|
||||
}
|
||||
prevField = num
|
||||
case protowire.VarintType:
|
||||
v, m := protowire.ConsumeVarint(b)
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.DescriptorProto_Visibility_field_number:
|
||||
md.L1.Visibility = int32(v)
|
||||
}
|
||||
default:
|
||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||
b = b[m:]
|
||||
|
|
|
|||
29
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
29
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
|
|
@ -32,11 +32,6 @@ func (file *File) resolveMessages() {
|
|||
for j := range md.L2.Fields.List {
|
||||
fd := &md.L2.Fields.List[j]
|
||||
|
||||
// Weak fields are resolved upon actual use.
|
||||
if fd.L1.IsWeak {
|
||||
continue
|
||||
}
|
||||
|
||||
// Resolve message field dependency.
|
||||
switch fd.L1.Kind {
|
||||
case protoreflect.EnumKind:
|
||||
|
|
@ -139,6 +134,7 @@ func (fd *File) unmarshalFull(b []byte) {
|
|||
|
||||
var enumIdx, messageIdx, extensionIdx, serviceIdx int
|
||||
var rawOptions []byte
|
||||
var optionImports []string
|
||||
fd.L2 = new(FileL2)
|
||||
for len(b) > 0 {
|
||||
num, typ, n := protowire.ConsumeTag(b)
|
||||
|
|
@ -150,8 +146,6 @@ func (fd *File) unmarshalFull(b []byte) {
|
|||
switch num {
|
||||
case genid.FileDescriptorProto_PublicDependency_field_number:
|
||||
fd.L2.Imports[v].IsPublic = true
|
||||
case genid.FileDescriptorProto_WeakDependency_field_number:
|
||||
fd.L2.Imports[v].IsWeak = true
|
||||
}
|
||||
case protowire.BytesType:
|
||||
v, m := protowire.ConsumeBytes(b)
|
||||
|
|
@ -164,6 +158,8 @@ func (fd *File) unmarshalFull(b []byte) {
|
|||
imp = PlaceholderFile(path)
|
||||
}
|
||||
fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
|
||||
case genid.FileDescriptorProto_OptionDependency_field_number:
|
||||
optionImports = append(optionImports, sb.MakeString(v))
|
||||
case genid.FileDescriptorProto_EnumType_field_number:
|
||||
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
||||
enumIdx++
|
||||
|
|
@ -185,6 +181,23 @@ func (fd *File) unmarshalFull(b []byte) {
|
|||
}
|
||||
}
|
||||
fd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions)
|
||||
if len(optionImports) > 0 {
|
||||
var imps FileImports
|
||||
var once sync.Once
|
||||
fd.L2.OptionImports = func() protoreflect.FileImports {
|
||||
once.Do(func() {
|
||||
imps = make(FileImports, len(optionImports))
|
||||
for i, path := range optionImports {
|
||||
imp, _ := fd.builder.FileRegistry.FindFileByPath(path)
|
||||
if imp == nil {
|
||||
imp = PlaceholderFile(path)
|
||||
}
|
||||
imps[i] = protoreflect.FileImport{FileDescriptor: imp}
|
||||
}
|
||||
})
|
||||
return &imps
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
|
|
@ -502,8 +515,6 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
|||
switch num {
|
||||
case genid.FieldOptions_Packed_field_number:
|
||||
fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)
|
||||
case genid.FieldOptions_Weak_field_number:
|
||||
fd.L1.IsWeak = protowire.DecodeBool(v)
|
||||
case genid.FieldOptions_Lazy_field_number:
|
||||
fd.L1.IsLazy = protowire.DecodeBool(v)
|
||||
case FieldOptions_EnforceUTF8:
|
||||
|
|
|
|||
18
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
18
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
|
|
@ -13,8 +13,10 @@ import (
|
|||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
var defaultsCache = make(map[Edition]EditionFeatures)
|
||||
var defaultsKeys = []Edition{}
|
||||
var (
|
||||
defaultsCache = make(map[Edition]EditionFeatures)
|
||||
defaultsKeys = []Edition{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
unmarshalEditionDefaults(editiondefaults.Defaults)
|
||||
|
|
@ -41,7 +43,7 @@ func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures {
|
|||
b = b[m:]
|
||||
parent.StripEnumPrefix = int(v)
|
||||
default:
|
||||
panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num))
|
||||
panic(fmt.Sprintf("unknown field number %d while unmarshalling GoFeatures", num))
|
||||
}
|
||||
}
|
||||
return parent
|
||||
|
|
@ -69,8 +71,14 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
|
|||
parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value
|
||||
case genid.FeatureSet_JsonFormat_field_number:
|
||||
parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value
|
||||
case genid.FeatureSet_EnforceNamingStyle_field_number:
|
||||
// EnforceNamingStyle is enforced in protoc, languages other than C++
|
||||
// are not supposed to do anything with this feature.
|
||||
case genid.FeatureSet_DefaultSymbolVisibility_field_number:
|
||||
// DefaultSymbolVisibility is enforced in protoc, runtimes should not
|
||||
// inspect this value.
|
||||
default:
|
||||
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
|
||||
panic(fmt.Sprintf("unknown field number %d while unmarshalling FeatureSet", num))
|
||||
}
|
||||
case protowire.BytesType:
|
||||
v, m := protowire.ConsumeBytes(b)
|
||||
|
|
@ -144,7 +152,7 @@ func unmarshalEditionDefaults(b []byte) {
|
|||
_, m := protowire.ConsumeVarint(b)
|
||||
b = b[m:]
|
||||
default:
|
||||
panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num))
|
||||
panic(fmt.Sprintf("unknown field number %d while unmarshalling EditionDefault", num))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package filedesc
|
||||
|
||||
import "google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
// UsePresenceForField reports whether the presence bitmap should be used for
|
||||
// the specified field.
|
||||
func UsePresenceForField(fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
// Oneof fields never use the presence bitmap.
|
||||
//
|
||||
// Synthetic oneofs are an exception: Those are used to implement proto3
|
||||
// optional fields and hence should follow non-oneof field semantics.
|
||||
return false, false
|
||||
|
||||
case fd.IsMap():
|
||||
// Map-typed fields never use the presence bitmap.
|
||||
return false, false
|
||||
|
||||
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
|
||||
// Lazy fields always use the presence bitmap (only messages can be lazy).
|
||||
isLazy := fd.(interface{ IsLazy() bool }).IsLazy()
|
||||
return isLazy, isLazy
|
||||
|
||||
default:
|
||||
// If the field has presence, use the presence bitmap.
|
||||
return fd.HasPresence(), false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue