equal-access icon indicating copy to clipboard operation
equal-access copied to clipboard

Scanning URL gives Permission denied to access document

Open devanshah2 opened this issue 7 years ago • 1 comments

APPLIES TO:

(Tool(s) that this defect affects, in the case of rule defect please include the rule name) @ibma/karma-ibma

PROBLEM DESCRIPTION:

(Describe the problem you are seeing in as much detail as you can)

When scanning a URL which is not in the same domain/port/protocol as the karma server it throws exception "permission denied to access property "document""

STEPS TO REPRODUCE:

(Steps to reproduce the issues from start to finish.) (Include a sample html file when possible (attach under the "Links" section), Include a link if sample file cannot be produced.) 1. Scan https://internetofthings.ibmcloud.com/#/ 2. notice that there will be an exception throw

EXPECTED OUTPUT:

(The expected results that you should see)

No exception, should match baseline

ACTUAL OUTPUT:

(The current results that you are seeing) (Include Description and/or a screenshot of what you are seeing)

permission denied to access property "document"

devanshah2 avatar Mar 16 '17 02:03 devanshah2

For this defect the issues is due to cross domain access issues which are causes issues when trying to access the iframe which was created with the src of the URL provided. On firefox there is no provided alternative, Chrome and PhantomJS provide a way to over ride this. by adding the following to karma.config.js

 module.exports = function (config) {
    config.set({
        browsers: ['ChromeCustom', 'PhantomJSCustom'],
        customLaunchers: {
            ChromeCustom: {
                base: 'Chrome',
                flags: ['--disable-web-security']
            },
            PhantomJSCustom: {
                base: 'PhantomJS',
                options: {
                    settings: {
                        webSecurityEnabled: false
                    }
                }
            }

        }
        ....
    });
}

devanshah2 avatar Mar 16 '17 03:03 devanshah2