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

Abierto
#178 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@TharmiganK ya está trabajando en esto.

Desde el 10/11/2026.

  • #180 de @TharmiganK — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
15
Forks
12
Merge medio
2 d 19 h
PR fusionados (30 d)
20

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ballerina-platform/static-code-analysis-tool

Todos los issues de ballerina-platform/static-code-analysis-tool

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.