我想就此得到一些其他意见......
我喜欢桌面应用程序的代码访问安全性的想法.但是在.NET的生命周期中,我不得不承认我从来没有真正遇到CAS实际上阻止某些东西给我带来好处的情况.
但是,我曾多次在映射驱动器上共享快速.NET应用程序这样简单的事情成为企业代码访问的噩梦.必须打破caspol.exe以创建可信路径规则并且没有明确的方法来了解为什么出现故障会使CAS看起来像开发和部署过程中的安慰一样.
我想听听一些CAS实际上帮助不仅仅是伤害的情况,或者是否有其他人对其当前的实施和默认情况感到沮丧.
从.NET 3.5升级某些ASP.NET代码时,我收到以下编译警告错误:'System.Security.Permissions.SecurityAction.RequestMinimum'已过时.
该属性已应用于组合级别:
[assembly: System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)]
Run Code Online (Sandbox Code Playgroud)
此外,代码还使用了P&P Web客户端软件工厂,特别是ObjectBuilder.WCSFExtensions库.此外,代码提供了一些角色提供程序实现.
请记住,此代码在其他项目中用作框架代码,因此很难确定可能存在的安全性要求.
所以milion dolar的问题是:
"System.Security.Permissions.SecurityAction"枚举需要使用什么值?
或者,是否有更好的方法来应用此安全属性?
我有一个PowerShell脚本,我试图从WCF REST服务执行.我正在使用System.Management.Automation和System.Management.Automation.Runspaces程序集.
C#代码如下所示:
Command command = new Command(path);
command.Parameters.Add(param);
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
using (Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration))
{
runspace.Open();
... other code
}
Run Code Online (Sandbox Code Playgroud)
一旦我尝试执行open语句,就会发生此错误:
动态操作只能在同源AppDomain中执行.
我看了看,但没有任何效果.我已经尝试将此行添加到我的web.config:但它没有为我做任何事情.
你有想法吗?
我目前正在创建一个项目MVC site.由于需要插入第三方dll以提供自定义功能,因此该站点需要使用代码访问安全性.现在我们不希望这些程序集具有完全信任,因此在其中使用新的安全模型.NET 4.0
由于这些要求,我们正在强制命名所有自己的程序集,并将它们安装在gac中.其中一些程序集是与SecuritySafeCritical和SecurityCritical类型和成员混合的SecurityTransparent.
securityTransparent和SecurityCritical程序集,类型和成员可以像我们想要的那样由第三方程序集开发人员使用.
我现在对Global.asax文件有这个问题,该文件继承自驻留在标有该AllowPartiallyTrustedCallers属性的程序集中的类.
这个类又继承自HttpApplication.
在我web.config的信任级别目前设置为高.
我收到以下错误:
违反类型的继承安全规则:'ASP.global_asax'.派生类型必须与基本类型的安全可访问性匹配,或者不太容易访问
我想这是因为使用安全模型时的继承规则,并且HttpApplication该类必须具有比SecurityTransparent更严格的规则.
我尝试用SecuritySafeCritical属性标记我的自定义类,但没有运气.
我希望你们中的一些人能解决这个问题.
plugins .net-4.0 code-access-security global-asax asp.net-mvc-3
有没有人在部分信任场景中有F#代码的经验?如在,用[<AllowPartiallyTrustedCallers>]?创建程序集?
我正在开发一些我们需要能够以部分信任方式运行的项目,我们一直在尝试使用2级安全规则(http://msdn.microsoft.com/en-us/library/dd233102. aspx).在实践中,我们的自包含组件很容易 - 只需放置一个属性; 但有时我们的程序集会引用未注释并假定为"SecurityCritical"的第三方DLL.这是它"有趣"的地方.
经过几天的努力,F#似乎存在严重问题..NET安全策略要求您注释类型/方法,[<SecuritySafeCritical>]如果它们引用或调用"SecurityCritical"代码,这些代码恰好是NuGet上的大部分代码,因为这是它默认的代码.现在,在F#中,这可以正常工作,直到你开始使用闭包.你做不到:
namespace Foo
open System.Security
[<assembly: AllowPartiallyTrustedCallers>]
[<assembly: SecurityRules(SecurityRuleSet.Level2)>]
do()
[<SecurityCritical>]
module C =
let get () = [ 1 .. 10 ]
[<SecuritySafeCritical>]
module M =
let foo () =
seq {
for i in 1 .. 10 do
yield!
C.get ()
|> Seq.filter (fun x -> x % 2 = 0)
}
Run Code Online (Sandbox Code Playgroud)
这个程序集无法通过SecAnnotate.exe检查,因为F#编译器将闭包提升到一个单独的类型,现在没有注释[<SecuritySafeCritical>],默认为Transparent,但引用了一些关键代码,这是一个错误.
这听起来像是一个小限制,但它花了我很多时间来改变代码以避免闭包并满足SecAnnotate约束.也许F#可以将安全属性传播给它创建的闭包类型?还有另一个简单的方法,我错过了吗?
我正在通过Microsoft .Net Framework - 应用程序开发基础培训工具包第8章第2课:配置应用程序域
ShowWinIni是我想要执行的程序的程序集名称
object[] hostEvidence = { new Zone(SecurityZone.MyComputer) };
Evidence e = new Evidence(hostEvidence, null);
// Create an AppDomain.
AppDomain d = AppDomain.CreateDomain("New Domain", e);
// Run the assembly
d.ExecuteAssemblyByName("ShowWinIni");
Run Code Online (Sandbox Code Playgroud)
当我执行:
AppDomain d = AppDomain.CreateDomain("New Domain", e);
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:"此方法隐式使用CAS策略,已被.NET Framework废弃.为了兼容性原因启用CAS策略,请使用NetFx40_LegacySecurityPolicy配置开关.请参阅http://go.microsoft .com/fwlink /?LinkID = 155570了解更多信息."
当我创建一个没有Evidence对象的AppDomain时,我可以正常执行程序集.
当然,我访问过http://go.microsoft.com/fwlink/?LinkID=155570,但我仍然对如何创建具有指定权限的应用程序域感到困惑.
我找到的下一个最有用的网站是http://msdn.microsoft.com/en-us/library/bb763046.aspx但我的StrongName对象计算为NULL.
StrongName fullTrustAssembly =
typeof(Program).Assembly.Evidence.GetHostEvidence<StrongName>();
Run Code Online (Sandbox Code Playgroud)
程序是实现所有这些代码的类的名称.
提前感谢您的建议和提示!
对于基于产品的GIT存储库,其中存在用于维护,测试以及未来开发的分支,如何控制用户对这些分支的访问.通过访问,我的意思是即使其他人可能从中读取,他们也不应该无意中将更改推送到回购.
例如,
A - B - C - D - E - F -> master
| | |
V1 V2' exp
|
V2
Run Code Online (Sandbox Code Playgroud)
"B"是用于带有标记V1的Branch的提交 - 用于产品的已发布版本.只有支持/维护工程师才能访问此项.
C用于最近冻结的预发布产品V2',并且应该只允许关键的show-stopper错误修复,因此只有某些开发人员和测试团队才能访问它.当V2从该分支释放时,只有支持应该像V1一样访问它.
E用于分支测试未来V3的新功能 - 只有开发人员而不是支持人员才能访问它.
"主"更改只能由中央集成团队在请求的基础上合并(类似于GitHub).
如何用git实现上述目标?我记得看到gitosis和其他一些外部工具 - 这些对于使用git进行安全操作至关重要,还是有其他最佳实践?
谢谢.
添加了 Gitflow最佳实践分支模型
我无法理解如何为C++/CLI项目修复CA2123.这是一个演示该问题的示例项目:
1)创建一个C#(.NET 4)类库
ManagedClass.cs
namespace CSharpLibrary {
public interface IManagedClass
{
void WriteSomething();
}
public class ManagedClass : IManagedClass
{
public void WriteSomething()
{
}
}
Run Code Online (Sandbox Code Playgroud)
}
2)创建C++/CLI控制台应用程序(VS 2010):
AssemblyInfo.cpp
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security;
[assembly:AssemblyTitleAttribute("CPlusPlusCLIConsoleApp")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(false)];
[assembly:SecurityCritical];
Run Code Online (Sandbox Code Playgroud)
CPlusPlusCLIConsoleApp.h
#pragma once
using namespace CSharpLibrary;
using namespace System::Security;
typedef void* (__cdecl FACTORY_PROC)();
namespace CPlusPlusCLIConsoleApp
{
public ref class MainClass : public IManagedClass
{
public:
[SecurityCritical]
virtual …Run Code Online (Sandbox Code Playgroud) 我的应用程序使用了许多我无法让用户看到的API密钥和URL.我一直把它们直接放在代码中,有时嵌入在使用它们的方法中,有时在一个名为MyVals的类中,它存储常用的字符串和数字.
例如:
public class MyVals {
private LGVals(){}
public static final String DB_URL = "https://mydb.dbprovider.org/";
public static final String DB_Key = "klJF*(oh8iyhkkde";
public static final String TableKey_UserList = "o9w6owifhayf98fnwihj";
}
Run Code Online (Sandbox Code Playgroud)
这样安全吗?如果我用Proguard创建我的APK会有所不同吗?这是最好的做法是什么?
虽然我不确定为什么,但这似乎并不正确.建议会很棒,因为CMPXCHG16B的文档很少(我没有任何英特尔手册...)
template<>
inline bool cas(volatile types::uint128_t *src, types::uint128_t cmp, types::uint128_t with)
{
/*
Description:
The CMPXCHG16B instruction compares the 128-bit value in the RDX:RAX and RCX:RBX registers
with a 128-bit memory location. If the values are equal, the zero flag (ZF) is set,
and the RCX:RBX value is copied to the memory location.
Otherwise, the ZF flag is cleared, and the memory value is copied to RDX:RAX.
*/
uint64_t * cmpP = (uint64_t*)&cmp;
uint64_t * withP = (uint64_t*)&with;
unsigned char …Run Code Online (Sandbox Code Playgroud) .net ×3
.net-4.0 ×3
security ×2
android ×1
appdomain ×1
asp.net ×1
automation ×1
c# ×1
c++ ×1
c++-cli ×1
encryption ×1
f# ×1
git ×1
git-branch ×1
global-asax ×1
java ×1
plugins ×1
powershell ×1
privileges ×1
proguard ×1
wcsf ×1
x86 ×1