code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
func(ctx etreeutils.NSContext, signedInfo *etree.Element) error {
detachedSignedInfo, err := etreeutils.NSDetatch(ctx, signedInfo)
if err != nil {
return err
}
c14NMethod, err := etreeutils.NSFindOneChildCtx(ctx, detachedSignedInfo, Namespace, CanonicalizationMethodTag)
if err != nil {
... | Base | 1 |
func InstallNps() {
path := common.GetInstallPath()
if common.FileExists(path) {
log.Fatalf("the path %s has exist, does not support install", path)
}
MkidrDirAll(path, "conf", "web/static", "web/views")
//复制文件到对应目录
if err := CopyDir(filepath.Join(common.GetAppPath(), "web", "views"), filepath.Join(path, "web",... | Class | 2 |
func (*Config_Warning) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{14, 0}
} | Base | 1 |
func padBuffer(buffer []byte, blockSize int) []byte {
missing := blockSize - (len(buffer) % blockSize)
ret, out := resize(buffer, len(buffer)+missing)
padding := bytes.Repeat([]byte{byte(missing)}, missing)
copy(out, padding)
return ret
} | Base | 1 |
func (m *FloatingPoint) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTheproto3
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx... | Variant | 0 |
func (p *CompactProtocol) ReadFieldBegin() (name string, typeId Type, id int16, err error) {
t, err := p.readByteDirect()
if err != nil {
return
}
// if it's a stop, then we can return immediately, as the struct is over.
if (t & 0x0f) == STOP {
return "", STOP, 0, nil
}
// mask off the 4 MSB of the type he... | Base | 1 |
func (m *ADeepBranch) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (m *OrderedFields) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowIssue42
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++... | Variant | 0 |
func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) {
params := k.GetParams(ctx)
expEpochID := k.GetEpochIdentifier(ctx)
if epochIdentifier != expEpochID {
return
}
// mint coins, update supply
epochMintProvision, found := k.GetEpochMintProvision(ctx)
if !found {
panic(... | Class | 2 |
func (b *Backend) rxPacketHandler(c paho.Client, msg paho.Message) {
b.wg.Add(1)
defer b.wg.Done()
var uplinkFrame gw.UplinkFrame
t, err := marshaler.UnmarshalUplinkFrame(msg.Payload(), &uplinkFrame)
if err != nil {
log.WithFields(log.Fields{
"data_base64": base64.StdEncoding.EncodeToString(msg.Payload()),
... | Class | 2 |
func (*MatchStateRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{32}
} | Base | 1 |
func (c *Client) Update() (data.TargetFiles, error) {
if err := c.UpdateRoots(); err != nil {
if _, ok := err.(verify.ErrExpired); ok {
// For backward compatibility, we wrap the ErrExpired inside
// ErrDecodeFailed.
return nil, ErrDecodeFailed{"root.json", err}
}
return nil, err
}
// Get timestamp.j... | Base | 1 |
func (*LeaderboardRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{25}
} | Base | 1 |
func Token(user model.TableUser) (string, error) {
tNow := time.Now()
tUTC := tNow
newTUTC := tUTC.Add(time.Duration(TokenExpiryTime) * time.Minute)
// Set custom claims
claims := &JwtUserClaim{
user.UserName,
user.IsAdmin,
user.UserGroup,
user.ExternalAuth,
user.ExternalProfile,
user.FirstName + " ... | Base | 1 |
func (b *Builder) buildMetricsHTTPConnectionManagerFilter() (*envoy_config_listener_v3.Filter, error) {
rc, err := b.buildRouteConfiguration("metrics", []*envoy_config_route_v3.VirtualHost{{
Name: "metrics",
Domains: []string{"*"},
Routes: []*envoy_config_route_v3.Route{{
Name: "metrics",
Match: &envoy_... | Class | 2 |
func isMatchingRedirectURI(uri string, haystack []string) bool {
requested, err := url.Parse(uri)
if err != nil {
return false
}
for _, b := range haystack {
if strings.ToLower(b) == strings.ToLower(uri) || isLoopbackURI(requested, b) {
return true
}
}
return false
} | Base | 1 |
func (x *ListGroupsRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[27]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (m *BytesValue) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWrappers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (x *WalletLedger) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[42]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (*Config) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{14}
} | Base | 1 |
func (svc *Service) DeleteGlobalScheduledQueries(ctx context.Context, id uint) error {
if err := svc.authz.Authorize(ctx, &fleet.Pack{}, fleet.ActionWrite); err != nil {
return err
}
return svc.DeleteScheduledQuery(ctx, id)
} | Class | 2 |
static bool anal_fcn_data (RCore *core, const char *input) {
RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, core->offset, -1);
ut32 fcn_size = r_anal_function_size_from_entry (fcn);
if (fcn) {
int i;
bool gap = false;
ut64 gap_addr = UT64_MAX;
char *bitmap = calloc (1, fcn_size);
if (bitmap) {
RAna... | Base | 1 |
func (svc Service) DeleteTeamScheduledQueries(ctx context.Context, teamID uint, scheduledQueryID uint) error {
if err := svc.authz.Authorize(ctx, &fleet.Pack{TeamIDs: []uint{teamID}}, fleet.ActionWrite); err != nil {
return err
}
return svc.ds.DeleteScheduledQuery(ctx, scheduledQueryID)
} | Class | 2 |
func (c *linuxContainer) newInitProcess(p *Process, cmd *exec.Cmd, messageSockPair, logFilePair filePair) (*initProcess, error) {
cmd.Env = append(cmd.Env, "_LIBCONTAINER_INITTYPE="+string(initStandard))
nsMaps := make(map[configs.NamespaceType]string)
for _, ns := range c.config.Namespaces {
if ns.Path != "" {
... | Base | 1 |
func NewFositeMemoryStore(
r InternalRegistry,
c Configuration,
) *FositeMemoryStore {
return &FositeMemoryStore{
AuthorizeCodes: make(map[string]authorizeCode),
IDSessions: make(map[string]fosite.Requester),
AccessTokens: make(map[string]fosite.Requester),
PKCES: make(map[string]fosite.Reques... | Base | 1 |
func (a *AuthenticatorOAuth2Introspection) tokenFromCache(config *AuthenticatorOAuth2IntrospectionConfiguration, token string) (*AuthenticatorOAuth2IntrospectionResult, bool) {
if !config.Cache.Enabled {
return nil, false
}
item, found := a.tokenCache.Get(token)
if !found {
return nil, false
}
i := item.(*A... | Class | 2 |
func HTTP(c *HTTPContext) {
for _, route := range routes {
reqPath := strings.ToLower(c.Req.URL.Path)
m := route.re.FindStringSubmatch(reqPath)
if m == nil {
continue
}
// We perform check here because route matched in cmd/web.go is wider than needed,
// but we only want to output this message only if ... | Base | 1 |
func (m *Unrecognized) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func generateDataset(dest []uint32, epoch uint64, cache []uint32) {
// Print some debug logs to allow analysis on low end devices
logger := log.New("epoch", epoch)
start := time.Now()
defer func() {
elapsed := time.Since(start)
logFn := logger.Debug
if elapsed > 3*time.Second {
logFn = logger.Info
}
... | Pillar | 3 |
func (m *StringValue) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWrappers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (m *Aproto3) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProto3
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wir... | Variant | 0 |
func (p *GitLabProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
// Retrieve user info
userInfo, err := p.getUserInfo(ctx, s)
if err != nil {
return fmt.Errorf("failed to retrieve user info: %v", err)
}
// Check if email is verified
if !p.AllowUnverifiedEmail && !userInfo.EmailVeri... | Class | 2 |
func (x *DeleteFriendRequest) Reset() {
*x = DeleteFriendRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
getReturnAddressWithDisplayName(identityId) {
check(identityId, String);
const identity = this.getIdentity(identityId);
const displayName = identity.profile.name + " (via " + this.getServerTitle() + ")";
// First remove any instances of characters that cause trouble for SimpleSmtp. Ideally,
// we... | Class | 2 |
func NewReader(src io.Reader, size int64, md5Hex, sha256Hex string) (*Reader, error) {
if _, ok := src.(*Reader); ok {
return nil, errNestedReader
}
sha256sum, err := hex.DecodeString(sha256Hex)
if err != nil {
return nil, SHA256Mismatch{}
}
md5sum, err := hex.DecodeString(md5Hex)
if err != nil {
return ... | Variant | 0 |
func UnpackTar(filename string, destination string, verbosityLevel int) (err error) {
Verbose = verbosityLevel
f, err := os.Stat(destination)
if os.IsNotExist(err) {
return fmt.Errorf("destination directory '%s' does not exist", destination)
}
filemode := f.Mode()
if !filemode.IsDir() {
return fmt.Errorf("des... | Base | 1 |
func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) {
var pongpkt ingressPacket
if err := decodePacket(data.Pong, &pongpkt); err != nil {
return nil, err
}
if pongpkt.ev != pongPacket {
return nil, errors.New("is not pong packet")
}
if pongpkt.remoteID != net.tab.self.ID {
return nil,... | Base | 1 |
func (a *AuthenticatorOAuth2Introspection) tokenToCache(config *AuthenticatorOAuth2IntrospectionConfiguration, i *AuthenticatorOAuth2IntrospectionResult, token string) {
if !config.Cache.Enabled {
return
}
if a.cacheTTL != nil {
a.tokenCache.SetWithTTL(token, i, 1, *a.cacheTTL)
} else {
a.tokenCache.Set(toke... | Class | 2 |
func TestDoesPolicySignatureMatch(t *testing.T) {
credentialTemplate := "%s/%s/%s/s3/aws4_request"
now := UTCNow()
accessKey := globalActiveCred.AccessKey
testCases := []struct {
form http.Header
expected APIErrorCode
}{
// (0) It should fail if 'X-Amz-Credential' is missing.
{
form: http.Heade... | Class | 2 |
func (m *ProtoType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func TestClean(t *testing.T) {
tests := []struct {
path string
expVal string
}{
{
path: "../../../readme.txt",
expVal: "readme.txt",
},
{
path: "a/../../../readme.txt",
expVal: "readme.txt",
},
{
path: "/../a/b/../c/../readme.txt",
expVal: "a/readme.txt",
},
{
path: "/... | Base | 1 |
func (g Grant) ValidateBasic() error {
if g.Expiration.Unix() < time.Now().Unix() {
return sdkerrors.Wrap(ErrInvalidExpirationTime, "Time can't be in the past")
}
av := g.Authorization.GetCachedValue()
a, ok := av.(Authorization)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T",... | Class | 2 |
func (m *NinOptNonByteCustomType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
... | Variant | 0 |
func (*RuntimeInfo_ModuleInfo) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{41, 0}
} | Base | 1 |
func SearchUserByName(opt SearchOption) (us []*User, err error) {
// Prevent SQL inject.
opt.Keyword = strings.TrimSpace(opt.Keyword)
if len(opt.Keyword) == 0 {
return us, nil
}
opt.Keyword = strings.Split(opt.Keyword, " ")[0]
if len(opt.Keyword) == 0 {
return us, nil
}
opt.Keyword = strings.ToLower(opt.Ke... | Base | 1 |
func isMatchingRedirectURI(uri string, haystack []string) bool {
requested, err := url.Parse(uri)
if err != nil {
return false
}
for _, b := range haystack {
if strings.ToLower(b) == strings.ToLower(uri) || isLoopbackURI(requested, b) {
return true
}
}
return false
} | Base | 1 |
func (m *UnrecognizedWithEmbed_Embedded) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[... | Variant | 0 |
func Test_buildControlPlanePrefixRoute(t *testing.T) {
b := &Builder{filemgr: filemgr.NewManager()}
route, err := b.buildControlPlanePrefixRoute("/hello/world/", false)
require.NoError(t, err)
testutil.AssertProtoJSONEqual(t, `
{
"name": "pomerium-prefix-/hello/world/",
"match": {
"prefix": "/hello/worl... | Class | 2 |
appendMessage = func(targetOffset uint32) bool {
for _, f := range frags {
if f.handshakeHeader.FragmentOffset == targetOffset {
fragmentEnd := (f.handshakeHeader.FragmentOffset + f.handshakeHeader.FragmentLength)
if fragmentEnd != f.handshakeHeader.Length {
if !appendMessage(fragmentEnd) {
ret... | Base | 1 |
func DeleteCode(id string) {
delete(memory.Code, id)
} | Base | 1 |
func TestBuilder_BuildBootstrapStatsConfig(t *testing.T) {
b := New("local-grpc", "local-http", filemgr.NewManager(), nil)
t.Run("valid", func(t *testing.T) {
statsCfg, err := b.BuildBootstrapStatsConfig(&config.Config{
Options: &config.Options{
Services: "all",
},
})
assert.NoError(t, err)
testutil... | Class | 2 |
func (f *Fosite) WriteAuthorizeError(rw http.ResponseWriter, ar AuthorizeRequester, err error) {
rw.Header().Set("Cache-Control", "no-store")
rw.Header().Set("Pragma", "no-cache")
rfcerr := ErrorToRFC6749Error(err)
if !f.SendDebugMessagesToClients {
rfcerr = rfcerr.Sanitize()
}
if !ar.IsRedirectURIValid() {
... | Class | 2 |
func (x *UpdateAccountRequest) Reset() {
*x = UpdateAccountRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[36]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (svc Service) ModifyTeamScheduledQueries(ctx context.Context, teamID uint, scheduledQueryID uint, query fleet.ScheduledQueryPayload) (*fleet.ScheduledQuery, error) {
if err := svc.authz.Authorize(ctx, &fleet.Pack{TeamIDs: []uint{teamID}}, fleet.ActionWrite); err != nil {
return nil, err
}
gp, err := svc.ds.E... | Class | 2 |
func (m *CustomDash) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (m *Subby) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOne
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func createDeviceNode(rootfs string, node *devices.Device, bind bool) error {
if node.Path == "" {
// The node only exists for cgroup reasons, ignore it here.
return nil
}
dest := filepath.Join(rootfs, node.Path)
if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
return err
}
if bind {
return b... | Class | 2 |
func (m *FloatValue) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWrappers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (x *StorageList) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[33]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (x *RuntimeInfo) Reset() {
*x = RuntimeInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[41]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (*CallApiEndpointResponse) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{13}
} | Base | 1 |
func (p *GitLabProvider) addGroupsToSession(ctx context.Context, s *sessions.SessionState) {
// Iterate over projects, check if oauth2-proxy can get project information on behalf of the user
for _, group := range p.Groups {
s.Groups = append(s.Groups, fmt.Sprintf("group:%s", group))
}
} | Class | 2 |
func (hs *HTTPServer) pluginMarkdown(ctx context.Context, pluginId string, name string) ([]byte, error) {
plugin, exists := hs.pluginStore.Plugin(ctx, pluginId)
if !exists {
return nil, plugins.NotFoundError{PluginID: pluginId}
}
// nolint:gosec
// We can ignore the gosec G304 warning on this one because `plugi... | Base | 1 |
func (p *CompactProtocol) ReadBinary() (value []byte, err error) {
length, e := p.readVarint32()
if e != nil {
return nil, NewProtocolException(e)
}
if length == 0 {
return []byte{}, nil
}
if length < 0 {
return nil, invalidDataLength
}
if uint64(length) > p.trans.RemainingBytes() {
return nil, invalidD... | Base | 1 |
func (x *LeaderboardRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func Skip(self Protocol, fieldType Type, maxDepth int) (err error) {
if maxDepth <= 0 {
return NewProtocolExceptionWithType(DEPTH_LIMIT, errors.New("Depth limit exceeded"))
}
switch fieldType {
case STOP:
return
case BOOL:
_, err = self.ReadBool()
return
case BYTE:
_, err = self.ReadByte()
return
c... | Class | 2 |
func TestInvalidPaddingOpen(t *testing.T) {
key := make([]byte, 32)
nonce := make([]byte, 16)
// Plaintext with invalid padding
plaintext := padBuffer(make([]byte, 28), aes.BlockSize)
plaintext[len(plaintext)-1] = 0xFF
io.ReadFull(rand.Reader, key)
io.ReadFull(rand.Reader, nonce)
block, _ := aes.NewCipher(ke... | Base | 1 |
func (h *Handler) DefaultErrorHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
h.L.Warnln("A client requested the default error URL, environment variable OAUTH2_ERROR_URL is probably not set.")
fmt.Fprintf(w, `
<html>
<head>
<title>An OAuth 2.0 Error Occurred</title>
</head>
<body>
<h1>
The O... | Base | 1 |
private HandshakeMessage createClientHandshakeMessage(
HandshakeType type, byte[] buffer)
{
switch (type)
{
case HandshakeType.ClientHello:
return new TlsClientHello(this.context, buffer);
case HandshakeType.Certificate:
return new TlsClientCertificate(this.context, buffer);
case Ha... | Base | 1 |
func (x *UnlinkDeviceRequest) Reset() {
*x = UnlinkDeviceRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (p *HTTPClient) RemainingBytes() (num_bytes uint64) {
len := p.response.ContentLength
if len >= 0 {
return uint64(len)
}
return UnknownRemaining // the truth is, we just don't know unless framed is used
} | Base | 1 |
func TestMsgGrantAuthorization(t *testing.T) {
tests := []struct {
title string
granter, grantee sdk.AccAddress
authorization authz.Authorization
expiration time.Time
expectErr bool
expectPass bool
}{
{"nil granter address", nil, grantee, &banktypes.SendAuthorization{Spe... | Class | 2 |
func cmdGet(args *docopt.Args, client *tuf.Client) error {
if _, err := client.Update(); err != nil && !tuf.IsLatestSnapshot(err) {
return err
}
target := util.NormalizeTarget(args.String["<target>"])
file, err := ioutil.TempFile("", "go-tuf")
if err != nil {
return err
}
tmp := tmpFile{file}
if err := clie... | Base | 1 |
func GetIssues(uid, rid, pid, mid int64, page int, isClosed bool, labelIds, sortType string) ([]Issue, error) {
sess := x.Limit(20, (page-1)*20)
if rid > 0 {
sess.Where("repo_id=?", rid).And("is_closed=?", isClosed)
} else {
sess.Where("is_closed=?", isClosed)
}
if uid > 0 {
sess.And("assignee_id=?", uid)
... | Base | 1 |
func validateWebhook(actor *db.User, l macaron.Locale, w *db.Webhook) (field, msg string, ok bool) {
if !actor.IsAdmin {
// 🚨 SECURITY: Local addresses must not be allowed by non-admins to prevent SSRF,
// see https://github.com/gogs/gogs/issues/5366 for details.
payloadURL, err := url.Parse(w.URL)
if err != ... | Base | 1 |
func SanitizePath(path string) string {
return strings.TrimLeft(path, "./")
} | Base | 1 |
func (x *ListPurchasesRequest) Reset() {
*x = ListPurchasesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (m *Foo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProto
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func logNamespaceDiagnostics(spec *specs.Spec) {
sawMountNS := false
sawUserNS := false
sawUTSNS := false
for _, ns := range spec.Linux.Namespaces {
switch ns.Type {
case specs.CgroupNamespace:
if ns.Path != "" {
logrus.Debugf("unable to join cgroup namespace, sorry about that")
} else {
logrus.De... | Class | 2 |
func generateHMAC(data []byte, key *[32]byte) []byte {
h := hmac.New(sha512.New512_256, key[:])
h.Write(data)
return h.Sum(nil)
} | Class | 2 |
func fixLength(isResponse bool, status int, requestMethod string, header Header, te []string) (int64, error) {
// Logic based on response type or status
if noBodyExpected(requestMethod) {
return 0, nil
}
if status/100 == 1 {
return 0, nil
}
switch status {
case 204, 304:
return 0, nil
}
// Logic based ... | Base | 1 |
func TestEscapeJSONString(t *testing.T) {
for _, str := range []string{"", "foobar", `foo"bar`, `foo\bar`, "foo\n\tbar"} {
escaped := EscapeJSONString(str)
var unmarshaled string
err := json.Unmarshal([]byte(`"` + escaped + `"`), &unmarshaled)
require.NoError(t, err, str)
assert.Equal(t, str, unmarshaled, st... | Base | 1 |
func (m *Object) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowObject
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire... | Variant | 0 |
func (*ConsoleSession) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{15}
} | Base | 1 |
func (*ListSubscriptionsRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{29}
} | Base | 1 |
return utils.WithProcfd(rootfs, m.Destination, func(procfd string) error {
return mount(m.Source, m.Destination, procfd, m.Device, uintptr(m.Flags|unix.MS_REMOUNT), "")
}) | Base | 1 |
func (svc *Service) ListHostDeviceMapping(ctx context.Context, id uint) ([]*fleet.HostDeviceMapping, error) {
if !svc.authz.IsAuthenticatedWith(ctx, authz_ctx.AuthnDeviceToken) {
if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil {
return nil, err
}
host, err := svc.ds.HostLite(c... | Class | 2 |
func (evpool *Pool) CheckEvidence(evList types.EvidenceList) error {
hashes := make([][]byte, len(evList))
for idx, ev := range evList {
ok := evpool.fastCheck(ev)
if !ok {
// check that the evidence isn't already committed
if evpool.isCommitted(ev) {
return &types.ErrInvalidEvidence{Evidence: ev, Rea... | Class | 2 |
func newMockResourceServer(t testing.TB) ResourceServer {
ctx := context.Background()
dummy := ""
serverURL := &dummy
hf := func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/.well-known/oauth-authorization-server" {
w.Header().Set("Content-Type", "application/json")
_, err := io.WriteString(... | Base | 1 |
func (EmptyEvidencePool) AddEvidence(types.Evidence) error { return nil } | Class | 2 |
func GetCode(id string) string {
return memory.Code[id]
} | Base | 1 |
func (m *MyType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAsym
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |... | Variant | 0 |
func (m *CastType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowExample
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
w... | Variant | 0 |
func getClaimsFromToken(r *http.Request, token string) (map[string]interface{}, error) { | Class | 2 |
func checkAuth(ctx context.Context, config Config, auth string) (context.Context, bool) {
const basicPrefix = "Basic "
const bearerPrefix = "Bearer "
if strings.HasPrefix(auth, basicPrefix) {
// Basic authentication.
username, password, ok := parseBasicAuth(auth)
if !ok {
return ctx, false
}
if userna... | Base | 1 |
func (*CallApiEndpointRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{12}
} | Base | 1 |
func (x *StatusList_Status) Reset() {
*x = StatusList_Status{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[49]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func PrintVerificationHeader(imgRef string, co *cosign.CheckOpts, bundleVerified bool) {
fmt.Fprintf(os.Stderr, "\nVerification for %s --\n", imgRef)
fmt.Fprintln(os.Stderr, "The following checks were performed on each of these signatures:")
if co.ClaimVerifier != nil {
if co.Annotations != nil {
fmt.Fprintln(o... | Base | 1 |
func TestWrapHandler(t *testing.T) {
router := http.NewServeMux()
router.Handle("/", Handler(DocExpansion("none"), DomID("#swagger-ui")))
w1 := performRequest("GET", "/index.html", router)
assert.Equal(t, 200, w1.Code)
assert.Equal(t, w1.Header()["Content-Type"][0], "text/html; charset=utf-8")
w2 := performReq... | Class | 2 |
func (sg *SecureGet) Do(ctx context.Context) error {
ref, err := name.ParseReference(sg.ImageRef)
if err != nil {
return err
}
opts := []remote.Option{
remote.WithAuthFromKeychain(authn.DefaultKeychain),
remote.WithContext(ctx),
}
co := &cosign.CheckOpts{
ClaimVerifier: cosign.SimpleClaimVerifier,
... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.