False positive for ballerina:14 (Non configurable secrets) when a secret-named parameter defaults to nil ()
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by reproducing the ballerina:14 scan with the provided decodeRsaPrivateKeyFromKeyFile example and locate the implementation of rule ballerina:14. Check how secret-named parameters are evaluated when their default is nil (), then verify the example produces no finding while fixed secret defaults remain reported.
Written by the indexing model from the issue text.
Description
Description
Rule ballerina:14 (Non configurable secrets are security-sensitive) flags a defaultable function parameter whose name looks like a secret, even when its default value is nil (). A nil default means "no value supplied". It isn't a fixed secret, so this shouldn't be reported.
Steps to Reproduce
Scan a Ballerina file containing:
public isolated function decodeRsaPrivateKeyFromKeyFile(string keyFile, string? keyPassword = ())
returns PrivateKey|Error = @java:Method {
'class: "io.ballerina.stdlib.crypto.nativeimpl.Decode"
} external;
(Found in the ballerina/crypto module.)
Actual Behavior
A ballerina:14 issue is raised.
Expected Behavior
No issue should be reported. keyPassword = () only makes the parameter optional, and callers still pass the real value at runtime. No secret is hardcoded and nothing needs rotating.
This pattern is common in standard library and connector APIs, so the false positive will appear in many projects.
Version
0.12.0
Environment Details (with versions)
No response
- Dominant language
- Java
- Stars
- 15
- Forks
- 12
- Avg merge
- 12h 17m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ballerina-platform/static-code-analysis-tool
-
Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ballerina-platform/static-code-analysis-tool#140 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ballerina-platform/static-code-analysis-tool#139 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 5/5 Over a week Newbie friendliness 35/100
ballerina-platform/static-code-analysis-tool#142 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ballerina-platform/static-code-analysis-tool#141 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 3/5 1-2 days Newbie friendliness 62/100
ballerina-platform/static-code-analysis-tool#138 ·
Maintainers usually reply within 1 day
All issues in ballerina-platform/static-code-analysis-tool
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
quarkiverse/quarkus-google-cloud-services#1188 ·
Maintainers usually reply within 1 day
-
Component: Frontend Component: Web Component Type: Maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
it-at-m/refarch-templates#1944 ·
Maintainers usually reply within 2 days
-
priority: p2 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
googleapis/java-genai#1372 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 60/100