code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
func (*BridgeViewStub) FindBridgeStopped(al *types.ERC20EventBridgeStopped, blockNumber, logIndex uint64, txHash string) error { return nil }
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func (*BridgeViewStub) FindBridgeResumed(al *types.ERC20EventBridgeResumed, blockNumber, logIndex uint64, txHash string) error { return nil }
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func (*BridgeViewStub) FindAssetLimitsUpdated(w *types.ERC20AssetLimitsUpdated, blockNumber, logIndex uint64, ethAssetAddress string, txHash string) error { return nil }
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func (o *OnChainVerifier) filterSignerAdded( ctx context.Context, filterer *multisig.MultisigControlFilterer, event *types.SignerEvent, ) error { iter, err := filterer.FilterSignerAdded( &bind.FilterOpts{ Start: event.BlockNumber, End: &event.BlockNumber, Context: ctx, }, ) if err != nil { o....
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func (o *OnChainVerifier) CheckThresholdSetEvent( event *types.SignerThresholdSetEvent, ) error { o.mu.RLock() defer o.mu.RUnlock() if o.log.GetLevel() <= logging.DebugLevel { o.log.Debug("checking threshold set event on chain", logging.String("contract-address", o.multiSigAddress.Hex()), logging.String("e...
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func (o *OnChainVerifier) filterSignerRemoved( ctx context.Context, filterer *multisig.MultisigControlFilterer, event *types.SignerEvent, ) error { iter, err := filterer.FilterSignerRemoved( &bind.FilterOpts{ Start: event.BlockNumber, End: &event.BlockNumber, Context: ctx, }, ) if err != nil { ...
1
Go
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
func ValidateAllAuthorizationModels(ctx context.Context, db storage.OpenFGADatastore) ([]validationResult, error) { validationResults := make([]validationResult, 0) continuationTokenStores := "" for { // fetch a page of stores stores, tokenStores, err := db.ListStores(ctx, storage.PaginationOptions{ PageSiz...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (q *ExpandQuery) Execute(ctx context.Context, req *openfgapb.ExpandRequest) (*openfgapb.ExpandResponse, error) { store := req.GetStoreId() modelID := req.GetAuthorizationModelId() tupleKey := req.GetTupleKey() object := tupleKey.GetObject() relation := tupleKey.GetRelation() if object == "" || relation == "...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (w *WriteAuthorizationModelCommand) Execute(ctx context.Context, req *openfgapb.WriteAuthorizationModelRequest) (*openfgapb.WriteAuthorizationModelResponse, error) { // Until this is solved: https://github.com/envoyproxy/protoc-gen-validate/issues/74 if len(req.GetTypeDefinitions()) > w.backend.MaxTypesPerAuthor...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (s *Server) StreamedListObjects(req *openfgapb.StreamedListObjectsRequest, srv openfgapb.OpenFGAService_StreamedListObjectsServer) error { ctx := srv.Context() ctx, span := tracer.Start(ctx, "StreamedListObjects", trace.WithAttributes( attribute.String("object_type", req.GetType()), attribute.String("relatio...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (s *Server) ListObjects(ctx context.Context, req *openfgapb.ListObjectsRequest) (*openfgapb.ListObjectsResponse, error) { storeID := req.GetStoreId() targetObjectType := req.GetType() ctx, span := tracer.Start(ctx, "ListObjects", trace.WithAttributes( attribute.String("object_type", targetObjectType), attr...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func TestCheckDoesNotThrowBecauseDirectTupleWasFound(t *testing.T) { ctx := context.Background() storeID := ulid.Make().String() modelID := ulid.Make().String() typedefs := parser.MustParse(` type user type repo relations define reader: [user] as self `) tk := tuple.NewTupleKey("repo:openfga", "reade...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func BenchmarkListObjectsNoRaceCondition(b *testing.B) { ctx := context.Background() logger := logger.NewNoopLogger() transport := gateway.NewNoopTransport() store := ulid.Make().String() modelID := ulid.Make().String() mockController := gomock.NewController(b) defer mockController.Finish() typedefs := parser...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func TestListObjects_Unoptimized_UnhappyPaths(t *testing.T) { ctx := context.Background() logger := logger.NewNoopLogger() transport := gateway.NewNoopTransport() store := ulid.Make().String() modelID := ulid.Make().String() mockController := gomock.NewController(t) defer mockController.Finish() mockDatastore...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func BenchmarkListObjectsWithConcurrentChecks(b *testing.B, ds storage.OpenFGADatastore) { ctx := context.Background() store := ulid.Make().String() typedefs := parser.MustParse(` type user type document relations define allowed: [user] as self define viewer: [user] as self and allowed `) model :...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func BenchmarkListObjectsWithReverseExpand(b *testing.B, ds storage.OpenFGADatastore) { ctx := context.Background() store := ulid.Make().String() model := &openfgapb.AuthorizationModel{ Id: ulid.Make().String(), SchemaVersion: typesystem.SchemaVersion1_1, TypeDefinitions: []*openfgapb.TypeDefiniti...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func New(model *openfgapb.AuthorizationModel) *TypeSystem { tds := make(map[string]*openfgapb.TypeDefinition, len(model.GetTypeDefinitions())) relations := make(map[string]map[string]*openfgapb.Relation, len(model.GetTypeDefinitions())) for _, td := range model.GetTypeDefinitions() { typeName := td.GetType() t...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func TestSuccessfulRewriteValidations(t *testing.T) { var tests = []struct { name string model *openfgapb.AuthorizationModel }{ { name: "empty_relations", model: &openfgapb.AuthorizationModel{ SchemaVersion: SchemaVersion1_1, TypeDefinitions: []*openfgapb.TypeDefinition{ { Type: "repo"...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (c *LocalChecker) checkComputedUserset(parentctx context.Context, req *ResolveCheckRequest, rewrite *openfgav1.Userset_ComputedUserset) CheckHandlerFunc { return func(ctx context.Context) (*ResolveCheckResponse, error) { ctx, span := tracer.Start(ctx, "checkComputedUserset") defer span.End() rewrittenTupl...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (c *LocalChecker) ResolveCheck( ctx context.Context, req *ResolveCheckRequest, ) (*ResolveCheckResponse, error) { ctx, span := tracer.Start(ctx, "ResolveCheck") defer span.End() span.SetAttributes(attribute.String("tuple_key", req.GetTupleKey().String())) if req.GetResolutionMetadata().Depth == 0 { retur...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (q *ListObjectsQuery) Execute( ctx context.Context, req *openfgav1.ListObjectsRequest, ) (*ListObjectsResponse, error) { resultsChan := make(chan ListObjectsResult, 1) maxResults := q.listObjectsMaxResults if maxResults > 0 { resultsChan = make(chan ListObjectsResult, maxResults) } timeoutCtx := ctx if...
1
Go
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
safe
func (g *GatewayRoute) GetRoute() *http.ServeMux { gatewayMux := http.NewServeMux() gatewayMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/ping" { w.WriteHeader(http.StatusOK) if _, err := w.Write([]byte("pong from gateway service")); err != nil { logger.Error("Failed...
1
Go
CWE-306
Missing Authentication for Critical Function
The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
safe
func rewriteRequestSourceIP(r *http.Request) { // we may receive two kinds of requests. a request from reverse proxy. a request from client. // in reverse proxy, X-Forwarded-For will like // `X-Forwarded-For:[192.168.6.102]`(normal) // `X-Forwarded-For:[::1, 192.168.6.102]`(hacked) Note: the ::1 is inject by attac...
1
Go
CWE-306
Missing Authentication for Critical Function
The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
safe
func (s *connectionsStruct) MountSmaba(username, host, directory, port, mountPoint, password string) error { err := unix.Mount( fmt.Sprintf("//%s/%s", host, directory), mountPoint, "cifs", unix.MS_NOATIME|unix.MS_NODEV|unix.MS_NOSUID, fmt.Sprintf("username=%s,password=%s", username, password), ) return err...
1
Go
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
safe
Skipper: func(c echo.Context) bool { return c.RealIP() == "::1" || c.RealIP() == "127.0.0.1" // return true }, ParseTokenFunc: func(token string, c echo.Context) (interface{}, error) { // claims, code := jwt.Validate(token) // TODO - needs JWT validation // if code != common_err.SUCCESS { // retur...
1
Go
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
safe
func (r *Reader) readBytes(op string) []byte { size := int(r.ReadLong()) if size < 0 { fnName := "Read" + strings.ToTitle(op) r.ReportError(fnName, "invalid "+op+" length") return nil } if size == 0 { return []byte{} } if max := r.cfg.getMaxByteSliceSize(); max > 0 && size > max { fnName := "Read" + str...
1
Go
CWE-400
Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
func TestReader_ReadStringLargerThanMaxByteSliceSize(t *testing.T) { data := []byte{ 246, 255, 255, 255, 255, 10, 255, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, } r := avro....
1
Go
CWE-400
Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
func TestReader_ReadBytesLargerThanMaxByteSliceSize(t *testing.T) { data := []byte{ 246, 255, 255, 255, 255, 10, 255, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, } r := avro.N...
1
Go
CWE-400
Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
safe
func (u *MysqlService) ChangeAccess(info dto.ChangeDBInfo) error { if cmd.CheckIllegal(info.Value) { return buserr.New(constant.ErrCmdIllegal) } var ( mysql model.DatabaseMysql err error ) if info.ID != 0 { mysql, err = mysqlRepo.Get(commonRepo.WithByID(info.ID)) if err != nil { return err } if ...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func (u *MysqlService) Create(ctx context.Context, req dto.MysqlDBCreate) (*model.DatabaseMysql, error) { if cmd.CheckIllegal(req.Name, req.Username, req.Password, req.Format, req.Permission) { return nil, buserr.New(constant.ErrCmdIllegal) } if req.Username == "root" { return nil, errors.New("Cannot set root a...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func (u *SSHService) GenerateSSH(req dto.GenerateSSH) error { if cmd.CheckIllegal(req.EncryptionMode, req.Password) { return buserr.New(constant.ErrCmdIllegal) } currentUser, err := user.Current() if err != nil { return fmt.Errorf("load current user failed, err: %v", err) } secretFile := fmt.Sprintf("%s/.ssh/...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func (f *Firewall) RichRules(rule FireInfo, operation string) error { if cmd.CheckIllegal(operation, rule.Address, rule.Protocol, rule.Port, rule.Strategy) { return buserr.New(constant.ErrCmdIllegal) } ruleStr := "" if strings.Contains(rule.Address, "-") { std, err := cmd.Execf("firewall-cmd --permanent --new-i...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func (f *Firewall) Port(port FireInfo, operation string) error { if cmd.CheckIllegal(operation, port.Protocol, port.Port) { return buserr.New(constant.ErrCmdIllegal) } stdout, err := cmd.Execf("firewall-cmd --zone=public --%s-port=%s/%s --permanent", operation, port.Port, port.Protocol) if err != nil { return ...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func (f *Ufw) RichRules(rule FireInfo, operation string) error { switch rule.Strategy { case "accept": rule.Strategy = "allow" case "drop": rule.Strategy = "deny" default: return fmt.Errorf("unsupport strategy %s", rule.Strategy) } if cmd.CheckIllegal(operation, rule.Protocol, rule.Address, rule.Port) { ...
1
Go
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
func GetSchemaVersion(version string) string { minorVersion := GetMinorVersion(version) return minorVersion + ".0" }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func GetSchemaVersion(version string) string { minorVersion := GetMinorVersion(version) return minorVersion + ".0" }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func GetSchemaVersion(version string) string { minorVersion := GetMinorVersion(version) return minorVersion + ".0" }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func GetSchemaVersion(version string) string { minorVersion := GetMinorVersion(version) return minorVersion + ".0" }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
static void cmd_sdbk(Sdb *db, const char *input) { char *out = (input[0] == ' ') ? sdb_querys (db, NULL, 0, input + 1) : sdb_querys (db, NULL, 0, "*"); if (out) { r_cons_println (out); free (out); } else { R_LOG_ERROR ("Usage: ask [query]"); } }
0
Go
CWE-787
Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
vulnerable
static void cmd_anal_ucall_ref(RCore *core, ut64 addr) { RAnalFunction * fcn = r_anal_get_function_at (core->anal, addr); if (fcn) { r_cons_printf (" ; %s", fcn->name); } else { r_cons_printf (" ; 0x%" PFMT64x, addr); } }
0
Go
CWE-787
Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
vulnerable
static void axfm(RCore *core) { RVecAnalRef *refs = r_anal_xrefs_get_from (core->anal, UT64_MAX); if (refs && !RVecAnalRef_empty (refs)) { RVecAnalRef_sort (refs, compare_ref); ut64 last_addr = UT64_MAX; RAnalRef *ref; R_VEC_FOREACH (refs, ref) { const bool is_first = ref->addr != last_addr; const char...
0
Go
CWE-787
Out-of-bounds Write
The product writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
vulnerable
func (cr *collectionRepo) AddCollection(ctx context.Context, collection *entity.Collection) (err error) { id, err := cr.uniqueIDRepo.GenUniqueIDStr(ctx, collection.TableName()) if err == nil { collection.ID = id _, err = cr.data.DB.Insert(collection) if err != nil { return errors.InternalServer(reason.Databa...
0
Go
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The product contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
https://cwe.mitre.org/data/definitions/362.html
vulnerable
func (uc *UserController) RetrievePassWord(ctx *gin.Context) { req := &schema.UserRetrievePassWordRequest{} if handler.BindAndCheck(ctx, req) { return } captchaPass := uc.actionService.ActionRecordVerifyCaptcha(ctx, schema.ActionRecordTypeFindPass, ctx.ClientIP(), req.CaptchaID, req.CaptchaCode) if !captchaPass ...
0
Go
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
func (sc *SiteInfoController) UpdateGeneral(ctx *gin.Context) { req := schema.SiteGeneralReq{} if handler.BindAndCheck(ctx, &req) { return } err := sc.siteInfoService.SaveSiteGeneral(ctx, req) handler.HandleResponse(ctx, err, nil) }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func (req *UpdateInfoRequest) Check() (errFields []*validator.FormErrorField, err error) { if len(req.Username) > 0 { if checker.IsInvalidUsername(req.Username) { errField := &validator.FormErrorField{ ErrorField: "username", ErrorMsg: reason.UsernameInvalid, } errFields = append(errFields, errFie...
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func (uc *UserController) RetrievePassWord(ctx *gin.Context) { req := &schema.UserRetrievePassWordRequest{} if handler.BindAndCheck(ctx, req) { return } captchaPass := uc.actionService.ActionRecordVerifyCaptcha(ctx, schema.ActionRecordTypeFindPass, ctx.ClientIP(), req.CaptchaID, req.CaptchaCode) if !captchaPass ...
0
Go
CWE-203
Observable Discrepancy
The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor, which exposes security-relevant information about the state of the product, such as whether a particular operation was successful or not.
https://cwe.mitre.org/data/definitions/203.html
vulnerable
func (us *UserService) RetrievePassWord(ctx context.Context, req *schema.UserRetrievePassWordRequest) (string, error) { userInfo, has, err := us.userRepo.GetByEmail(ctx, req.Email) if err != nil { return "", err } if !has { return "", errors.BadRequest(reason.UserNotFound) } // send email data := &schema.Em...
0
Go
CWE-203
Observable Discrepancy
The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor, which exposes security-relevant information about the state of the product, such as whether a particular operation was successful or not.
https://cwe.mitre.org/data/definitions/203.html
vulnerable
func (tr *GetTagResp) GetExcerpt() { excerpt := strings.TrimSpace(tr.OriginalText) idx := strings.Index(excerpt, "\n") if idx >= 0 { excerpt = excerpt[0:idx] } tr.Excerpt = excerpt }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func (tr *GetTagResp) GetExcerpt() { excerpt := strings.TrimSpace(tr.OriginalText) idx := strings.Index(excerpt, "\n") if idx >= 0 { excerpt = excerpt[0:idx] } tr.Excerpt = excerpt }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func (tr *GetTagResp) GetExcerpt() { excerpt := strings.TrimSpace(tr.OriginalText) idx := strings.Index(excerpt, "\n") if idx >= 0 { excerpt = excerpt[0:idx] } tr.Excerpt = excerpt }
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func Markdown2HTML(source string) string { mdConverter := goldmark.New( goldmark.WithExtensions(&DangerousHTMLFilterExtension{}, extension.GFM), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), goldmark.WithRendererOptions( goldmarkHTML.WithHardWraps(), ), ) var buf bytes.Buffer if err := ...
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func Markdown2HTML(source string) string { mdConverter := goldmark.New( goldmark.WithExtensions(&DangerousHTMLFilterExtension{}, extension.GFM), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), goldmark.WithRendererOptions( goldmarkHTML.WithHardWraps(), ), ) var buf bytes.Buffer if err := ...
0
Go
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
func (uc *UserController) UseRePassWord(ctx *gin.Context) { req := &schema.UserRePassWordRequest{} if handler.BindAndCheck(ctx, req) { return } req.Content = uc.emailService.VerifyUrlExpired(ctx, req.Code) if len(req.Content) == 0 { handler.HandleResponse(ctx, errors.Forbidden(reason.EmailVerifyURLExpired), ...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (uc *UserController) UserModifyPassWord(ctx *gin.Context) { req := &schema.UserModifyPassWordRequest{} if handler.BindAndCheck(ctx, req) { return } req.UserID = middleware.GetLoginUserIDFromContext(ctx) oldPassVerification, err := uc.userService.UserModifyPassWordVerification(ctx, req) if err != nil { h...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (ar *authRepo) RemoveUserTokens(ctx context.Context, userID string) { key := constant.UserTokenMappingCacheKey + userID resp, _ := ar.data.Cache.GetString(ctx, key) mapping := make(map[string]bool, 0) if len(resp) > 0 { _ = json.Unmarshal([]byte(resp), &mapping) log.Debugf("find %d user tokens by user id %...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (u *UserModifyPassWordRequest) Check() (errFields []*validator.FormErrorField, err error) { // TODO i18n err = checker.CheckPassword(8, 32, 0, u.Pass) if err != nil { errField := &validator.FormErrorField{ ErrorField: "pass", ErrorMsg: err.Error(), } errFields = append(errFields, errField) retur...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (as *AuthService) RemoveUserTokens(ctx context.Context, userID string) { as.authRepo.RemoveUserTokens(ctx, userID) }
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserAdminService) UpdateUserPassword(ctx context.Context, req *schema.UpdateUserPasswordReq) (err error) { // Users cannot modify their password if req.UserID == req.LoginUserID { return errors.BadRequest(reason.AdminCannotUpdateTheirPassword) } userInfo, exist, err := us.userRepo.GetUserInfo(ctx, req.U...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserAdminService) UpdateUserRole(ctx context.Context, req *schema.UpdateUserRoleReq) (err error) { // Users cannot modify their roles if req.UserID == req.LoginUserID { return errors.BadRequest(reason.UserCannotUpdateYourRole) } err = us.userRoleRelService.SaveUserRole(ctx, req.UserID, req.RoleID) if ...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserService) UserModifyPassword(ctx context.Context, request *schema.UserModifyPassWordRequest) error { enpass, err := us.encryptPassword(ctx, request.Pass) if err != nil { return err } userInfo, has, err := us.userRepo.GetByUserID(ctx, request.UserID) if err != nil { return err } if !has { retur...
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserService) UserModifyPassWordVerification(ctx context.Context, request *schema.UserModifyPassWordRequest) (bool, error) { userInfo, has, err := us.userRepo.GetByUserID(ctx, request.UserID) if err != nil { return false, err } if !has { return false, fmt.Errorf("user does not exist") } isPass := us....
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserService) UseRePassword(ctx context.Context, req *schema.UserRePassWordRequest) (resp *schema.GetUserResp, err error) { data := &schema.EmailCodeContent{} err = data.FromJSONString(req.Content) if err != nil { return nil, errors.BadRequest(reason.EmailVerifyURLExpired) } userInfo, exist, err := us....
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (us *UserService) verifyPassword(ctx context.Context, LoginPass, UserPass string) bool { err := bcrypt.CompareHashAndPassword([]byte(UserPass), []byte(LoginPass)) return err == nil }
0
Go
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
func (m *MyValidator) Check(value interface{}) (errFields []*FormErrorField, err error) { err = m.Validate.Struct(value) if err != nil { var valErrors validator.ValidationErrors if !errors.As(err, &valErrors) { log.Error(err) return nil, errors.New("validate check exception") } for _, fieldError := ran...
0
Go
CWE-521
Weak Password Requirements
The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.
https://cwe.mitre.org/data/definitions/521.html
vulnerable
func (u *UserRePassWordRequest) Check() (errFields []*validator.FormErrorField, err error) { // TODO i18n err = checker.CheckPassword(8, 32, 0, u.Pass) if err != nil { errField := &validator.FormErrorField{ ErrorField: "pass", ErrorMsg: err.Error(), } errFields = append(errFields, errField) return er...
0
Go
CWE-521
Weak Password Requirements
The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.
https://cwe.mitre.org/data/definitions/521.html
vulnerable
func (u *UserModifyPasswordReq) Check() (errFields []*validator.FormErrorField, err error) { // TODO i18n err = checker.CheckPassword(8, 32, 0, u.Pass) if err != nil { errField := &validator.FormErrorField{ ErrorField: "pass", ErrorMsg: err.Error(), } errFields = append(errFields, errField) return er...
0
Go
CWE-521
Weak Password Requirements
The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.
https://cwe.mitre.org/data/definitions/521.html
vulnerable
func (u *UserRegisterReq) Check() (errFields []*validator.FormErrorField, err error) { // TODO i18n err = checker.CheckPassword(8, 32, 0, u.Pass) if err != nil { errField := &validator.FormErrorField{ ErrorField: "pass", ErrorMsg: err.Error(), } errFields = append(errFields, errField) return errField...
0
Go
CWE-521
Weak Password Requirements
The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.
https://cwe.mitre.org/data/definitions/521.html
vulnerable
func (vc *VoteController) VoteDown(ctx *gin.Context) { req := &schema.VoteReq{} if handler.BindAndCheck(ctx, req) { return } req.ObjectID = uid.DeShortID(req.ObjectID) req.UserID = middleware.GetLoginUserIDFromContext(ctx) can, needRank, err := vc.rankService.CheckVotePermission(ctx, req.UserID, req.ObjectID, f...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vc *VoteController) VoteUp(ctx *gin.Context) { req := &schema.VoteReq{} if handler.BindAndCheck(ctx, req) { return } req.ObjectID = uid.DeShortID(req.ObjectID) req.UserID = middleware.GetLoginUserIDFromContext(ctx) can, needRank, err := vc.rankService.CheckVotePermission(ctx, req.UserID, req.ObjectID, tru...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *AnswerActivityRepo) DeleteQuestion(ctx context.Context, questionID string) (err error) { questionInfo := &entity.Question{} exist, err := ar.data.DB.Context(ctx).Where("id = ?", questionID).Get(questionInfo) if err != nil { return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() } ...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func NewQuestionActivityRepo( data *data.Data, activityRepo activity_common.ActivityRepo, userRankRepo rank.UserRankRepo, ) activity.QuestionActivityRepo { return &AnswerActivityRepo{ data: data, activityRepo: activityRepo, userRankRepo: userRankRepo, } }
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *AnswerActivityRepo) DeleteAnswer(ctx context.Context, answerID string) (err error) { answerInfo := &entity.Answer{} exist, err := ar.data.DB.Context(ctx).Where("id = ?", answerID).Get(answerInfo) if err != nil { return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() } if !exist {...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *FollowRepo) FollowCancel(ctx context.Context, objectID, userID string) error { objectTypeStr, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() } activityType, err := ar.activityRepo.GetActivityTypeByObjKey(ctx, ...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *FollowRepo) Follow(ctx context.Context, objectID, userID string) error { objectTypeStr, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() } activityType, err := ar.activityRepo.GetActivityTypeByObjKey(ctx, object...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *UserActiveActivityRepo) UserActive(ctx context.Context, userID string) (err error) { cfg, err := ar.configService.GetConfigByKey(ctx, UserActivated) if err != nil { return err } activityType := cfg.ID deltaRank := cfg.GetIntValue() addActivity := &entity.Activity{ UserID: userID, ObjectI...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) ListUserVotes(ctx context.Context, userID string, page int, pageSize int, activityTypes []int) (voteList []entity.Activity, total int64, err error) { session := vr.data.DB.Context(ctx) cond := builder. And( builder.Eq{"user_id": userID}, builder.Eq{"cancelled": 0}, builder.In("activity...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) VoteDownCancel(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error) { var objectType string resp = &schema.VoteResp{} objectType, err = obj.GetObjectTypeStrByObjectID(objectID) if err != nil { err = errors.BadRequest(reason.ObjectNotFound) re...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func NewVoteRepo( data *data.Data, uniqueIDRepo unique.UniqueIDRepo, configService *config.ConfigService, activityRepo activity_common.ActivityRepo, userRankRepo rank.UserRankRepo, voteCommon activity_common.VoteRepo, notificationQueueService notice_queue.NotificationQueueService, ) service.VoteRepo { return &V...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) updateVotes(ctx context.Context, session *xorm.Session, objectID string, votes int) (err error) { var ( objectType string e error ) objectType, err = obj.GetObjectTypeStrByObjectID(objectID) switch objectType { case "question": _, err = session.Where("id = ?", objectID).Incr("vo...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) sendNotification(ctx context.Context, activityUserID, objectUserID, objectID string) { objectType, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return } msg := &schema.NotificationMsg{ ReceiverUserID: activityUserID, TriggerUserID: objectUserID, Type: schem...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) VoteUp(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error) { resp = &schema.VoteResp{} objectType, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { err = errors.BadRequest(reason.ObjectNotFound) return } actions, ok := LimitU...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) VoteDown(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error) { resp = &schema.VoteResp{} objectType, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { err = errors.BadRequest(reason.ObjectNotFound) return } actions, ok := Limit...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) VoteUpCancel(ctx context.Context, objectID string, userID, objectUserID string) (resp *schema.VoteResp, err error) { var objectType string resp = &schema.VoteResp{} objectType, err = obj.GetObjectTypeStrByObjectID(objectID) if err != nil { err = errors.BadRequest(reason.ObjectNotFound) retu...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) GetVoteResultByObjectId(ctx context.Context, objectID string) (resp *schema.VoteResp, err error) { resp = &schema.VoteResp{} for _, action := range []string{"vote_up", "vote_down"} { var ( activity entity.Activity votes int64 activityType int ) activityType, _, _, _ = vr...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vr *VoteRepo) CheckRank(ctx context.Context, objectID, objectUserID, userID string, action string) (activityUserID string, activityType, rank, hasRank int, err error) { activityType, rank, hasRank, err = vr.activityRepo.GetActivityTypeByObjID(ctx, objectID, action) if err != nil { return } activityUserID ...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *ActivityRepo) GetActivityTypeByObjID(ctx context.Context, objectID string, action string) ( activityType, rank, hasRank int, err error) { objectKey, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return } confKey := fmt.Sprintf("%s.%s", objectKey, action) cfg, err := ar.configService...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *ActivityRepo) GetActivityTypeByObjKey(ctx context.Context, objectKey, action string) (activityType int, err error) { configKey := fmt.Sprintf("%s.%s", objectKey, action) cfg, err := ar.configService.GetConfigByKey(ctx, configKey) if err != nil { return 0, errors.InternalServer(reason.DatabaseError).WithE...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *FollowRepo) IsFollowed(ctx context.Context, userID, objectID string) (followed bool, err error) { objectKey, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return false, err } activityType, err := ar.activityRepo.GetActivityTypeByObjKey(ctx, objectKey, "follow") if err != nil { retu...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *FollowRepo) GetFollowUserIDs(ctx context.Context, objectID string) (userIDs []string, err error) { objectTypeStr, err := obj.GetObjectTypeStrByObjectID(objectID) if err != nil { return nil, err } activityType, err := ar.activityRepo.GetActivityTypeByObjKey(ctx, objectTypeStr, "follow") if err != nil { ...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ar *FollowRepo) GetFollowIDs(ctx context.Context, userID, objectKey string) (followIDs []string, err error) { followIDs = make([]string, 0) activityType, err := ar.activityRepo.GetActivityTypeByObjKey(ctx, objectKey, "follow") if err != nil { return nil, errors.InternalServer(reason.DatabaseError).WithError(...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ur *UserRankRepo) TriggerUserRank(ctx context.Context, session *xorm.Session, userID string, deltaRank int, activityType int, ) (isReachStandard bool, err error) { // IMPORTANT: If user center enabled the rank agent, then we should not change user rank. if plugin.RankAgentEnabled() { return false, nil } if...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (ur *userRepo) GetByUsernames(ctx context.Context, usernames []string) ([]*entity.User, error) { list := make([]*entity.User, 0) err := ur.data.DB.Where("status =?", entity.UserStatusAvailable).In("username", usernames).Find(&list) if err != nil { err = errors.InternalServer(reason.DatabaseError).WithError(er...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func NewAnswerActivityService( answerActivityRepo AnswerActivityRepo, questionActivityRepo QuestionActivityRepo) *AnswerActivityService { return &AnswerActivityService{ answerActivityRepo: answerActivityRepo, questionActivityRepo: questionActivityRepo, } }
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (as *AnswerActivityService) DeleteQuestion(ctx context.Context, questionID string, createdAt time.Time, voteCount int) (err error) { if voteCount >= 3 { log.Infof("There is no need to roll back the reputation by answering likes above the target value. %s %d", questionID, voteCount) return nil } if createdA...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (as *AnswerActivityService) DeleteAnswer(ctx context.Context, answerID string, createdAt time.Time, voteCount int) (err error) { if voteCount >= 3 { log.Infof("There is no need to roll back the reputation by answering likes above the target value. %s %d", answerID, voteCount) return nil } if createdAt.Befo...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vs *VoteService) GetObjectUserID(ctx context.Context, objectID string) (userID string, err error) { var objectKey string objectKey, err = obj.GetObjectTypeStrByObjectID(objectID) if err != nil { err = nil return } switch objectKey { case "question": object, has, e := vs.questionRepo.GetQuestion(ctx,...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vs *VoteService) VoteDown(ctx context.Context, dto *schema.VoteDTO) (voteResp *schema.VoteResp, err error) { voteResp = &schema.VoteResp{} var objectUserID string objectUserID, err = vs.GetObjectUserID(ctx, dto.ObjectID) if err != nil { return } // check user is voting self or not if objectUserID == d...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (vs *VoteService) VoteUp(ctx context.Context, dto *schema.VoteDTO) (voteResp *schema.VoteResp, err error) { voteResp = &schema.VoteResp{} var objectUserID string objectUserID, err = vs.GetObjectUserID(ctx, dto.ObjectID) if err != nil { return } // check user is voting self or not if objectUserID == dto...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func NewVoteService( VoteRepo VoteRepo, uniqueIDRepo unique.UniqueIDRepo, configService *config.ConfigService, questionRepo questioncommon.QuestionRepo, answerRepo answercommon.AnswerRepo, commentCommonRepo comment_common.CommentCommonRepo, objectService *object_info.ObjService, ) *VoteService { return &VoteSer...
0
Go
CWE-366
Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
https://cwe.mitre.org/data/definitions/366.html
vulnerable
func (am *AuthUserMiddleware) AdminAuth() gin.HandlerFunc { return func(ctx *gin.Context) { token := ExtractToken(ctx) if len(token) == 0 { handler.HandleResponse(ctx, errors.Unauthorized(reason.UnauthorizedError), nil) ctx.Abort() return } userInfo, err := am.authService.GetAdminUserCacheInfo(ctx, to...
0
Go
CWE-306
Missing Authentication for Critical Function
The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
vulnerable