diff options
| author | fukachan <fukachan> | 2001-11-25 12:03:23 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-11-25 12:03:23 +0000 |
| commit | 7c724645a73f51cf022b1ebecd09ba64e8febb05 (patch) | |
| tree | 4c1e699340156af501bbc3dc4e3d8e0bf19fcf80 /fml/doc/ja/tutorial | |
| parent | 3ee1f5e998746cbdcbc09688f6a1accbffb220b0 (diff) | |
| download | fml8-7c724645a73f51cf022b1ebecd09ba64e8febb05.tar.gz fml8-7c724645a73f51cf022b1ebecd09ba64e8febb05.tar.bz2 fml8-7c724645a73f51cf022b1ebecd09ba64e8febb05.zip | |
how to restrict and check input data
Diffstat (limited to 'fml/doc/ja/tutorial')
| -rw-r--r-- | fml/doc/ja/tutorial/book.sgml | 5 | ||||
| -rw-r--r-- | fml/doc/ja/tutorial/include/chapters.ent | 3 | ||||
| -rw-r--r-- | fml/doc/ja/tutorial/internals/restriction.sgml | 92 |
3 files changed, 98 insertions, 2 deletions
diff --git a/fml/doc/ja/tutorial/book.sgml b/fml/doc/ja/tutorial/book.sgml index 3579d99b..f2004f2c 100644 --- a/fml/doc/ja/tutorial/book.sgml +++ b/fml/doc/ja/tutorial/book.sgml @@ -2,7 +2,7 @@ This is an sgml using DocBook dtd. Use sgmltools version 2.0.x or above to generate various output formats. -$FML: book.sgml,v 1.25 2001/11/25 03:52:12 fukachan Exp $ +$FML: book.sgml,v 1.26 2001/11/25 06:06:56 fukachan Exp $ --> <!doctype book public "-//FML//DTD DocBook V3.1-Based Extension//EN" [ @@ -92,6 +92,9 @@ $FML: book.sgml,v 1.25 2001/11/25 03:52:12 fukachan Exp $ &chapter.message; &chapter.replybyfml; + <!-- セキュリティ --> + &chapter.restriction; + <!-- その他 --> &chapter.db; &chapter.dbms; diff --git a/fml/doc/ja/tutorial/include/chapters.ent b/fml/doc/ja/tutorial/include/chapters.ent index 9b0388d2..d0521c9b 100644 --- a/fml/doc/ja/tutorial/include/chapters.ent +++ b/fml/doc/ja/tutorial/include/chapters.ent @@ -1,5 +1,5 @@ <!-- - $FML: chapters.ent,v 1.24 2001/11/25 03:52:13 fukachan Exp $ + $FML: chapters.ent,v 1.25 2001/11/25 06:06:57 fukachan Exp $ --> <!entity versin "1.1"> @@ -60,6 +60,7 @@ <!entity chapter.programingstyle SYSTEM "internals/style.sgml"> <!entity chapter.design SYSTEM "internals/design.sgml"> <!entity chapter.config.cf SYSTEM "internals/config.cf.sgml"> +<!entity chapter.restriction SYSTEM "internals/restriction.sgml"> <!-- variables --> <!entity table.list.variables SYSTEM "internals/list.variables.sgml"> diff --git a/fml/doc/ja/tutorial/internals/restriction.sgml b/fml/doc/ja/tutorial/internals/restriction.sgml new file mode 100644 index 00000000..3deb431c --- /dev/null +++ b/fml/doc/ja/tutorial/internals/restriction.sgml @@ -0,0 +1,92 @@ +<!-- + $FML: restriction.sgml,v 1.4 2001/10/21 02:18:09 fukachan Exp $ +--> + +<chapter id="restriction"> + <title> + 制限 + </title> + + +<sect1 id="restriction.class"> + <title> + FML::Restriction クラス + </title> + +<para> +入力データや、 +コマンドの ACL は +FML::Restriction クラス以下にモジュールを配置することにしています。 +</para> + +<para> +例えば、CGI では +FML::Restriction::CGI クラスのモジュールを用いて +入力データがある正規表現の中に収まるかどうか?の検査をしています。 +</para> + +<para> +FML::Restriction 以下では +Base を継承したりしますが、 +他のモジュールでは、FML::Restriction クラスを object composition +として使って下さい。 +例えば、 +<screen> +use FML::Restriction::CGI; +$safe = new FML::Restriction::CGI; +my $allowed_regexp = $safe->param_regexp(); + +if ($value =~ /^$allowed_regexp{$key}$) { ... ok, do something ... ;} +</screen> +のように使います。 +</para> + +</sect1> + + +<sect1 id="restriction.cgi.input.data"> + <title> + CGI における入力データの制限 + </title> + +<para> +CGI では +FML::Restriction::CGI クラスのモジュールを用いて +入力データがある正規表現の中に収まるかどうか?の検査をします。 +</para> + +<para> +入力値は、前述のクラスの入力制限をうけるべきです。 +そのため、直接 param() を使ってはいけません。 +必ず safe_param_xxx() メソッドを通じてのみ、 +param() ( CGI モジュール )からのデータ入力をして下さい。 +</para> + +<para> +なお、入力されたキーワード一覧を調べるために、 +<screen> +for my $dirty_buf (param()) { + ... check ... +} +</screen> +のような構文は許す必要はあるでしょうが、 +<screen> +param($dirtty_buf) +</screen> +などとはしてはいけません。必ず +<screen> +for my $key (param()) { + ... check ... + + if (key eq $key) { + value = safe_param_key() + } +} +</screen> +のように書いて下さい。 +</para> + +</sect1> + + +</chapter> |
