Module file paths in the JSON report are only file names
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The bug is in the JSON scan report at target/report/scan_results.json, where location.filePath holds only the file name for module documents. Reproduce it with a package that has modules/db/db.bal and check the output. Compare with how the SARIF report builds its module-relative path, and make the JSON location use the same package-relative path. Done when location.filePath reads modules/db/db.bal and two same-named files in different modules are distinct.
Written by the indexing model from the issue text.
Description
Description
In target/report/scan_results.json, location.filePath holds only the file name for documents of non-default modules, while the issue's top-level filePath holds the full path. Two modules with a file of the same name, such as modules/db/main.bal and modules/cache/main.bal, give issues with the same location.filePath, so a consumer that reads location cannot tell them apart. The SARIF report uses the module path.
Steps to Reproduce
- Create a package with a module
dbcontainingmodules/db/db.bal, and add code that reports any issue in it. - Run
bal buildandbal scan. - Open
target/report/scan_results.json.
Actual, for an issue in modules/db/db.bal:
"location": {"filePath": "db.bal", ...},
"filePath": "/path/to/package/modules/db/db.bal"
Expected Behavior
location.filePath gives the path relative to the package root, modules/db/db.bal, as the SARIF report does.
Version
0.13.0-SNAPSHOT
Environment Details (with versions)
Ballerina 2201.14.0, macOS
- Dominant language
- Java
- Stars
- 15
- Forks
- 12
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 10
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
-
Area/CLI 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
-
Area/CLI 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
-
Area/Configuration Type/New Feature
Difficulty 4/5 3-5 days Newbie friendliness 18/100
ballerina-platform/static-code-analysis-tool#155 ·
Maintainers usually reply within 1 day
-
Area/Core Type/New Feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ballerina-platform/static-code-analysis-tool#154 ·
Maintainers usually reply within 1 day
-
Area/CLI Type/Bug
Difficulty 3/5 Half a day Newbie friendliness 68/100
ballerina-platform/static-code-analysis-tool#153 ·
Maintainers usually reply within 1 day
All issues in ballerina-platform/static-code-analysis-tool
Similar issues
-
PathnameExpander incorrectly interprets regex metacharacters in wildcard patternsPossibly taken @jiteshkhatri11 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
javapathfinder/jpf-core#662 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
FasterXML/jackson-databind#6366 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ballerina-platform/ballerina-library#9437 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ballerina-platform/ballerina-lang#44838 ·
Maintainers usually reply within 1 day
-
Documentation
Difficulty 1/5 Under an hour Newbie friendliness 88/100
OWASP/SecurityShepherd#1097 ·
Maintainers usually reply within 1 day