[Bug]: content-length-guardrail policy schema accepts a configuration with neither request nor response

オープン 初心者向け
#4,329 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

content-length-guardrailポリシーのpolicy-definition.yamlを見つけ、そのスキーマをword-count-guardrail、sentence-count-guardrail、regex-guardrail、url-guardrailの各スキーマと比較してください。issueに記載されたrequestまたはresponseの要件を追加し、スキーマが空のparamsを拒否し、requestまたはresponseのいずれかを含む設定を受け入れることを確認してください。issueでは、wso2/gateway-controllers#415の統合アサーションも参照されています。

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

説明

Area/Policies Aspect/API Aspect/Configuration Severity/Minor Type/Bug
Please select the area the issue is related to

Gateway

Please select the aspect the issue is related to

Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI), Aspect/Configuration (Config files, settings, env vars, defaults)

Description

The content-length-guardrail documentation says: "At least one of request or response must be provided." The policy refuses a configuration with neither. Its schema does not enforce the rule, so such a configuration passes API creation and fails at runtime instead.

The API is created, and every request to the operation then gets HTTP 500. A mistake that should fail the deployment breaks the operation.

Other guardrails in the repository enforce this rule in their schema, for example word-count-guardrail, sentence-count-guardrail, regex-guardrail and url-guardrail:

anyOf:
  - required: [ request ]
  - required: [ response ]

A fix could add the same rule to the policy's policy-definition.yaml.

The integration suite in wso2/gateway-controllers#415 asserts this behaviour.

Steps to Reproduce
  1. Create a REST API with an operation that attaches the policy with empty parameters:
    {"name":"content-length-guardrail","version":"v1","params":{}}
    
  2. The API is created.
  3. Every request to that operation gets HTTP 500. An operation on the same API with a valid configuration still works.
Severity Level of the Issue

Severity/Minor (Non-critical functionality. Can be fixed in future releases)

Environment Details (with versions)
  • Policy: content-length-guardrail v1.1.0, wso2/gateway-controllers main (4f1520a8)
  • Gateway versions: 1.1.0 (patched), 1.2.0 and latest (main-59dcd51)
主要言語
Go
スター
85
フォーク
137
平均マージ
1日 12時間
マージ済み PR(30日)
247

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

wso2/api-platform のほかの issue

wso2/api-platform の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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