Skip to content

Commit 8b72645

Browse files
committed
Fix DefaultEncoder so that by default, it will use the value of the property Encoder.DefaultCodecList instead of having hard-coded codecs.
1 parent aac2c76 commit 8b72645

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/org/owasp/esapi/reference/DefaultEncoder.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,18 @@ public static Encoder getInstance() {
9999

100100

101101
/**
102-
* Instantiates a new DefaultEncoder
102+
* Instantiates a new {@code DefaultEncoder} based on the property {@code Encoder.DefaultCodecList}
103+
* from the {@code ESAPI.properties} file.
103104
*/
104105
private DefaultEncoder() {
105-
codecs.add( htmlCodec );
106-
codecs.add( percentCodec );
107-
codecs.add( javaScriptCodec );
106+
this( ESAPI.securityConfiguration().getDefaultCanonicalizationCodecs() );
108107
}
109108

109+
/**
110+
* Instantiates a new {@code DefaultEncoder} based on the specified list of
111+
* codec names. Unqualified codec names are assumed to belong to the package
112+
* "org.owasp.esapi.codecs".
113+
*/
110114
public DefaultEncoder( List<String> codecNames ) {
111115
for ( String clazz : codecNames ) {
112116
try {

0 commit comments

Comments
 (0)