text Metaobjects污染和无污染

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Metaobjects污染和无污染相关的知识,希望对你有一定的参考价值。

package metaobjectTest

import untainted


object Tainted

    func run {
        var String@tainted(sql) maliciousSqlCode = 
           "I will delete your database";
        
        var String@untainted(sql) safeSqlCode;
        

          // compile-time error: this assignment should
          // be in a special prototype/package to be allowed
        // safeSqlCode = "safe sql code";
            // ok
        safeSqlCode = TaintedToUntainted toUntaintedSql: "safe sql code";
         
        // TaintedToUntainted is a safe prototype
        safeSqlCode = TaintedToUntainted toUntaintedSql: "safe sql code";
        
        maliciousSqlCode = safeSqlCode; // ok
        //safeSqlCode = maliciousSqlCode; // compile-time error
        
        let String@tainted(html) badHtmlCode = "bad home page";
           // compile-time error
        //safeSqlCode = badHtmlCode;

           // compile-time error
        //let String@untainted(html) safeHtmlCode = badHtmlCode;
        
    }
    
end

以上是关于text Metaobjects污染和无污染的主要内容,如果未能解决你的问题,请参考以下文章

text Metaobjects addCodeToGenericPrototype和AddCodeFromMetaobject

重污染天气等级划分

halcon计算污染面积

转:扫盲 DNS 原理,以及“域名劫持”和“域名欺骗/域名污染”

解决全局变量污染问题

基于FET335xD核心板-污染源在线监测解决方案