ballerina:13 reports boolean strings, auth scheme names and qualified secret names

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

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

@TharmiganK がすでに取り組んでいます。

2026年11月10日 から。

  • #180 @TharmiganK による — オープン

評価

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

調査の方向性

Start with the ballerina:13 rule implementation and its tests, especially the tests for #109 and the ballerina/http cases mentioned in the issue. Check how it recognizes boolean strings, authentication scheme values, and secret-like target names. Add coverage for the listed examples and confirm they are no longer reported while other hard-coded secrets still are.

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

説明

Area/Rules Type/Bug
Description

Rule ballerina:13 (Hard-coded secrets) reports string values that are not secrets, because the name of the target contains a secret-like word. #109 fixed boolean values, values built from configurables, and protocol keywords such as access_token. These forms are still reported:

import ballerina/http;

// 1. A boolean as a string, for the CORS `Access-Control-Allow-Credentials` header value
function assertCors(http:Response response, string credentials) {
}

// 2. A variable whose name only qualifies the secret word
function proxyStatus(http:Request req) returns string {
    string hasAuthHeader = "No Proxy";
    if req.hasHeader("Proxy-Authorization") {
        hasAuthHeader = "Proxy";
    }
    return hasAuthHeader;
}

// 3. An authentication scheme name with no credential
function incompleteHeaders() returns [string, map<string>] {
    string incompleteBasicAuth = "Basic";
    return [incompleteBasicAuth, {"authorization": "Basic "}];
}

public function main() {
    assertCors(new, "true");
}

"true", "No Proxy", "Proxy", "Basic" and "Basic " are reported.

Found in ballerina/http test packages.

Suggested Improvement
  • Don't report "true" and "false", as #109 already does for boolean values.
  • Don't report a value that is only an authentication scheme name (Basic, Bearer, Digest, with or without the trailing space), in the same way as the protocol keywords in #109.
  • Don't treat a name as secret-named when the secret word is qualified by a boolean prefix such as has, is or use (hasAuthHeader).
Version

0.13.0

主要言語
Java
スター
15
フォーク
12
平均マージ
2日 19時間
マージ済み PR(30日)
20

環境構築

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

はじめの一歩

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

ballerina-platform/static-code-analysis-tool のほかの issue

ballerina-platform/static-code-analysis-tool の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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