Three search parameter forms get an HTTP 500 response or are silently ignored

オープン
#2,553 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
clojure
領域
api, backend

調査の方向性

Start by locating the search parameter parsing and validation code for indexed names, case-insensitive duplicate parameters, and boolean values such as include_granule_counts; the issue does not name files or tests. Reproduce the three examples against the collections and granules search endpoints, then inspect the relevant validation tests. Done when each malformed form returns a 400 naming the parameter, or uppercase TRUE is handled the same as true.

索引モデルが issue の本文から書いたものです。

説明

Three search parameter forms get an HTTP 500 response or are silently ignored, where CMR rejects similar forms with a 400 response that names the parameter. The output below is from 2026-12-01.

1. An indexed sort_key is an HTTP 500 response
$ curl -sSg -w ' HTTP %{http_code}\n' 'https://cmr.earthdata.nasa.gov/search/granules.json?short_name=MOD11A2&page_size=0&sort_key[0]=-start_date'
{"errors":["An Internal Error has occurred."]} HTTP 500

Expected: a 400 response that names the parameter, as an indexed short_name gets:

$ curl -sSg -w ' HTTP %{http_code}\n' 'https://cmr.earthdata.nasa.gov/search/granules.json?short_name[0]=MOD11A2&page_size=0'
{"errors":["Parameter [short_name] must have a single value or multiple values."]} HTTP 400
2. A parameter given in both lower case and upper case keeps one value without an error

CMR accepts a parameter name in upper case as well as lower case, and rejects a parameter that takes a single value, such as page_size, when it is given twice. The commands below use a helper that prints the status, then the number of collections or the first error:

search() { curl -sS -w '%{http_code}' "https://cmr.earthdata.nasa.gov/search/collections.json?$1" | jq -rs '"HTTP \(.[1]), " + (.[0].errors[0] // "collections: \(.[0].feed.entry | length)")'; }
$ search 'PAGE_SIZE=2'
HTTP 200, collections: 2
$ search 'page_size=5&page_size=1'
HTTP 400, Parameter [page_size] must have a single value.

Given once in lower case and once in upper case, the parameter keeps one value and drops the other without an error, even when the dropped value is invalid:

$ search 'page_size=5&PAGE_SIZE=1'
HTTP 200, collections: 1
$ search 'PAGE_SIZE=1&page_size=5'
HTTP 200, collections: 5
$ search 'page_size=abc&PAGE_SIZE=1'
HTTP 200, collections: 1

Expected: the same 400 response as for page_size=5&page_size=1.

3. include_granule_counts=TRUE is neither honored nor rejected

include_granule_counts=true adds a granule_count to each collection, and a value such as 1 gets a 400 response. The commands below use a helper that prints the status, then the granule_count of the one collection that matches, or the first error:

counts() { curl -sS -w '%{http_code}' "https://cmr.earthdata.nasa.gov/search/collections.json?short_name=MOD11A2&page_size=1&include_granule_counts=$1" | jq -rs '"HTTP \(.[1]), " + (.[0].errors[0] // "granule_count: \(.[0].feed.entry[0].granule_count)")'; }
$ counts true
HTTP 200, granule_count: 389798
$ counts 1
HTTP 400, Parameter include_granule_counts must take value of true, false, or unset, but was [1]

Given as TRUE or True, the value gets a 200 response without the count:

$ counts TRUE
HTTP 200, granule_count: null
$ counts True
HTTP 200, granule_count: null

Expected: the count, as for true, or the 400 response that 1 gets.

主要言語
Clojure
スター
403
フォーク
113
平均マージ
3日 2時間
マージ済み PR(30日)
13

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nasa/Common-Metadata-Repository のほかの issue

nasa/Common-Metadata-Repository の issue をすべて見る

似ている issue

Clojure の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。