cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-medic pull request: CB-11140 Patch CSP tag to allow Appium...
Date Mon, 25 Apr 2016 12:29:49 GMT
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-medic/pull/99#discussion_r60904512
  
    --- Diff: medic/medic-appium.js ---
    @@ -241,6 +241,44 @@ function parseElementtreeSync(filename) {
         return new elementTree.ElementTree(elementTree.XML(contents));
     }
     
    +function addCspSource(appPath, directive, source) {
    +    var cspInclFile = path.join(appPath, "www/csp-incl.js");
    +    var indexFile = path.join(appPath, "www/index.html");
    +    var cspFile = fs.existsSync(cspInclFile) ? cspInclFile : indexFile;
    +    var cspContent = fs.readFileSync(cspFile, util.DEFAULT_ENCODING);
    +    var cspTagOpening = "<meta http-equiv=\"Content-Security-Policy\" content=\"";
    +    var cspRule = directive + " " + source;
    +    var cspRuleReg = new RegExp(directive + "[^;\"]+" + source.replace("*", "\\*"));
    +
    +    util.medicLog("Adding CSP source \"" + source + "\" to directive \"" + directive
+ "\"");
    +
    +    if (cspContent.match(cspRuleReg)) {
    +        util.medicLog("It's already there.");
    +    } else if (util.contains(cspContent, directive)) {
    +        // if the directive is there, just add the source to it
    +        cspContent = cspContent.replace(directive, cspRule);
    +        console.log(1);
    --- End diff --
    
    Please remove this debug logging


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message