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 (ns *nodeServer) prepareSessMgr(workDir string) error { sessMgrLabelKey := common.SessMgrNodeSelectorKey var labelsToModify common.LabelsToModify labelsToModify.Add(sessMgrLabelKey, "true") node, err := ns.getNode() if err != nil { return errors.Wrapf(err, "can't get node %s", ns.nodeId) } _, err = util...
0
Go
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
func (ns *nodeServer) getNode() (node *v1.Node, err error) { // Default to allow patch stale node info if envVar, found := os.LookupEnv(AllowPatchStaleNodeEnv); !found || envVar == "true" { if ns.node != nil { glog.V(3).Infof("Found cached node %s", ns.node.Name) return ns.node, nil } } if node, err = ku...
0
Go
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
func Register(mgr manager.Manager, cfg config.Config) error { csiDriver := NewDriver(cfg.NodeId, cfg.Endpoint, mgr.GetClient(), mgr.GetAPIReader()) if err := mgr.Add(csiDriver); err != nil { return err } return nil }
0
Go
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
func AccountPostLogin(w http.ResponseWriter, r *http.Request) { account, err := (&models.Account{Context: ctx.Context}).FromBody(r) if err != nil { ctx.HandleStatus(w, r, err.Error(), http.StatusBadRequest) return } var a1 = &models.Account{Context: ctx.Context} a1.FromData(account) a1, err = a1.Get() if er...
0
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
vulnerable
func authenticateDNSToken(tokenString string) bool { tokens := strings.Split(tokenString, " ") if len(tokens) < 2 { return false } return tokens[1] == servercfg.GetDNSKey() }
0
Go
CWE-798
Use of Hard-coded Credentials
The product contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data.
https://cwe.mitre.org/data/definitions/798.html
vulnerable
func GetDNSKey() string { key := "secretkey" if os.Getenv("DNS_KEY") != "" { key = os.Getenv("DNS_KEY") } else if config.Config.Server.DNSKey != "" { key = config.Config.Server.DNSKey } return key }
0
Go
CWE-798
Use of Hard-coded Credentials
The product contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data.
https://cwe.mitre.org/data/definitions/798.html
vulnerable
eg.Go(func() error { var err error policyOutput, err = policyEvaluator.Evaluate(ectx, &PolicyRequest{ HTTP: req.HTTP, Session: req.Session, IsValidClientCertificate: isValidClientCertificate, }) return err })
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func NewHeadersRequestFromPolicy(policy *config.Policy, hostname string) *HeadersRequest { input := new(HeadersRequest) input.EnableGoogleCloudServerlessAuthentication = policy.EnableGoogleCloudServerlessAuthentication input.EnableRoutingKey = policy.EnvoyOpts.GetLbPolicy() == envoy_config_cluster_v3.Cluster_RING_HA...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (a *Authorize) getMatchingPolicy(requestURL url.URL) *config.Policy { options := a.currentOptions.Load() for _, p := range options.GetAllPolicies() { if p.Matches(requestURL) { return &p } } return nil }
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (a *Authorize) getEvaluatorRequestFromCheckRequest( in *envoy_service_auth_v3.CheckRequest, sessionState *sessions.State, ) (*evaluator.Request, error) { requestURL := getCheckRequestURL(in) req := &evaluator.Request{ HTTP: evaluator.NewRequestHTTP( in.GetAttributes().GetRequest().GetHttp().GetMethod(), ...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func init() { disableExtAuthz = marshalAny(&envoy_extensions_filters_http_ext_authz_v3.ExtAuthzPerRoute{ Override: &envoy_extensions_filters_http_ext_authz_v3.ExtAuthzPerRoute_Disabled{ Disabled: true, }, }) }
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (b *Builder) buildControlPlanePrefixRoute( options *config.Options, prefix string, protected bool, requireStrictTransportSecurity bool, ) *envoy_config_route_v3.Route { r := &envoy_config_route_v3.Route{ Name: "pomerium-prefix-" + prefix, Match: &envoy_config_route_v3.RouteMatch{ PathSpecifier: &envoy_...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (b *Builder) buildControlPlanePathRoute( options *config.Options, path string, protected bool, requireStrictTransportSecurity bool, ) *envoy_config_route_v3.Route { r := &envoy_config_route_v3.Route{ Name: "pomerium-path-" + path, Match: &envoy_config_route_v3.RouteMatch{ PathSpecifier: &envoy_config_r...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (b *Builder) buildPomeriumAuthenticateHTTPRoutes( options *config.Options, host string, requireStrictTransportSecurity bool, ) ([]*envoy_config_route_v3.Route, error) { if !config.IsAuthenticate(options.Services) { return nil, nil } for _, fn := range []func() (*url.URL, error){ options.GetAuthenticateU...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (b *Builder) buildPomeriumHTTPRoutes( options *config.Options, host string, requireStrictTransportSecurity bool, ) ([]*envoy_config_route_v3.Route, error) { var routes []*envoy_config_route_v3.Route // if this is the pomerium proxy in front of the the authenticate service, don't add // these routes since th...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (b *Builder) buildGRPCRoutes() ([]*envoy_config_route_v3.Route, error) { action := &envoy_config_route_v3.Route_Route{ Route: &envoy_config_route_v3.RouteAction{ ClusterSpecifier: &envoy_config_route_v3.RouteAction_Cluster{ Cluster: "pomerium-control-plane-grpc", }, }, } return []*envoy_config_rou...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func Test_buildControlPlanePathRoute(t *testing.T) { options := config.NewDefaultOptions() b := &Builder{filemgr: filemgr.NewManager()} route := b.buildControlPlanePathRoute(options, "/hello/world", false, false) testutil.AssertProtoJSONEqual(t, ` { "name": "pomerium-path-/hello/world", "match": { "path...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func Test_buildControlPlanePrefixRoute(t *testing.T) { options := config.NewDefaultOptions() b := &Builder{filemgr: filemgr.NewManager()} route := b.buildControlPlanePrefixRoute(options, "/hello/world/", false, false) testutil.AssertProtoJSONEqual(t, ` { "name": "pomerium-prefix-/hello/world/", "match": { ...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
func (p *Policy) ToPPL() *parser.Policy { ppl := &parser.Policy{} allowRule := parser.Rule{Action: parser.ActionAllow} allowRule.Or = append(allowRule.Or, parser.Criterion{ Name: "pomerium_routes", }) if p.AllowPublicUnauthenticatedAccess { allowRule.Or = append(allowRule.Or, parser.Criterion{ Name...
0
Go
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
err = sigRepo.ListSignatures(ctx, manifestDesc, func(signatureManifests []ocispec.Descriptor) error { for _, sigManifestDesc := range signatureManifests { sigBlob, sigDesc, err := sigRepo.FetchSignatureBlob(ctx, sigManifestDesc) if err != nil { fmt.Fprintf(os.Stderr, "Warning: unable to fetch signature %s ...
0
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
vulnerable
func TestInspectCommand_SecretsFromArgs(t *testing.T) { opts := &inspectOpts{} command := inspectCommand(opts) expected := &inspectOpts{ reference: "ref", SecureFlagOpts: SecureFlagOpts{ Password: "password", InsecureRegistry: true, Username: "user", }, outputFormat: cmd.OutputPlaint...
0
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
vulnerable
func TestInspectCommand_SecretsFromEnv(t *testing.T) { t.Setenv(defaultUsernameEnv, "user") t.Setenv(defaultPasswordEnv, "password") opts := &inspectOpts{} expected := &inspectOpts{ reference: "ref", SecureFlagOpts: SecureFlagOpts{ Password: "password", Username: "user", }, outputFormat: cmd.OutputJSO...
0
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
vulnerable
func runList(ctx context.Context, opts *listOpts) error { // set log level ctx = opts.LoggingFlagOpts.SetLoggerLevel(ctx) // initialize reference := opts.reference sigRepo, err := getRepository(ctx, opts.inputType, reference, &opts.SecureFlagOpts, opts.allowReferrersAPI) if err != nil { return err } targetDe...
0
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
vulnerable
err := sigRepo.ListSignatures(ctx, targetDesc, func(signatureManifests []ocispec.Descriptor) error { for _, sigManifestDesc := range signatureManifests { if prevDigest != "" { // check and print title printTitle() // print each signature digest fmt.Printf(" ├── %s\n", prevDigest) } prevD...
0
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
vulnerable
func runVerify(command *cobra.Command, opts *verifyOpts) error { // set log level ctx := opts.LoggingFlagOpts.SetLoggerLevel(command.Context()) // initialize sigVerifier, err := verifier.NewFromConfig() if err != nil { return err } // set up verification plugin config. configs, err := cmd.ParseFlagMap(opts....
0
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
vulnerable
func TestVerifyCommand_BasicArgs(t *testing.T) { opts := &verifyOpts{} command := verifyCommand(opts) expected := &verifyOpts{ reference: "ref", SecureFlagOpts: SecureFlagOpts{ Username: "user", Password: "password", }, pluginConfig: []string{"key1=val1"}, } if err := command.ParseFlags([]string{ e...
0
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
vulnerable
func TestVerifyCommand_MoreArgs(t *testing.T) { opts := &verifyOpts{} command := verifyCommand(opts) expected := &verifyOpts{ reference: "ref", SecureFlagOpts: SecureFlagOpts{ InsecureRegistry: true, }, pluginConfig: []string{"key1=val1", "key2=val2"}, } if err := command.ParseFlags([]string{ expected...
0
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
vulnerable
func NewQUICServer(addr, password, domain string, tcpTimeout, udpTimeout int, blockDomainList, blockCIDR4List, blockCIDR6List string, updateListInterval int64, blockGeoIP []string, withoutbrook bool) (*QUICServer, error) { if err := limits.Raise(); err != nil { Log(&Error{"when": "try to raise system limits", "warni...
0
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
vulnerable
func (c *StreamClient) Exchange(local net.Conn) error { go func() { for { if c.Timeout != 0 { if err := c.Server.SetDeadline(time.Now().Add(time.Duration(c.Timeout) * time.Second)); err != nil { return } } l, err := c.ReadL() if err != nil { return } if _, err := local.Write(c.RB[2...
0
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
vulnerable
func (c *StreamClient) ReadL() (int, error) { if _, err := io.ReadFull(c.Server, c.RB[:2+16]); err != nil { return 0, err } if _, err := c.sa.Open(c.RB[:0], c.sn, c.RB[:2+16], nil); err != nil { return 0, err } l := int(binary.BigEndian.Uint16(c.RB[:2])) if _, err := io.ReadFull(c.Server, c.RB[2+16:2+16+l+16]...
0
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
vulnerable
func (c *StreamClient) WriteL(l int) error { binary.BigEndian.PutUint16(c.WB[:2], uint16(l)) c.ca.Seal(c.WB[:0], c.cn, c.WB[:2], nil) NextNonce(c.cn) c.ca.Seal(c.WB[:2+16], c.cn, c.WB[2+16:2+16+l], nil) if _, err := c.Server.Write(c.WB[:2+16+l+16]); err != nil { return err } NextNonce(c.cn) return nil }
0
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
vulnerable
func (r *MySQL) Probe() (bool, string) { if r.tls != nil { mysql.RegisterTLSConfig(global.DefaultProg, r.tls) } db, err := sql.Open("mysql", r.ConnStr) if err != nil { return false, err.Error() } defer db.Close() // Check if we need to query specific data if len(r.Data) > 0 { for k, v := range r.Data {...
0
Go
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
func (r *MySQL) getSQL(str string) (string, error) { if len(strings.TrimSpace(str)) == 0 { return "", fmt.Errorf("Empty SQL data") } fields := strings.Split(str, ":") if len(fields) != 5 { return "", fmt.Errorf("Invalid SQL data - [%s]. (syntax: database:table:field:key:value)", str) } db := fields[0] table ...
0
Go
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
func (r *PostgreSQL) getSQL(str string) (string, string, error) { if len(strings.TrimSpace(str)) == 0 { return "", "", fmt.Errorf("Empty SQL data") } fields := strings.Split(str, ":") if len(fields) != 5 { return "", "", fmt.Errorf("Invalid SQL data - [%s]. (syntax: database:table:field:key:value)", str) } db...
0
Go
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
func (v *SnapshotJob) do(ffmpegPath, inputUrl string) (err error) { outputPicDir := path.Join(StaticDir, v.App) if err = os.MkdirAll(outputPicDir, 0777); err != nil { log.Println(fmt.Sprintf("create snapshot image dir:%v failed, err is %v", outputPicDir, err)) return } normalPicPath := path.Join(outputPicDir, ...
0
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
vulnerable
func (r *TerraformRunnerServer) NewTerraform(ctx context.Context, req *NewTerraformRequest) (*NewTerraformReply, error) { r.InstanceID = req.GetInstanceID() log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("creating new terraform", "workingDir", req.WorkingDir, "execPath", req.E...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (r *TerraformRunnerServer) Plan(ctx context.Context, req *PlanRequest) (*PlanReply, error) { log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("creating a plan") ctx, cancel := context.WithCancel(ctx) go func() { select { case <-r.Done: cancel() case <...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (r *TerraformRunnerServer) SaveTFPlan(ctx context.Context, req *SaveTFPlanRequest) (*SaveTFPlanReply, error) { log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("save the plan") if req.TfInstance != r.InstanceID { err := fmt.Errorf("no TF instance found") lo...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (r *TerraformRunnerServer) ShowPlanFileRaw(ctx context.Context, req *ShowPlanFileRawRequest) (*ShowPlanFileRawReply, error) { log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("show the raw plan file") if req.TfInstance != r.InstanceID { err := fmt.Errorf("no ...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (r *TerraformRunnerServer) ShowPlanFile(ctx context.Context, req *ShowPlanFileRequest) (*ShowPlanFileReply, error) { log := controllerruntime.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("show the raw plan file") if req.TfInstance != r.InstanceID { err := fmt.Errorf("no TF instan...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (r *TerraformRunnerServer) Output(ctx context.Context, req *OutputRequest) (*OutputReply, error) { log := ctrl.LoggerFrom(ctx, "instance-id", r.InstanceID).WithName(loggerName) log.Info("creating outputs") if req.TfInstance != r.InstanceID { err := fmt.Errorf("no TF instance found") log.Error(err, "no terra...
0
Go
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
func (ctx *Context) RedirectToFirst(location ...string) { for _, loc := range location { if len(loc) == 0 { continue } // Unfortunately browsers consider a redirect Location with preceding "//" and "/\" as meaning redirect to "http(s)://REST_OF_PATH" // Therefore we should ignore these redirect locations t...
0
Go
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
vulnerable
func (t *assetAction) checkERC20Deposit() error { asset, _ := t.asset.ERC20() return t.bridgeView.FindDeposit( t.erc20D, t.blockHeight, t.logIndex, asset.Address(), ) }
0
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
vulnerable
func (t *assetAction) checkERC20BridgeResumed() error { return t.bridgeView.FindBridgeResumed( t.erc20BridgeResumed, t.blockHeight, t.logIndex) }
0
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
vulnerable
func (t *assetAction) checkERC20AssetList() error { return t.bridgeView.FindAssetList(t.erc20AL, t.blockHeight, t.logIndex) }
0
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
vulnerable
func (t *assetAction) checkERC20BridgeStopped() error { return t.bridgeView.FindBridgeStopped( t.erc20BridgeStopped, t.blockHeight, t.logIndex) }
0
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
vulnerable
func (t *assetAction) checkERC20AssetLimitsUpdated() error { asset, _ := t.asset.ERC20() return t.bridgeView.FindAssetLimitsUpdated( t.erc20AssetLimitsUpdated, t.blockHeight, t.logIndex, asset.Address(), ) }
0
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
vulnerable
func (m *MockERC20BridgeView) FindBridgeResumed(arg0 *types.ERC20EventBridgeResumed, arg1, arg2 uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindBridgeResumed", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 }
0
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
vulnerable
func (m *MockERC20BridgeView) FindDeposit(arg0 *types.ERC20Deposit, arg1, arg2 uint64, arg3 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindDeposit", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 }
0
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
vulnerable
func (mr *MockERC20BridgeViewMockRecorder) FindAssetList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindAssetList", reflect.TypeOf((*MockERC20BridgeView)(nil).FindAssetList), arg0, arg1, arg2) }
0
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
vulnerable
func (m *MockERC20BridgeView) FindBridgeStopped(arg0 *types.ERC20EventBridgeStopped, arg1, arg2 uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindBridgeStopped", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 }
0
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
vulnerable
func (mr *MockERC20BridgeViewMockRecorder) FindDeposit(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindDeposit", reflect.TypeOf((*MockERC20BridgeView)(nil).FindDeposit), arg0, arg1, arg2, arg3) }
0
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
vulnerable
func (m *MockERC20BridgeView) FindAssetList(arg0 *types.ERC20AssetList, arg1, arg2 uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindAssetList", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 }
0
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
vulnerable
func (mr *MockERC20BridgeViewMockRecorder) FindBridgeResumed(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindBridgeResumed", reflect.TypeOf((*MockERC20BridgeView)(nil).FindBridgeResumed), arg0, arg1, arg2) }
0
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
vulnerable
func (mr *MockERC20BridgeViewMockRecorder) FindAssetLimitsUpdated(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindAssetLimitsUpdated", reflect.TypeOf((*MockERC20BridgeView)(nil).FindAssetLimitsUpdated), arg0, arg1, arg2, arg3) }
0
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
vulnerable
func (m *MockERC20BridgeView) FindAssetLimitsUpdated(arg0 *types.ERC20AssetLimitsUpdated, arg1, arg2 uint64, arg3 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindAssetLimitsUpdated", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 }
0
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
vulnerable
func (mr *MockERC20BridgeViewMockRecorder) FindBridgeStopped(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindBridgeStopped", reflect.TypeOf((*MockERC20BridgeView)(nil).FindBridgeStopped), arg0, arg1, arg2) }
0
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
vulnerable
func (e *ERC20LogicView) FindBridgeStopped( al *types.ERC20EventBridgeStopped, blockNumber, logIndex uint64, ) error { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return err } resp := "ok" defer func() { metrics.EthCallInc("find...
0
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
vulnerable
func (e *ERC20LogicView) FindAssetList( al *types.ERC20AssetList, blockNumber, logIndex uint64, ) error { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return err } resp := "ok" defer func() { metrics.EthCallInc("find_asset_list",...
0
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
vulnerable
func (e *ERC20LogicView) FindAssetLimitsUpdated( update *types.ERC20AssetLimitsUpdated, blockNumber uint64, logIndex uint64, ethAssetAddress string, ) error { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return err } resp := "ok" d...
0
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
vulnerable
func (e *ERC20LogicView) FindWithdrawal( w *types.ERC20Withdrawal, blockNumber, logIndex uint64, ethAssetAddress string, ) (*big.Int, string, uint, error) { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return nil, "", 0, err } resp ...
0
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
vulnerable
func (e *ERC20LogicView) FindBridgeResumed( al *types.ERC20EventBridgeResumed, blockNumber, logIndex uint64, ) error { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return err } resp := "ok" defer func() { metrics.EthCallInc("find...
0
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
vulnerable
func (e *ERC20LogicView) FindDeposit( d *types.ERC20Deposit, blockNumber, logIndex uint64, ethAssetAddress string, ) error { bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer( e.clt.CollateralBridgeAddress(), e.clt) if err != nil { return err } resp := "ok" defer func() { metrics.EthCallInc...
0
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
vulnerable
func (*BridgeViewStub) FindDeposit(d *types.ERC20Deposit, blockNumber, logIndex uint64, ethAssetAddress string) error { return nil }
0
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
vulnerable
func (*BridgeViewStub) FindBridgeResumed(al *types.ERC20EventBridgeResumed, blockNumber, logIndex uint64) error { return nil }
0
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
vulnerable
func (*BridgeViewStub) FindBridgeStopped(al *types.ERC20EventBridgeStopped, blockNumber, logIndex uint64) error { return nil }
0
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
vulnerable
func (*BridgeViewStub) FindAssetLimitsUpdated(w *types.ERC20AssetLimitsUpdated, blockNumber, logIndex uint64, ethAssetAddress string) error { return nil }
0
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
vulnerable
func (*BridgeViewStub) FindAssetList(al *types.ERC20AssetList, blockNumber, logIndex uint64) error { return nil }
0
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
vulnerable
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....
0
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
vulnerable
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...
0
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
vulnerable
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 { ...
0
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
vulnerable
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...
0
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
vulnerable
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 == "...
0
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
vulnerable
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...
0
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
vulnerable
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...
0
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
vulnerable
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...
0
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
vulnerable
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...
0
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
vulnerable
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...
0
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
vulnerable
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...
0
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
vulnerable
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 :...
0
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
vulnerable
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...
0
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
vulnerable
func RunQueryTests(t *testing.T, ds storage.OpenFGADatastore) { t.Run("TestReadAuthorizationModelQueryErrors", func(t *testing.T) { TestReadAuthorizationModelQueryErrors(t, ds) }) t.Run("TestSuccessfulReadAuthorizationModelQuery", func(t *testing.T) { TestSuccessfulReadAuthorizationModelQuery(t, ds) }) t.Run("TestRe...
0
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
vulnerable
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() { tds[td.GetType()] = td tdRe...
0
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
vulnerable
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"...
0
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
vulnerable
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() return c.dispa...
0
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
vulnerable
func TestListObjects_Unoptimized_UnhappyPaths_Known_Error(t *testing.T) { ctx := context.Background() store := ulid.Make().String() modelID := ulid.Make().String() mockController := gomock.NewController(t) defer mockController.Finish() mockDatastore := mockstorage.NewMockOpenFGADatastore(mockController) mockD...
0
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
vulnerable
func TestListObjects_Unoptimized_UnhappyPaths(t *testing.T) { ctx := context.Background() store := ulid.Make().String() modelID := ulid.Make().String() mockController := gomock.NewController(t) defer mockController.Finish() mockDatastore := mockstorage.NewMockOpenFGADatastore(mockController) mockDatastore.EXP...
0
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
vulnerable
func PostSambaConnectionsCreate(c *gin.Context) { connection := model.Connections{} c.ShouldBindJSON(&connection) if connection.Port == "" { connection.Port = "445" } if connection.Username == "" || connection.Host == "" { c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.CHARACTER_LIMIT, Messag...
0
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
vulnerable
func (s *connectionsStruct) MountSmaba(username, host, directory, port, mountPoint, password string) string { str := command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;MountCIFS " + username + " " + host + " " + directory + " " + port + " " + mountPoint + " " + password) return str }
0
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
vulnerable
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 { return nil, ec...
0
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
vulnerable
func (r *Reader) readBytes(op string) []byte { size := int(r.ReadLong()) if size < 0 { r.ReportError("ReadString", "invalid "+op+" length") return nil } if size == 0 { return []byte{} } // The bytes are entirely in the buffer and of a reasonable size. // Use the byte slab. if r.head+size <= r.tail && siz...
0
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
vulnerable
func OperateFirewallPort(oldPorts, newPorts []int) error { client, err := firewall.NewFirewallClient() if err != nil { return err } for _, port := range newPorts { if err := client.Port(fireClient.FireInfo{Port: strconv.Itoa(port), Protocol: "tcp", Strategy: "accept"}, "add"); err != nil { return err } }...
0
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
vulnerable
func useAPIAuthentication(next fasthttp.RequestHandler) fasthttp.RequestHandler { token := auth.GetAPIToken() if token == "" { return next } log.Info("enabled token authentication on http server") return func(ctx *fasthttp.RequestCtx) { v := ctx.Request.Header.Peek(authConsts.APITokenHeader) if auth.Exclude...
0
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
vulnerable
func ExcludedRoute(route string) bool { for _, r := range excludedRoutes { if strings.Contains(route, r) { return true } } return false }
0
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
vulnerable
func TestExcludedRoute(t *testing.T) { t.Run("healthz route is excluded", func(t *testing.T) { route := "v1.0/healthz" excluded := ExcludedRoute(route) assert.True(t, excluded) }) t.Run("custom route is not excluded", func(t *testing.T) { route := "v1.0/state" excluded := ExcludedRoute(route) assert.Fal...
0
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
vulnerable
func rawFileHandler(w http.ResponseWriter, r *http.Request, file *files.FileInfo) (int, error) { fd, err := file.Fs.Open(file.Path) if err != nil { return http.StatusInternalServerError, err } defer fd.Close() setContentDisposition(w, r, file) w.Header().Set("Cache-Control", "private") http.ServeContent(w, r...
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 (mbp *multipartBodyProcessor) ProcessRequest(reader io.Reader, v plugintypes.TransactionVariables, options plugintypes.BodyProcessorOptions) error { mimeType := options.Mime storagePath := options.StoragePath mediaType, params, err := mime.ParseMediaType(mimeType) if err != nil { log.Fatalf("failed to parse ...
0
Go
NVD-CWE-noinfo
null
null
null
vulnerable
func getTokenFromStorage(c *fiber.Ctx, token string, cfg Config, sessionManager *sessionManager, storageManager *storageManager) []byte { if cfg.Session != nil { return sessionManager.getRaw(c, token, dummyValue) } return storageManager.getRaw(token) }
0
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
vulnerable
func getTokenFromStorage(c *fiber.Ctx, token string, cfg Config, sessionManager *sessionManager, storageManager *storageManager) []byte { if cfg.Session != nil { return sessionManager.getRaw(c, token, dummyValue) } return storageManager.getRaw(token) }
0
Go
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
func getTokenFromStorage(c *fiber.Ctx, token string, cfg Config, sessionManager *sessionManager, storageManager *storageManager) []byte { if cfg.Session != nil { return sessionManager.getRaw(c, token, dummyValue) } return storageManager.getRaw(token) }
0
Go
CWE-565
Reliance on Cookies without Validation and Integrity Checking
The product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user.
https://cwe.mitre.org/data/definitions/565.html
vulnerable