Skip to content

Commit 180f473

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

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

docs/labs/hardcoded.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,59 @@ info =
77
{
88
absent: String.raw`^ \s* conn = DriverManager \. getConnection \( url \,`,
99
text: "Your answer should start with `conn = DriverManager.getConnection( url,` just as the initial value did. You might want to use the `Reset` button.",
10+
text_ja: "回答は元からあるように `conn = DriverManager.getConnection( url,` で始まるはずです。「リセット」ボタンを使うとよいかもしれません。",
1011
},
1112
{
1213
absent: String.raw`System \. getenv`,
1314
text: "Use `System.getenv` to retrieve an environment variable value. For example, use `System.getenv(\"USERNAME\")` to retrieve the username.",
15+
text_ja: "環境変数の値を取得するためには `System.getenv` を使います。例えばユーザ名を取得するためには `System.getenv(\"USERNAME\")` を使ってください。",
1416
},
1517
{
1618
present: String.raw`System \. getenv \( \"admin\" \)`,
1719
text: "You need to pass to `System.getenv` the name of an environment variable value, not the result you might get. Do not use constructs like `System.getenv(\"admin\")`. Instead, for example, use `System.getenv(\"USERNAME\")` to retrieve the username.",
20+
text_ja: "`System.getenv` には取得したい値ではなく、環境変数の名前を渡します。`System.getenv(\"admin\")` の代わりに、例えばユーザ名を取得するためには `System.getenv(\"USERNAME\")` としてください。",
1821
},
1922
{
2023
absent: String.raw`System \. getenv \( \"PASSWORD\" \)`,
2124
text: "Use `System.getenv` to retrieve an environment variable value. For example, use `System.getenv(\"USERNAME\")` to retrieve the username.",
25+
text_ja: "環境変数の値を取得するためには `System.getenv` を使います。例えばユーザ名を取得するためには `System.getenv(\"USERNAME\")` を使ってください。",
2226
},
2327
{
2428
present: "admin",
2529
text: "The term 'admin' should not be in your code. You should be retrieving both the username and the password from somewhere else, in this case, from environment variables.",
30+
text_ja: "'admin' という語句はコードに現れるべきではありません。ユーザ名とパスワードのどちらもどこか他の場所から、今回のケースでは環境変数の値から取得する必要があります。",
2631
},
2732
{
2833
present: "(system|Getenv|GetEnv)",
2934
text: "Java is case-sensitive. You need to use `System.getenv` and not some other variation of uppercase or lowercase.",
35+
text_ja: "Java は大文字と小文字を区別します。`System.getenv` 以外の大文字と小文字の組み合わせを使ってはいけません。",
3036
},
3137
{
3238
absent: String.raw`\; \s* $`,
3339
text: "Java statements must end with a semicolon.",
40+
text_ja: "Java のステートメントはセミコロンで終わる必要があります。",
3441
},
3542
{
3643
absent: String.raw`\) \) \; \s* $`,
3744
text: "Double-check your closing parentheses at the end of the statement.",
45+
text_ja: "ステートメント終わりの右側(閉じ)カッコをもう一度確認してください。",
3846
},
3947
{
4048
present: String.raw`new\s+String`,
4149
text: "You do not need to construct a new string to retrieve an environment variable value.",
50+
text_ja: "環境変数の値を取得するために新たに文字列を作成する必要はありません。",
4251
},
4352
{
4453
present: String.raw`^ conn = DriverManager \. getConnection \( url \) \; \s* $`,
4554
text: "In some sense this is correct, as long as the url is not hardcoded. However, it's often better if administrators can easily change the username or password separately, and it makes out point clearer. Please provide the username and password and separate values.",
55+
text_ja: "URL がハードコードされていない限り、ある意味これは正解です。しかしユーザ名とパスワードを容易にかつ個別に変更できることはしばしば管理者にとって望ましく、かつそれにより問題の本質が明確になります。ユーザ名とパスワードは個別の値としてください。",
4656
},
4757
{
4858
present: String.raw`^ \s* conn = DriverManager \. getConnection \( url \,
4959
System \. getenv \( "PASSWORD" \) \,
5060
System \. getenv \( "USERNAME" \) \) \; \s* $`,
5161
text: "The order of parameters is wrong. Provide the url, then the username, then the password. You're providing the url, then the password, then the username, which swaps the second and third parameters.",
62+
text_ja: "引数の順番に誤りがあります。URL、ユーザ名、パスワードの順としてください。URL、パスワード、ユーザ名の順になっており、二番目と三番目の引数が逆になっています。",
5263
},
5364
],
5465
expected: [

docs/labs/ja_hardcoded.html

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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="hardcoded.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+
</head>
15+
<body>
16+
<!-- For GitHub Pages formatting: -->
17+
<div class="container-lg px-3 my-5 markdown-body">
18+
<h1>ラボ演習 hardcoded</h1>
19+
<p>
20+
これはセキュアなソフトウェア開発に関するラボ演習です。
21+
ラボの詳細については、<a href="ja_introduction.html" target="_blank">概要</a>をご覧ください。
22+
23+
<p>
24+
<h2>タスク</h2>
25+
<p>
26+
<b>サンプルコードからハードコードされた認証情報を取り除いてください。</b>
27+
28+
<p>
29+
<h2>背景</h2>
30+
<p>
31+
この演習では、ハードコードされた認証情報(この場合はパスワード)をコードから取り除きます。
32+
33+
<p>
34+
<h2>タスクの詳細</h2>
35+
<p>
36+
37+
<p>
38+
以下の Java コードを変更して、ハードコードされた認証情報を取り除いてください。
39+
このコードはハードコードされたユーザ名 "admin" と同じくハードコードされたパスワード "admin" でデータベースシステムにログインします。
40+
最低でも、パスワードはソースコードの中にハードコードして <i>公開すべきものではありません</i>
41+
パスワードなどの秘密とすべき認証情報がハードコードされていると、不必要に広く公開されてしまい、また変更が困難になります。
42+
ユーザ名も変更される可能性があるので、<i>ハードコードしない</i> 方が賢明です。
43+
44+
<p>
45+
ここでは目的を達成するため、ユーザ名とパスワードを環境変数の値から取得するようにコードを修正します。
46+
ユーザ名(第二引数)は環境変数 <tt>USERNAME</tt> に格納されており、パスワード(第三引数)は環境変数 <tt>PASSWORD</tt> に格納されているものとします。
47+
Java では <tt>System.getenv("FOO")</tt> によって環境変数 <tt>FOO</tt> の値が取得できます。
48+
49+
<p>
50+
環境変数はプログラムのあらゆる部分から参照できてしまうため、汎用的に完璧な手段とはいえません。
51+
より良い他の方法が、あなたが使っているプラットフォームには用意されているかもしれません。
52+
ただしこの場の例としては、移植性に優れており、使うのが簡単で、<i>なにより認証情報をハードコードするよりも良い方法である</i> ことから、環境変数を用います。
53+
注:Java は URL にユーザ名とパスワードを埋め込む形式をサポートしていますが、説明を単純にするためここでは使用しません。
54+
55+
<p>
56+
必要に応じて、「ヒント」ボタンと「諦める」ボタンを使用してください。
57+
58+
<p>
59+
<h2>演習 (<span id="grade"></span>)</h2>
60+
<p>
61+
以下の Java コードを修正し、ハードコードされたパスワードとユーザ名を取り除いてください。
62+
<p>
63+
<form id="lab">
64+
<pre><code
65+
><textarea id="attempt0" rows="3" cols="60" spellcheck="false"
66+
>conn = DriverManager.getConnection(url,
67+
"admin", "admin");</textarea></code></pre>
68+
<button type="button" class="hintButton">ヒント</button>
69+
<button type="button" class="resetButton">リセット</button>
70+
<button type="button" class="giveUpButton">諦める</button>
71+
<br><br>
72+
<p>
73+
<i>このラボは<a href="https://www.microsoft.com/">Microsoft</a>のAvishay Balterによって開発されました。</i>
74+
<br><br>
75+
<p id="correctStamp" class="small">
76+
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
77+
</textarea>
78+
</form>
79+
</div><!-- End GitHub pages formatting -->
80+
</body>
81+
</html>

0 commit comments

Comments
 (0)