1 MDIMain mxml SCFile Up Down Loader policy

  • Slides: 25
Download presentation

# 참조 1. 파일 확장자 제어 전역설정(MDIMain. mxml 의 초기화 메소드) SCFile. Up. Down.

# 참조 1. 파일 확장자 제어 전역설정(MDIMain. mxml 의 초기화 메소드) SCFile. Up. Down. Loader. policy. file. Filter. Labels = ['문서파일(*. txt, *. xls, *. doc, *. ppt, *. xlsx, *. docx, *. pptx, *. rtf, *. gul, *. hwp, *. pdf, *. mht, *. eml)', '이미지파일(*. png, *. jpg, *. gif, *. tif)', '압축파일(*. zip)']; SCFile. Up. Down. Loader. policy. file. Filter. Strings = ['*. txt; *. xls; *. doc; *. ppt; *. xlsx; *. docx; *. pptx; *. rtf; *. gul; *. hwp; *. pdf; *. mht; *. eml', '*. png; *. jpg; *. gif; *. tif', '*. zip']; 지역설정(각 사용 화면) <vc: SCFile. Up. Down. Loader id="file" row. Count="3" file. Filter. Labels="{file. Filter. Labels}" file. Filter. Strings="{file. Filter. Strings}" width="100%" height="100%"/> ---------------------------------------------------------[Bindable] public var file. Filter. Labels: Array = new Array( "Documents(*. txt, *. xls, *. doc, *. ppt, *. xlsx, *. docx, *. pptx, *. rtf, *. gul, *. hwp, *. pdf, *. mht, *. eml, *. msg)“, "Images(*. png, *. jpg, *. gif, *. tif)“, "Zip(*. zip)"); [Bindable] public var file. Filter. Strings: Array = new Array( "*. txt; *. xls; *. doc; *. ppt; *. xlsx; *. docx; *. pptx; *. rtf; *. gul; *. hwp; *. pdf; *. mht; *. eml; *. msg“, "*. png; *. jpg; *. gif; *. tif“, "*. zip"); [ 13 ]

# 참조 2. XSS (1) 해당 오픈소스는 'Lucy-XSS Filter'라는 라이브러리이며, 관련 정보는 http: //dev.

# 참조 2. XSS (1) 해당 오픈소스는 'Lucy-XSS Filter'라는 라이브러리이며, 관련 정보는 http: //dev. naver. com/projects/lucy-xss/ 페이지를 참조하시면 됩니다. 적용방법 1. 첨부한 lucy-xss-1. 1. 2. jar 파일을 WEB-INF/lib에 위치시킵니다. 2. 첨부한 lucy-xss-superset. xml 파일을 WEB-INF/classes에 위치시킵니다. lucy-xss-superset. xml은 허용할 tag 및 attribute정보들을 xml형태로 정의할수 있는 설정파일입니다. 기본 설정파일(lucy-xss-default. xml)은 jar파일안에 내장되어 있고 html 4. 0 spec기준으로 정의되어 있으며, 기본 설정파일을 상속받은 개념으로 lucy-xss-superset. xml에 허용할 정보를 재정의 할수 있도록 되어있습니다. lucy-xss-superset. xml 설정 내용. . <!-- 다음과 같이 재정의할수 있으며, 기본 설정은 jar파일에 있는 lucyu-xss-default. xml 설정이 적용된다. --> <element name="body"> <!-- body tag를 허용함 --> <attributes> <!-- body tag에 허용할 attribute지정 --> <ref name="Attrs"/> <ref name="background"/> <ref name="text"/> <ref name="link"/> <ref name="vlink"/> <ref name="alink"/> <ref name="bgcolor"/> </attributes> <elements> <!-- body tag내에 허용할 tag 지정 --> <ref name="Block"/> <ref name="ins"/> <ref name="del"/> <ref name="Special"/> <ref name="embed"/> </elements> </element>. . [ 14 ]

# 참조 2. XSS Class 적용방법 첨부한 lucy 와 다른 방식으로, Class를 통하여 용하는

# 참조 2. XSS Class 적용방법 첨부한 lucy 와 다른 방식으로, Class를 통하여 용하는 방법이 있습니다. 첨부된 2개의 파일을 package com. xss. filter; 위치시켜 복사하여 빌드합니다. Cross. Scripting. Filter. java Request. Wrapper. java web. xml 파일을 열어 다음과 같이 필터를 추가하시고, 서버를 리스타트 합니다. <filter> <filter-name>XSS</filter-name> <filter-class>com. xss. filter. Cross. Scripting. Filter</filter-class> </filter> <filter-mapping> <filter-name>XSS</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> [ 16 ]

# 참조 4. 메뉴권한처리 (1) 로그인 시점에 사용자의 메뉴정보를 조작하여 클라이언트로 내려준 후 권한이

