我一直是许多Web应用程序的一部分,但从未使用过CAS,也许从来没有觉得需要使用相同的.
什么时候需要使用CAS?人们真的在他们的应用程序中使用它吗?
虽然我不确定为什么,但这似乎并不正确.建议会很棒,因为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) 我们通过将它们放在LAN上来部署我们的.NET应用程序,并允许用户从那里运行.我们是一个非常大的组织的一部分,并且没有个人计算机,服务器和域的管理员权限.我们甚至没有开发机器的管理员权限.
当用户从网络共享运行应用程序Dot-Net应用程序时,由于安全性异常而失败.在过去,我们使用CASPOL(用户级别)来信任文件服务器,但这很令人头疼.我们已经开发了自定义代码,可以在执行之前将程序集复制到本地驱动器,从而有效地绕过信任问题.这两种方案都不是一个好的答案.据我所知,Dot Net 3.5将消除这个问题.
当我们在IT部门讨论这个主题时,当我们询问在机器或服务器上设置信任时,他们给了我们空白的目光.
一个微软的网站称
如果您是代码的开发人员或发布者,您也可以对其进行数字签名,然后修改安全策略以授予对具有该签名的代码的更多权限.
我们的一位IT人员问我关于加密密钥需要什么.我想在回答之前确保我的假设是正确的.
我的假设是正确的,还是我偏离了基础?最后一个问题,是否可以使用相同的密钥来签署vba宏?
反编译代码非常容易,即使使用Proguard也无法保护代码.
我需要的是在应用程序中保护"密钥".build.gradle是否安全?可以反编译吗?
buildConfigField "String", "Key", "\"1234567890\""
Run Code Online (Sandbox Code Playgroud)
更新
根据commonsware的回答我得到它不安全?有没有其他方法可以管理这个?
android decompiling code-access-security android-studio android-gradle-plugin
在.NET 1.x中,您可以在程序集上使用StrongNameIdentityPermissionAttribute,以确保只有您签名的代码才能访问程序集.根据MSDN文档,
在.NET Framework 2.0及更高版本中,如果调用程序集具有完全信任,则对身份权限的要求无效.
这意味着任何具有完全信任的应用程序都可以绕过我的安全需求.
如何防止未经授权的代码访问.NET 2.0中的程序集?
在ASP.NET应用程序中应用程序池回收后不久,我们间歇性地看到以下异常:
System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418) ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'Microsoft.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) …Run Code Online (Sandbox Code Playgroud) 我有一个[AllowPartiallyTrustedCallers]类库,包含System.DataAnnotations.ValidationAttribute的子类型.该库用于WCF服务的合同类型.
在.NET 2/3.5中,这很好用.但是,从.NET 4.0开始,在Visual Studio调试器中运行服务的客户端会导致异常" 类型的违反继承安全规则:'(我的ValidationAttribute的子类型)'.派生类型必须与基类型的安全可访问性匹配或者不太容易访问. "(System.TypeLoadException)
仅当满足以下所有条件时,才会出现错误:
基本上,在Visual Studio.NET 2010中:
.
using System;
[assembly: System.Security.AllowPartiallyTrustedCallers()]
namespace TestingVaidationAttributeSecurity
{
public class MyValidationAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{ }
[MyValidation]
public class FooBar
{ }
class Program
{
static void Main(string[] args)
{
Console.WriteLine("ValidationAttribute IsCritical: {0}",
typeof(System.ComponentModel.DataAnnotations.ValidationAttribute).IsSecurityCritical);
FooBar fb = new FooBar();
fb.GetType().GetCustomAttributes(true);
Console.WriteLine("Press enter to end.");
Console.ReadLine();
}
}
}
Run Code Online (Sandbox Code Playgroud)
按Ctrl-F5(无需调试即可启动),一切正常,无异常...
奇怪的是,根据您运行程序的方式(F5或Ctrl + F5),ValidationAttribute将是或将不是安全关键.如上面代码中的Console.WriteLine所示.但话说回来,这似乎与其他属性(和类型?)一起发生.
现在问题......
为什么在从ValidationAttribute继承时会出现此行为,但在从System.Attribute继承时却没有?(使用Reflector我在ValidationAttribute类或它的程序集中找不到特殊设置)
我该怎么做才能解决这个问题?如何保持MyValidationAttribute继承自AllowPartiallyTrustedCallers程序集中的ValidationAttribute而不将其标记为SecurityCritical,仍然使用新的.NET 4级别2安全模型并仍使用VS.NET调试主机(或其他主机)?
非常感谢!鲁迪
我刚刚阅读了有关代码访问安全性的这篇文章.它有这样一个例子:
using System.Security.Permissions;
public class MyFileAccessor
{
public MyFileAccessor(String path, bool readOnly)
{
path = MakeFullPath(path); // helper fcn
FileIOPermissionAccess desiredAccess = readOnly
? FileIOPermissionAccess.Read
: FileIOPermissionAccess.AllAccess;
FileIOPermission p = new FileIOPermission(desiredAccess, path);
p.Demand();
//
•••
open the file
}
// •••
}
Run Code Online (Sandbox Code Playgroud)
如果我没有使用FileIOPermissionAccess类型并且在我的代码中从不包含像p.Demand()这样的代码怎么办?换句话说,如果我想做坏事,我为什么要费心去做那个? 这不是一个笑话吗?或者我错了吗?
我正忙着尝试理解c#中的安全性,我正在努力去了解Assert的工作原理.我正在使用.net 3.5.
我做了一个示例应用程序试图解决这个问题.
通话方式:
[FileIOPermission(SecurityAction.Deny, ViewAndModify = @"C:\")]
static void Main(string[] args)
{
WriteTest testWriter = new WriteTest();
testWriter.Test();
Console.Read();
}
Run Code Online (Sandbox Code Playgroud)
在一个单独的类库中,我有:
public class WriteTest
{
public void Test()
{
try
{
FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.Write, @"C:\");
permission.Assert();
using (StreamWriter sw = new StreamWriter(@"C:\test.txt"))
{
sw.WriteLine("testing!");
sw.Flush();
}
Console.WriteLine("Writen to file!");
}
catch (SecurityException sec)
{
Console.WriteLine("No privileges!");
}
}
}
Run Code Online (Sandbox Code Playgroud)
这段代码执行得很好.它将写入文件.我的问题是这究竟是如何工作的?如果我只是断言我想要的权限以便它跳过检查,这不会使安全类失效吗?如果我将Assert更改为Demand它会引发异常.
安全类的重点是不允许我设置权限,这样当我调用第三方类时,我可以防止它变成流氓并做一些我不希望它做的事情?我知道如果我在AppDomain中加载dll,即使第三方DLL确实使用Assert,我也会得到这种效果,如果我直接调用它就会起作用,这似乎很奇怪.我试过在Assert上阅读MSDN文档,但我发现很难理解.
我是一些企业github存储库的所有者.最近,我们一直怀疑开发人员可能通过他借用的github身份获得外包帮助(许多凌晨4点批量提交).有没有办法在github.com上确定提交者的源IP地址?在流量页面上,我可以根据多个独特克隆来推断此信息,但这不足以让我们验证我们的问题.
干杯,Joe Anonymous