code-injection

Spring No unique bean of type

泄露秘密 提交于 2019-12-05 03:01:08
i have a little trouble in Spring with two component of a service. I have this component: @Component public class SmartCardWrapper and this one: @Component public class DummySmartCardWrapper extends SmartCardWrapper The service autowire both but spring fails due this expection: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.cinebot.smartcard.SmartCardWrapper] is defined: expected single matching bean but found 2: [dummySmartCardWrapper, smartCardWrapper] Why it doesn't use class names? That's one of the most basic concepts of Spring - Inversion of

security flaw - veracode report - crlf injection

末鹿安然 提交于 2019-12-05 02:47:41
I got the veracode report for my javaEE app. It had a flaw at any logging (using log4j), so I add the StringEscapeUtils.escapeJava(log) to all of them, but veracode keeps reporting them as security flaws. Is this a right solution? What else can I do? This is the report info: Title: Improper Output Neutralization for Logs Description: A function call could result in a log forging attack. Writing unsanitized user-supplied data into a log file allows an attacker to forge log entries or inject malicious content into log files. Corrupted log files can be used to cover an attacker's tracks or as a

Using CDI Injection in a Servlet

狂风中的少年 提交于 2019-12-05 02:42:19
I am attempting to @Inject a @SessionScoped bean into a Filter @WebFilter("/*") public class IdentityFilter implements Filter, Serializable { @Inject private LoginUser loginUser; ... where LoginUser is @SessionScoped The intention is for loginUser to represent the logged in user for the session. The problem is it appears that I am not always getting the loginUser from the current session, I am getting 'leakage' between sessions as one session's LoginUser object is being shared with another session. Obviously this isn't good. I am wondering if this is because the Filter object is a singleton,

Constructor injection with other, non-dependency, constructor arguments

偶尔善良 提交于 2019-12-05 01:49:50
I'm new to IOC containers, and I'm getting started with NInject. What do you do if you want your constructor to have parameters that are not services and don't need to be instantiated by the IOC container? For example: public class Person { private readonly string _name; private readonly IPersonRepository _repository; public Person(string name, IPersonRepository repository) { _name = name; _repository = repository; } ...... } Imagine that name is a requirement of the Person class, so, to ensure that a Person always has a name, we require that it be passed in to the constructor. How would we

Angularjs - how to correct inject service from another module that is not depending?

痞子三分冷 提交于 2019-12-05 01:41:48
I didn't understand how work modular depending. I have 3 modules, they are dependent on each other, as shown in the picture. "App" module includes "module1" and "module2". "module2" includes "core" module. There are source on plunker. angular.module("core", []).factory("HelloWorld", function() { return function () { alert('Hello World!') } }); angular.module("module1", []).controller("main", function(HelloWorld){ HelloWorld(); }); angular.module("module2", ["core"]); angular.module("app", ["module1", "module2"]); If I inject service from module core to module "module1" it is work fine. But

Is it possible to inject a list of resolved objects into a constructor using Autofac?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 00:38:22
I'm new to Autofac (3) and am using it to find a number of classes in several assemblies that implement IRecognizer. So I have: builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies()).As<IRecognizer>(); which is fine. But I'd like to inject references to the found components into a constructor - sort of: public Detector(List<IRecognizer> recognizers) { this.Recognizers = recognizers; } Is there any way to do this? nemesv Autofac supports the IEnumerable<T> as a relationship type: For example, when Autofac is injecting a constructor parameter of type IEnumerable<ITask> it will

mongoDB injection

纵饮孤独 提交于 2019-12-05 00:09:05
is there a common pattern in Java to avoid mongoDB injection attacks? Thanks Use one of the supported drivers. Don't deserialize strings as JSON and pass them as queries, e.g. dont' do this (in Ruby): collection.send(query_type, JSON.parse(parameters)) where query_type and parameters are strings coming from a form. You would have to be criminally stupid to do this though. Since there's no query language as such there's not the same room for injection. Part of the reason that SQL injection attacks are possible is that the action to take ( SELECT , UPDATE , DELETE , etc.) is part of the query

NoSQL Injection? (PHP->phpcassa->Cassandra)

陌路散爱 提交于 2019-12-04 23:42:59
Anyone familiar enough with the Cassandra engine (via PHP using phpcassa lib) to know offhand whether there's a corollary to the sql-injection attack vector? If so, has anyone taken a stab at establishing best practices to thwart them? If not, would anyone like to ; ) No. The Thrift layer used by phpcassa is an rpc framework, not based on string parsing. An update - Cassandra v0.8 introduced CQL , which might have brought with it the possibility of injection attacks. However: Prepared statements were then introduced in Cassandra v1.1.0, which help to prevent such attacks. Furthermore, see this

CreateRemoteThread returning ERROR_ACCESS_DENIED - Windows 7 DLL Injection

坚强是说给别人听的谎言 提交于 2019-12-04 21:14:28
问题 I'm trying to write a program that uses CreateRemoteThread to inject a dll. The problem is that CreateRemoteThread is refusing to work. GetLastError() is returning 5 which is ERROR_ACCESS_DENIED. I cant figure why! I am working from this video http://www.youtube.com/watch?v=H3O3hmXkt1I . #include <iostream> #include <direct.h> #include <Windows.h> #include <TlHelp32.h> using namespace std; char* GetCurrentDir() { char* szRet = (char*)malloc(MAX_PATH); _getcwd(szRet, MAX_PATH); return szRet; }

Safely evaluating arithmetic expressions in R?

﹥>﹥吖頭↗ 提交于 2019-12-04 21:08:17
问题 Edit Ok, since there seems to be a lot of confusion, I'm going to simplify the question a little. You can try to answer the original question below, or you can tackle this version instead and ignore everything below the line. My goal is to take an arbitrary expression and evaluate it in an extremely restricted environment. This environment will contain only variables with the following types of values: Numeric vectors Pure functions that take one or more numeric vectors and return numeric