You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+17-28
Original file line number
Diff line number
Diff line change
@@ -267,43 +267,36 @@ First make sure that you have an [Issue](https://github.com/OWASP/wrongsecrets/i
267
267
268
268
Add the **new challenge** in this folder `wrongsecrets/src/main/java/org/owasp/wrongsecrets/challenges/`.
269
269
These are the things that you have to keep in mind.
270
-
- First and foremost make sure your challenge is coded in **Java**.
271
-
- Here is an example of a possible Challenge 28:
270
+
- First and foremost make sure your challenge is coded in **Java**.
271
+
- Use either `FixedAnswerChallenge` as a class to extend or use the `Challenge` interface to imnplement.
272
+
273
+
The `FixedAnswerChallenge` can be used for challenges that don't have a dependency on other (sub)systems. Here is an example of a possible Challenge 28:
public class Challenge28 extends FixedAnswerChallenge {
292
+
private final String secret = "hello world";
294
293
295
-
//return the plain text secret here
296
-
@Override
297
-
public Spoiler spoiler() {
298
-
return new Spoiler(secret);
299
-
}
300
-
//here you validate if your answer matches the secret
301
-
@Override
302
-
public boolean answerCorrect(String answer) {
303
-
return secret.equals(answer);
294
+
public String getAnswer() {
295
+
return secret;
304
296
}
305
297
}
306
298
```
299
+
However, if there is a dependency on external components, then you can better implement the interface `Challenge` directly instead of `FixedAnswerChallenge`. For example, see [`Challenge36`](https://github.com/OWASP/wrongsecrets/blob/master/src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge36.java), where we have to interact with external binaries.
307
300
308
301
### Step 3: Adding Test File.
309
302
@@ -312,27 +305,23 @@ These are the things that you have to keep in mind.
312
305
313
306
Make sure that this file is also of **Java** type.
Please note that PRs for new challenges are only accepted when unit tests are added to prove that the challenge works. Normally tests should not immediately leak the actual secret, so leverage the `.spoil()` functionality of your test implementation for this.
337
326
338
327
### Step 4: Adding explanations, reasons and hints.
0 commit comments