Skip to content

Commit bf83865

Browse files
committed
Japanese translation of assert
Japanese translaton for docs/labs/assert.html and assert.js Signed-off-by: Muuhh IKEDA <[email protected]>
1 parent b14d7a9 commit bf83865

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

docs/labs/assert.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,71 @@ info =
77
{
88
present: "assert",
99
text: "The whole point of this exercise is to NOT use `assert` as a way to validate input from untrusted users.",
10+
text_ja: "この演習の全体的なポイントは、信頼できないユーザーからの入力検証の手段として `assert` を使用しないことです。",
1011
examples: [
1112
[ "assert !bindingResult.hasErrors();\n" ]
1213
],
1314
},
1415
{
1516
absent: String.raw`^\s* if `,
1617
text: "Begin with `if` so you can return a result if there are errors.",
18+
text_ja: "エラーがある場合に結果を返せるように `if` で始めてください。",
1719
examples: [
1820
[ "return \"form\";" ]
1921
],
2022
},
2123
{
2224
present: "(bindingresult|BindingResult)",
2325
text: "Java is case-sensitive. Use `bindingResult`, not `bindingresult` nor `BindingResult`.",
26+
text_ja: "Java では大文字と小文字が区別されます。`bindingresult` や `BindingResult` ではなく `bindingResult` としてください。",
2427
},
2528
{
2629
present: "(haserrors|HasErrors)",
2730
text: "Java is case-sensitive. Use `hasErrors`, not `haserrors` nor `HasErrors`.",
31+
text_ja: "Java では大文字と小文字が区別されます。`haserrors` や `HasErrors` ではなく`hasErrors` としてください。",
2832
},
2933
{
3034
present: String.raw`^\s*if\s*[^\(\s]`,
3135
text: "In Java, after the keyword `if` you must have an open left parenthesis. Conventionally there is one space between the `if` keyword and the open left parenthesis.",
36+
text_ja: "Java では キーワード `if` のあとには左側カッコを置く必要があります。通常、`if` と左側カッコの間にはスペースを入れます。",
3237
examples: [
3338
[ "if bindingResult.hasErrors" ]
3439
],
3540
},
3641
{
3742
present: String.raw`^\s*if\s*\(\s*\!binding`,
3843
text: "You have an extraneous `!` (not operator). Use the expression if (bindingResult.hasErrors()) ...",
44+
text_ja: "余計な `!`(NOT 演算子)があります。if (bindingResult.hasErrors()) ... という表記を使用してください。",
3945
examples: [
4046
[ "if (!bindingResult.hasErrors())" ]
4147
],
4248
},
4349
{
4450
absent: String.raw`^ if \( bindingResult \. hasErrors \( \) \) `,
4551
text: "Begin the answer with the text `if (bindingResult.hasErrors())` so that a statement will be executed if that condition is true.",
52+
text_ja: "`if (bindingResult.hasErrors())` で始めてください。これで条件が真の場合にステートメントが実行されます。",
4653
},
4754
{
4855
present: String.raw`if \( bindingResult \. hasErrors \( \) \) [^\{\s] `,
4956
text: "Follow the conditional with an open brace, e.g., `if (bindingResult.hasErrors()) {...`.",
57+
text_ja: "左側中カッコを条件の後に続けてください。e.g., `if (bindingResult.hasErrors()) {...`.",
5058
},
5159
{
5260
absent: String.raw`return "form"
5361
`,
5462
text: "You need to use `return \"form\";` somewhere.",
63+
text_ja: "`return \"form\";` がどこかに必要です。",
5564
},
5665
{
5766
present: String.raw`return "form"`,
5867
absent: String.raw`return "form" ;`,
5968
text: "You need to use `;` (semicolon) after `return \"form\"` because in Java statements must be followed by a semicolon.",
69+
text_ja: "`return \"form\"` の後に `;`(セミコロン)が必要です。Java ではステートメントの後ろにセミコロンを置きます。",
6070
},
6171
{
6272
absent: String.raw`\} $`,
6373
text: "The answer needs to end with `}` (closing brace).",
74+
text_ja: "回答は `}`(右側中カッコ)で終わる必要があります。",
6475
},
6576
],
6677
expected: [

docs/labs/ja_assert.html

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!DOCTYPE html>
2+
<html lang="ja">
3+
<head>
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="https://best.openssf.org/assets/css/style.css">
8+
<link rel="stylesheet" href="checker.css">
9+
<script src="checker.js"></script>
10+
<script src="assert.js"></script>
11+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
12+
13+
<!-- See create_labs.md for how to create your own lab! -->
14+
15+
</head>
16+
<body>
17+
<!-- For GitHub Pages formatting: -->
18+
<div class="container-lg px-3 my-5 markdown-body">
19+
<h1>ラボ演習 assert</h1>
20+
<p>
21+
これはセキュアなソフトウェア開発に関するラボ演習です。
22+
ラボの詳細については、<a href="ja_introduction.html" target="_blank">概要</a>をご覧ください。
23+
24+
<p>
25+
<h2>タスク</h2>
26+
<p>
27+
<b>攻撃者が容易にアサーションを失敗させられないように、サンプルコードを修正してください。</b>
28+
29+
<p>
30+
<h2>背景</h2>
31+
<p>
32+
この演習では、<a href="https://en.wikipedia.org/wiki/Spring_Framework">
33+
Spring フレームワーク</a>を使用する Java のサーバサイドアプリケーション
34+
を修正します。
35+
<!--
36+
Spring Framework is OSS (Apache 2.0 licensed) and listed
37+
as a top one at <https://radixweb.com/blog/best-java-frameworks>.
38+
We aren't advocating any specific framework, just using
39+
real-world frameworks as an example.
40+
-->
41+
42+
<p>
43+
<h2>タスクの詳細</h2>
44+
<p>
45+
46+
<p>
47+
以下のサンプルコードでは、入力検証に失敗するとアサーションが失敗します。
48+
このアプローチでは<i>確実に</i>入力検証が行われ、検証に失敗した入力は確実に拒否されます。
49+
しかしこの実装では、アサーションの失敗によりプログラムの<i>全てが</i>停止します。
50+
検証を失敗させる些細な入力を送り込むことができれば、攻撃者はプログラム全体を
51+
容易にシャットダウンできることになります。
52+
53+
<p>
54+
フォームの入力検証にエラーがないことをアサーションする代わりに、
55+
エラーがあるかどうかをチェックし、もしエラーがあれば <tt> form </tt> という文字列を返す
56+
ように以下のコードを変更してください。(これによりフレームワークは入力フォームを表示します)
57+
誤った入力があった場合、通常はシステム全体をクラッシュさせるよりも入力フォームを再表示
58+
するべきです。
59+
60+
61+
<p>
62+
必要に応じて、「ヒント」ボタンと「諦める」ボタンを使用してください。
63+
64+
<p>
65+
<h2>演習 (<span id="grade"></span>)</h2>
66+
<p>
67+
<form id="lab">
68+
<pre><code
69+
>@Controller
70+
public class WebController implements WebMvcConfigurer {
71+
72+
@Override
73+
public void addViewControllers(ViewControllerRegistry registry) {
74+
registry.addViewController("/results").setViewName("results");
75+
}
76+
77+
@GetMapping("/")
78+
public String showForm(PersonForm personForm) {
79+
return "form";
80+
}
81+
82+
@PostMapping("/")
83+
public String checkPersonInfo(@Valid PersonForm personForm,
84+
BindingResult bindingResult) {
85+
<textarea id="attempt0" rows="3" cols="60" spellcheck="false"
86+
> assert !bindingResult.hasErrors();</textarea>
87+
88+
return "redirect:/results";
89+
}
90+
}
91+
92+
// If you use a textarea:
93+
</code></pre>
94+
<button type="button" class="hintButton">Hint</button>
95+
<button type="button" class="resetButton">Reset</button>
96+
<button type="button" class="giveUpButton">Give up</button>
97+
<br><br>
98+
<p>
99+
<i>このラボは、<a href="https://www.linuxfoundation.org/">Linux Foundation</a>のDavid A. Wheelerによって開発されました。</i>
100+
これは Spring.io ガイドの
101+
<a href="https://spring.io/guides/gs/validating-form-input">validating-form-input</a>
102+
セクションを基にしています。
103+
<br><br>
104+
<p id="correctStamp" class="small">
105+
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
106+
</textarea>
107+
</form>
108+
</div><!-- End GitHub pages formatting -->
109+
</body>
110+
</html>

0 commit comments

Comments
 (0)