Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Javaによるセキュアコーディングの第一歩

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

 Javaによるセキュアコーディングの第一歩

Avatar for よしたろう

よしたろう

August 12, 2023
Tweet

More Decks by よしたろう

Other Decks in Programming

Transcript

  1. ΤϯδχΞલ ೥݄d 
 ɹɹɹɹɹɹ 
 ೥݄d 
  
 ೥݄d

    !ZPTIJUBSPZPZP 
 ༀہళ௕ɾྟচ޻ֶٕ࢜ɾͤͲΓɾεΫʔϧߨࢣ 
 େࡕͷडୗ։ൃاۀ 
 େࡕͷࣗࣾ։ൃͷ4&4෦໳ 
 ۚ୔ͷ஍ۜࢠձࣾࣗࣾ։ൃاۀ 
 ΤϯδχΞͷྠɾژ౎ϓϩάϥϛϯάڭࣨӡӦϝϯόʔ झຯ 
 μϯεɾԻָɾόΠΫɾөըɾອըখઆɾྉཧɾΞʔτFUD yoshitaro
  2. Date retirementDate = new Date(Date.parse("Tue 1 Nov 2016")); Date partyDate

    = retirementDate; ϝϞϦ্Ͱ͸Կ͕ى͖͍ͯΔͷͰ͠ΐ͏͔ʁ
  3. Date retirementDate = new Date(Date.parse("Tue 1 Nov 2016”)); Date partyDate

    = retirementDate; 、 ⾔ ⼀時保存領域 、 展開 必要 。 両者 違 、 ⼤ 。 様 ⼤ 領域 扱 (Java)
  4. Date retirementDate = new Date(Date.parse("Tue 1 Nov 2016")); Date partyDate

    = new Date(retirementDate.getTime()); σΟʔϓίϐʔͰ͸ɺෳ੡ݩͷ஋Λ༻͍ͯΠϯελϯεԽ Date retirementDate = new Date(Date.parse("Tue 1 Nov 2016")); Date partyDate = retirementDate; γϟϩ΢ίϐʔ͸͜Ε
  5.   new 演算⼦ 領域   新  展開 特殊 演算⼦ 1.

    領域 新領域 確保 2. 格納 値 3. 新領域 参照値 変数代⼊ Date retirementDate = new Date(Date.parse("Tue 1 Nov 2016")); Date partyDate = new Date(retirementDate.getTime());
  6.  ϓϦϛςΟϒܕ͸஋͕ͦͷ··ෳ੡͞ΕΔ 
 ɹˠελοΫྖҬ಺ʢσΟʔϓίϐʔʹࣅ͍ͯΔʣ  ࢀরܕ͸ࢀরઌͷΞυϨε͕ෳ੡͞ΕΔ 
 ɹˠγϟϩ΢ίϐʔ 
 


    ˞4USJOHܕ͸ࢀরܕ͕ͩɺෆมΦϒδΣΫτͳͷͰ 
 ࠶୅ೖͷ౓ʹΠϯελϯε͕ੜ੒͞ΕΔ ࠶୅ೖ͞ΕΔσʔλͷܕ͕ ϓϦϛςΟϒܕ͔ࢀরܕ͔ʹΑͬͯڍಈ͕มΘΔ
  7. ・⼆枚⽬ Date partyDate = retirementDate; 同 参照値 共有 ・三枚⽬ partyDate.setDate(5);

    「共有 状態 意図 変更 」 
 Setter 様 可変 場合 、発⽣ 問題 「 不注意」 Java・Ruby・Python・PHP 、参照 複製 明⽰的 記述 OOP 起