Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue-Id : ACUMOS-1650 Description : Senitization for CSS Vulnerability - Design Studio Change-Id: If8fd4b9b06f884219d93881f7922421870de8e3d Signed-off-by: Ramanaiah Pirla <RP00490596@techmahindra.com>
- Loading branch information
Ramanaiah Pirla
authored and
Ramanaiah Pirla
committed
Nov 13, 2018
1 parent
be2dcd2
commit 0df8a5e
Showing
5 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
ds-compositionengine/src/main/java/org/acumos/designstudio/ce/util/SanitizeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*- | ||
* ===============LICENSE_START======================================================= | ||
* Acumos | ||
* =================================================================================== | ||
* Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved. | ||
* =================================================================================== | ||
* This Acumos software file is distributed by AT&T and Tech Mahindra | ||
* under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* This file is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ===============LICENSE_END========================================================= | ||
*/ | ||
|
||
package org.acumos.designstudio.ce.util; | ||
|
||
import org.owasp.html.HtmlPolicyBuilder; | ||
import org.owasp.html.PolicyFactory; | ||
|
||
public class SanitizeUtils { | ||
|
||
public static PolicyFactory genericPolicy = new HtmlPolicyBuilder() | ||
.requireRelNofollowOnLinks() | ||
.allowTextIn("@") | ||
.toFactory(); | ||
|
||
public static String sanitize(String html) { | ||
if(null == html){ | ||
return html; | ||
} | ||
return genericPolicy.sanitize(html); | ||
} | ||
|
||
} |