# 참조 4. 메뉴권한처리 (1) 로그인 시점에 사용자의 메뉴정보를 조작하여 클라이언트로 내려준 후 권한이 없는 메뉴를 호출하는 보안상의 문제를 해결하기 위한 방법입니다. 1. XMLMenu. jsp - 사용자에게 권한이 부여된 메뉴정보(xml 형태) 의 checksum 값을 구하여 세션에 담아둡니다. - jsp 파일의 클래스 정의 부분 하단에 아래와 같이 로직을 수정 <? xml version="1. 0" encoding="UTF-8" ? ><node><%=to. XML(menus, 0, 0, "", request) %></node> <-- 내용을 아래와 같이 변경 <% String menu. XML = "<? xml version="1. 0" encoding="UTF-8" ? ><node>" + to. XML(menus, 0, 0, "", request) + "</node>"; Message. Digest m = Message. Digest. get. Instance("MD 5"); m. update(menu. XML. get. Bytes("UTF-8")); byte. Data[] = m. digest(); String. Buffer sb = new String. Buffer(); for(int i = 0; i < byte. Data. length; i++) { sb. append(Integer. to. String((byte. Data[i] & 0 xff) + 0 x 100, 16). substring(1)); } session. set. Attribute("MENU_CHECKSUM", sb. to. String()); out. clear(); out. write(menu. XML); %> [ 19 ]

# 참조 4. 메뉴권한처리 (2) 2. enviroments. mxml 파일 수정 - menu 함수에 result.

# 참조 4. 메뉴권한처리 (2) 2. enviroments. mxml 파일 수정 - menu 함수에 result. Format 속성을 HTTPService. RESULT_FORMAT_E 4 X 에서 HTTPService. RESULT_FORMAT_TEXT 로 변경 - menu. Result. Handler 함수를 아래와 같이 수정 public static var is. Valid. Menu: Boolean = false; private function menu. Result. Handler(event: Result. Event): void { var xml: String = event. result as String; var sp: SCService. Provider = new SCService. Provider(); sp. descriptor = "framework"; sp. service. Id = "get. user. checksum"; sp. add. Event. Listener(Result. Event. RESULT, function(event: Result. Event): void { is. Valid. Menu = event. result. checksum == com. adobe. crypto. MD 5. hash(xml); if(is. Valid. Menu) { menus = new XML(xml). children(); } menu. Completed = true; dispatch. Event(new Event(MENU_CHANGE)); dispatch. Complete(); }); sp. service(); } [ 20 ]

# 참조 4. 메뉴권한처리 (3) 3. MDIMain. mxml 파일의 create. Window 함수를 아래와 같이

# 참조 4. 메뉴권한처리 (3) 3. MDIMain. mxml 파일의 create. Window 함수를 아래와 같이 수정 public function create. Window(name: String, title: String, url: String, load. Type: String = "module", rectangle: Rectangle = null): Display. Object { if(load. Type == "popup"){ navigate. To. URL(new URLRequest(url), name); return null; }else{ if(environments. is. Valid. Menu) { //정상적인 메뉴인 경우에만 생성 var display. Obj: Display. Object = mdi. Content. create. Window(name, title, url, load. Type, rectangle); display. Obj. add. Event. Listener(Window. Event. CONTENT_CHANGE, window. Created. Handler, false, 0, true); return display. Obj; } return null; } } 4. framework. xml 서비스 파일에 아래의 서비스 구현 <service id="get. user. checksum"> <script> <![CDATA[ $data. checksum = $session. get. Attribute("MENU_CHECKSUM"); ]]> </script> </service> [ 21 ]

# 참조 5. Error 발생시 server 정보 노출 방지 (1) 방안 1. framework. xml

# 참조 5. Error 발생시 server 정보 노출 방지 (1) 방안 1. framework. xml -> flex-exception-message-throw : false 로 설정 <config id="flex. config"> <!-- exception 발생시 에러 메세지 클라이언트로 전송여부 --> <flex-exception-message-throw>false</flex-exception-message-throw > …. </config> [ 22 ]

# 참조 5. Error 발생시 server 정보 노출 방지 (2) 방안 2. environment. xml

# 참조 5. Error 발생시 server 정보 노출 방지 (2) 방안 2. environment. xml -> remote() 수정 protected function remote(): void { register. Class. Alias ("custom. uxcom. messaging. message. core. SCMessage", SCMessage); SCService. Binder. filters = SCRemote. Object. filters = [new CCMenu. Mark. Filter()]; SCRemote. Object. default. Fault. Handling. Function = function(event: Fault. Event): void { if (event. message is Remoting. Message) { var rm: Remoting. Message = Remoting. Message(event. message); } else if (event. message is Error. Message) { var em: Error. Message = Error. Message(event. message); if (!event. is. Default. Prevented()) { // 하기 alert 부분을 일괄 메세지로 처리 SCAlert. show("오류", "오류가 발생하였습니다. ", false, 4, null, function(): void { if(em. fault. Code == "1") { var request: URLRequest = new URLRequest("/"); request. method = URLRequest. Method. POST; navigate. To. URL(request , "_self"); } } }; } [ 23 ]

# 참조 6. web. xml error-page 지정 1. web. xml 하기 코드 추가 <!--

# 참조 6. web. xml error-page 지정 1. web. xml 하기 코드 추가 <!-- 에러 코드 400, 401, 403, 405, 500, 503 : 에러 페이지 설정 --> <error-page> <error-code>400</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>401</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>403</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>404</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>405</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>500</error-code> <location>/global/Error. Page. jsp</location> </error-page> <error-code>503</error-code> <location>/global/Error. Page. jsp</location> </error-page> <exception-type>java. lang. Throwable</exception-type> <location>/global/Error. Page. jsp</location> </error-page> [ 24 ]

End of Document [ 25 ]

End of Document [ 25 ]