微軟的 IE6+ 安全性更新

即使 Windows XP 在上個月就已經停止安全性更新,但這次的 CVE-2014-1776 影響層面還是太廣,微軟還是提供 Windows XP 用戶相關的 patch (透過 Windows Update 發送):

Use-after-free vulnerability in VGX.DLL in Microsoft Internet Explorer 6 through 11 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via unspecified vectors, as exploited in the wild in April 2014.

在「Security Update Released to Address Recent Internet Explorer Vulnerability」也可以看到說明。

看到 use-after-free 這個詞就想到 OpenSSL 前陣子也來一發 CVE-2010-5298 (居然是 2010 年的 CVE),讓人... XD

PHP Composer 的安全性問題

ComposerPHP 上新一代的套件管理軟體。

Composer 與之前各種方案不同的地方在於,後面掛了 Packagist 這個 PHP package archivist,讓使用者很方便的取得套件 (以及更新)。

其中有一個功能是 replace,表示我所開發的這個套件「宣稱」可以取代其他套件 (通常是 API compatible)。

看到這個功能的時候,以為是要讓 Packagist 能夠串起連結。畢竟偶而會發生「這個套件最新版是 2008 年了,到底有沒有後續維護啊」的情況。如果 Packagist 官方網站可以串起連結,可以節省開發者時間,而且也可以利用 Packagist 上的熱門度來決定要用哪一個後繼者。

但實際上與預期的不同,Composer 的預設值是會「自動」尋找更新並且真的使用,也就是前幾天被丟出來的議題:「Composer is wide open with a massive security vulnerability」。

攻擊者只要在 Packagist 上面上傳一堆含有惡意程式碼的套件 (並且利用 replace 宣稱可以取代 ZF2 或是 Laravel),受害者在 composer update 的時候就有機會抓到這些有惡意程式碼的套件。

而最糟糕的是,主要開發者認為這不是問題,還寫了一大篇文章顧左右而言他之後說「錯覺啦~」:「Composer: Replace, Conflict & Forks Explained」:

Replace is not a bug. Don’t run composer update in automated systems. Forks are allowed on Packagist. Don’t be an idiot when publishing a fork. Got an unexpected fork on update? Your dependencies conflict with the original package. Use conflict (syntax like require) in your composer.json to blacklist the fork and see an explanation of the dependency issue.

於是發現問題的人就爆炸了。

依照往例,vendor 不覺得是問題的安全漏洞,只能把事情弄大爆出來逼 vendor 修。

修正在「Limit Replace / Provides to packages required by name in root package or any dep」這裡。最新版的 Composer 裡已經納入這個修正了。

UPSERT

維基百科對 UPSERT 的說明:(取自「Merge (SQL)」條目)

A relational database management system uses SQL MERGE (also called upsert) statements to INSERT new records or UPDATE existing records depending on whether or not a condition matches.

MySQL 裡的兩種語法其實就是在實做這個需求:

  • REPLACE INTO ...
  • INSERT INTO ... ON DUPLICATE KEY UPDATE ...

而前者其實是後者的一個特例 (當 INSERT 發現有 dupe key 時把現有的 record 改成與 INSERT 時相同的條件)。

而計數器是後者常見的 case 之一:當 record 不存在的時候塞一筆進去,並且將 counter 設為 1;當 record 存在的時候對 counter 加一更新。像是這樣的 SQL query:

INSERT INTO my_table SET id = ?, num = 1 ON DUPLICATE KEY UPDATE num = num + 1;

由於這是常見的需求,使得這個語法是目前少數 MySQL 比 PostgreSQL 好用的地方。

在「A Case for Upserts」這篇就看到抱怨 PostgreSQL 不實做這個功能...

不過我覺得作者寫得有點誇張,INSERT INTO ... ON DUPLICATE KEY UPDATE ... 應該是可以模擬出來的功能:當 INSERT 失敗後再跑 UPDATE。而 REPLACE INTO ... 是特例,也就當然可以模擬出來。

Diablo III 將移除拍賣場 (包含了現金交易市場以及遊戲金幣交易市場)...

英文版的公告內容:「Diablo® III Auction House Update」,以及中文版的公告內容:「《暗黑破壞神®III》拍賣場最新消息」。

重點文字有兩段,第一段是說明未來的遊戲金幣交易以及現金交易將被移除:

With that in mind, we want to let everyone know that we've decided to remove the gold and real-money auction house system from Diablo III.

因此,我們想讓大家知道,我們已決定移除《暗黑破壞神III》的金幣拍賣場和現金拍賣場系統。

第二段的重點是中止的時間點:

Please note that the shutdown will occur on March 18, 2014. We will keep everyone informed as we work through this process.

請注意,拍賣場系統將會在2014年3月18日關閉。一旦有最新消息,我們將會另行通知大家。

用 Go 發展的 groupcache...

groupcacheBrad Fitzpatrick 最新的作品 (之前最有名的兩個作品是 memcachedOpenID 1),目標在於取代一部分 memcached 的功能。

以官方的說明是:

groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.

另外一篇介紹文是「Playing With Groupcache」。

跟 memcached 差異最大的地方在於「沒有更改與刪除的功能」,一旦寫進去後就不會變動。在放棄 update/delete 的特性後,換來的是:

  • Cluster 的能力。
  • 處理熱點的能力。

以往在 memcached server 之間是沒有交集的,在 groupcache 則是 cluster 起來。另外以前在 memcached 會因為同時存取同一個 key 而造成 single CPU overloading 的問題,在 groupcache 則透過 auto-mirror 機制解決。

不過還是得想一下要怎麼用,畢竟沒有 update/delete 功能...

PostgreSQL 對 security update 的極端作法...

Hacker News 文摘上看到,PostgreSQL 決定對這次的 security update 採取最極端的作法:「Extra security measures for next week's releases」。

包括全面管制 Git repository 公開資訊:官方的 Git repository 將會在正式釋出修正前限制只有 committer 可以存取,並且暫停 GitHub 以及其他 git mirror 權限。

另外 mailing list 也受到管制,包括了 src commit log 以及 document commit log。

信件開頭就提到這次安全性漏洞足以說服 PostgreSQL 的人採取最極端的作法,避免在有修正方案前造成漏洞洩漏出來被使用:

The core committee has decided that one of the security issues due to be fixed next week is sufficiently bad that we need to take extra measures to prevent it from becoming public before packages containing the fix are available. (This is a scenario we've discussed before, but never had to actually implement.)

不過這反而讓人更關注,甚至上了 Hacker News 熱門榜...

Java SE 6 下個月將停止提供安全更新...

在「Oracle Will Stop Providing Security Updates for Java 6 Next Month」這邊看到的,Java SE 6 預定在 2013/02/19 對外發佈最後一次安全性更新,之後只有付費購買服務的單位才能透過 My Oracle Support 取得更新。

另外更新程式提供了 Java SE 6 升級到 Java SE 7 的功能,不過當然不保證你跑的程式在 Java SE 7 上會動,還是要花時間去測試才知道會不會爆炸 :p

照「Java version history」上的紀錄,Java SE 6 是 2006/12/11 發行的,所以也六年多了... 而 Java SE 7 是在 2011/07/28 發行的,是目前最新的版本。