foo_idのpresenceでは、存在しないIDでも保存できてしまう- fooを参照した際は
nilが返る
- fooを参照した際は
fooのpresenceを指定すると、foo_idへの代入ではバリデーションを通らなくなるfooに未保存のオブジェクトを代入してsave!するとPG::NotNullViolationが発生するPG::NotNullViolation: ERROR: null value in column "character_id" violates not-null constraint
- Polymorphic association
validates :foo_type, presence: trueは不要
- クラスが存在しない場合はsave!時に
NameError: uninitialized constant XXXが発生する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.util.Log; | |
| import com.squareup.leakcanary.AnalysisResult; | |
| import com.squareup.leakcanary.DisplayLeakService; | |
| import com.squareup.leakcanary.HeapDump; | |
| import retrofit.RestAdapter; | |
| import retrofit.RetrofitError; | |
| import retrofit.http.Multipart; | |
| import retrofit.http.POST; | |
| import retrofit.http.Part; | |
| import retrofit.mime.TypedFile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createUUID() { | |
| return uuid.v4(); | |
| } | |
| // version 4 | |
| // createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$'; | |
| createUUID.regex = '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'; | |
| createUUID.is = function (str) { | |
| return new RegExp(createUUID.regex).test(str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| INSTALL_PATH="$HOME/scripts" | |
| SCRIPT_PATH="$INSTALL_PATH/customsshd" | |
| LAUNCHCTL_PATH="$HOME/Library/LaunchAgents/com.my.customsshd.plist" | |
| SSH_KEYS_INSTALL_PATH=$HOME/customkeys | |
| SSH_HOST_KEY=$SSH_KEYS_INSTALL_PATH/ssh_host_key | |
| SSH_HOST_RSA_KEY=$SSH_KEYS_INSTALL_PATH/ssh_host_rsa_key | |
| SSH_HOST_DSA_KEY=$SSH_KEYS_INSTALL_PATH/ssh_host_dsa_key | |
| SSHD_PORT=50111 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <root> | |
| <item> | |
| <name>Private</name> | |
| <item> | |
| <name>Disable all settings while you are using Atom.</name> | |
| <identifier>ignore_apps.atom</identifier> | |
| <only>Atom</only> | |
| <autogen>__PassThrough__</autogen> | |
| </item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.text.SpannableStringBuilder; | |
| import java.util.ArrayDeque; | |
| import java.util.Deque; | |
| import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; | |
| /** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */ | |
| public class Truss { | |
| private final SpannableStringBuilder builder; | |
| private final Deque<Span> stack; |
http://co3k.org/blog/csrf-token-should-not-be-session-id について。
この記事では触れられていませんが、
- むかし、セッションIDをHTMLソース中に埋め込んでも脅威は変わらないと主張した人がいました
- 正確には「hiddenの値のみ漏れやすいような特殊な脆弱性が無ければ」という前提であったけれど、実際にそのようなバグはあったし、予見されていた。
- とても影響のある人だったので、色々なサイトや書籍がその方法を紹介し、安全なウェブサイトの作り方にも載ってしまいました
この際ハッキリ言っておくべきだと思うので書きますが、そもそもセッションIDを(HTMLソース中に埋め込む)CSRF対策トークンとして使うのは間違いでした。最初から間違っていたのです。正確に言うとCSRFの話は関係ないですね。CSRF関係なく、特に「単体で」セッションハイジャックが可能になるような値を、HTMLソース中に埋め込むべきではありません。
| 更新: | 2026-08-01 |
|---|---|
| 作者: | @voluntas |
| バージョン: | 2026.2 |
| URL: | https://voluntas.github.io/ |
typo などは https://x.com/voluntas までご連絡ください。
- メインスピーカー:マシューさん(@matthewmccull)
- サブスピーカー:ジョンさん(@johndbritton)
従来の CVCS (集中バージョン管理システム)のリビジョン番号は連番。 SVN はサーバーにデプロイした時点でリビジョン番号1と設定される。