Skip to content

Commit cf3e363

Browse files
authored
fix: Detect export const/let declarations in entrypoint taint checking
2 parents ac574ba + 06f3f9c commit cf3e363

3 files changed

Lines changed: 41 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.15.2] - 2026-02-20
9+
10+
### Fixed
11+
- Fix `export const`/`export let` declarations not being added to the exports list in the TS parser, causing locally declared exported variables (e.g. `export const allScenarios = [...]`) to be invisible during entrypoint taint checking
12+
813
## [0.15.1] - 2026-02-17
914

1015
### Changed
@@ -187,6 +192,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
187192
- Multi-stage Docker build
188193
- Automated vendor upgrade workflow
189194

195+
[0.15.2]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.15.1...v0.15.2
190196
[0.15.1]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.15.0...v0.15.1
191197
[0.15.0]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.14.2...v0.15.0
192198
[0.14.2]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.14.1...v0.14.2

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.15.1
1+
0.15.2

internal/tsparse/tsparse.go

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,41 @@ func extractExports(stmt *ast.Node, analysis *FileAnalysis) {
210210

211211
default:
212212
if ast.HasSyntacticModifier(stmt, ast.ModifierFlagsExport) {
213-
name := getDeclName(stmt)
214-
if name != "" {
215-
isDefault := ast.HasSyntacticModifier(stmt, ast.ModifierFlagsDefault)
216-
exportName := name
217-
if isDefault {
218-
exportName = "default"
213+
isDefault := ast.HasSyntacticModifier(stmt, ast.ModifierFlagsDefault)
214+
215+
// VariableStatement has no Name() — iterate into declarations
216+
if stmt.Kind == ast.KindVariableStatement {
217+
vs := stmt.AsVariableStatement()
218+
if vs.DeclarationList != nil {
219+
dl := vs.DeclarationList.AsVariableDeclarationList()
220+
if dl.Declarations != nil {
221+
for _, decl := range dl.Declarations.Nodes {
222+
name := getDeclName(decl)
223+
if name != "" {
224+
exportName := name
225+
if isDefault {
226+
exportName = "default"
227+
}
228+
analysis.Exports = append(analysis.Exports, Export{
229+
Name: exportName,
230+
LocalName: name,
231+
})
232+
}
233+
}
234+
}
235+
}
236+
} else {
237+
name := getDeclName(stmt)
238+
if name != "" {
239+
exportName := name
240+
if isDefault {
241+
exportName = "default"
242+
}
243+
analysis.Exports = append(analysis.Exports, Export{
244+
Name: exportName,
245+
LocalName: name,
246+
})
219247
}
220-
analysis.Exports = append(analysis.Exports, Export{
221-
Name: exportName,
222-
LocalName: name,
223-
})
224248
}
225249
}
226250
}

0 commit comments

Comments
 (0)