<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>karlley_jp</author_name>
  <author_url>https://blog.hatena.ne.jp/karlley_jp/</author_url>
  <blog_title>時々とおまわり</blog_title>
  <blog_url>https://karlley.hatenablog.jp/</blog_url>
  <categories>
    <anon>SQL</anon>
    <anon>セキュリティ</anon>
    <anon>DB</anon>
    <anon>PostgreSQL</anon>
  </categories>
  <description>前回の記事ではPostgreSQLを使ったSinatraのメモアプリにSQLインジェクション攻撃ができることを確認したので、その対策について調べてみました。 環境 今回紹介するSQLインジェクションの対策は下記の環境で行いました。 DB: PostgreSQL フレームワーク: Sinatra DB接続用ライブラリ: pg 結論 SQLインジェクションの対策には次の2つを行う。 プレースホルダー(バインド機構)でSQL文を組み立てる。 パラメータを正しくリテラルとして展開する。 文字列リテラル: エスケープすべき文字をエスケープする。 数値リテラル: 数値以外の文字を混入させない。 対策1. …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkarlley.hatenablog.jp%2Fentry%2F2022%2F08%2F11%2F070518&quot; title=&quot;PostgreSQLのSQLインジェクションの対策 - 時々とおまわり&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-08-11 07:05:18</published>
  <title>PostgreSQLのSQLインジェクションの対策</title>
  <type>rich</type>
  <url>https://karlley.hatenablog.jp/entry/2022/08/11/070518</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
