2016-06-05 4 views
0

죄송합니다. 이전에 질문을 받았지만 문제가 해결되지 않았습니다.사용자가 텍스트 영역을 통해 위험한 기능을 호출하게합니까?

나는이 텍스트 영역에 웹 사이트가 - 하나는 MathJax위한 두 번째 텍스트 영역을 쉽게 ThreeJS 프로그래밍을위한이 하나 https://cdn.mathjax.org/mathjax/latest/test/sample-dynamic-2.html

꽤 유사한 작동합니다. 따라서 사용자는 sphere1 = new sphere();을 입력하여 실행을 누르면 아래의 캔버스에 3D 구가 나타납니다. 내 페이지에 PHP가없고 사용자 입력을 저장하지 않고 (아직), 세션에서만 사용할 수 있습니다.

함수 run();

function run() { 
    Clear(); //Removes all objects from the scene 
    if (!document.getElementById('newScript')) { 
     //if script id doesn't exist it creates new script 
     var position = currentPosition(); //Current slide 
     var video = $('#slide-' + position).find(".animCode").val(); 
     var bodyID = document.getElementsByTagName("body")[0]; 
     var newScript = document.createElement("script"); 
     newScript.id = 'newScript'; 
     newScript.type = "text/javascript"; 
     newScript.innerHTML = video; 
     bodyID.appendChild(newScript); 

    } else { 
     //else removes previous scripts and overwrites it 
     var position = currentPosition(); //Current slide 
     var video = $('#slide-' + position).find(".animCode").val(); 
     var e = document.getElementById('newScript'); 
     e.id = 'replace'; 
     var newScript = document.createElement("script"); 
     newScript.id = 'newScript'; 
     newScript.type = "text/javascript"; 
     newScript.innerHTML = video; 
     var bodyID = document.getElementsByTagName("body")[0]; 
     bodyID.replaceChild(newScript, e); //remove old script 

    } 
} 

내 질문에 :이 위험한가요? 나는 SQL 인젝션에 대해 많이 읽었지만, PHP로 저장되는 데이터에 대해서는 모두 이야기하고있다. 나의 경우는 아니다.

+0

미래의 메모 : cdn.mathjax.org의 수명이 다해 가고 있습니다. 마이그레이션 팁은 https://www.mathjax.org/cdn-shutting-down/에서 확인하십시오. –

답변

1

위험하지 않습니다. Javascript는 클라이언트 측 언어이므로 웹 사이트 사용자는 브라우저 콘솔을 통해 웹 사이트에서 Javascript를보고 심지어 실행할 수도 있습니다.

관련 문제