Skip to content

Commit c3f4a85

Browse files
committed
remove some TODOs I won't do
1 parent 3be3da2 commit c3f4a85

File tree

1 file changed

+4
-37
lines changed

1 file changed

+4
-37
lines changed

python/ql/lib/semmle/python/ApiGraphs.qll

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -488,28 +488,6 @@ module API {
488488
)
489489
)
490490
or
491-
// or
492-
// special case: from `require('m')` to an export of `prop` in `m`
493-
// TODO: Figure out if this is needed.
494-
/*
495-
* exists(Import imp, Module m, string prop |
496-
* pred = imp.getImportedModuleNode() and
497-
* m = imp.getImportedModule() and
498-
* lbl = Label::member(prop) and
499-
* rhs = m.getAnExportedValue(prop)
500-
* )
501-
* or
502-
*/
503-
504-
/*
505-
* or // TODO:
506-
* exists(DataFlow::FunctionNode f |
507-
* base = MkAsyncFuncResult(f) and
508-
* lbl = Label::promised() and
509-
* rhs = f.getAReturn()
510-
* )
511-
*/
512-
513491
argumentPassing(base, lbl, rhs)
514492
or
515493
exists(DataFlow::LocalSourceNode src, DataFlow::AttrWrite pw |
@@ -653,17 +631,6 @@ module API {
653631
rhs(_, nd) and
654632
result = nd.getALocalSource()
655633
or
656-
// TODO: Figure out module exports in Python, and if this thing is needed.
657-
// additional backwards step from `require('m')` to `exports` or `module.exports` in m
658-
/*
659-
* exists(Import imp | imp.getImportedModuleNode() = trackDefNode(nd, t.continue()) |
660-
* result = DataFlow::exportsVarNode(imp.getImportedModule())
661-
* or
662-
* result = DataFlow::moduleVarNode(imp.getImportedModule()).getAPropertyRead("exports")
663-
* )
664-
* or
665-
*/
666-
667634
exists(DataFlow::TypeBackTracker t2 | result = trackDefNode(nd, t2).backtrack(t2, t))
668635
}
669636

@@ -721,16 +688,15 @@ module API {
721688
exists(Module parentMod, Module childMod, string edge |
722689
pred = MkModuleExport(parentMod) and
723690
succ = MkModuleExport(childMod) and
724-
parentMod.getSubModule(edge) = childMod and // TODO: __init__.py shows up here, handle those in some other way. See e.g. https://stackoverflow.com/questions/38927979/default-export-in-python-3
691+
// TODO: __init__.py shows up here, maybe add some shortcut. Example code: https://stackoverflow.com/questions/38927979/default-export-in-python-3
692+
parentMod.getSubModule(edge) = childMod and
725693
lbl = Label::member(edge)
726694
)
727695
or
728696
exists(DataFlow::Node rhs |
729697
rhs(pred, lbl, rhs) and
730698
succ = MkDef(rhs)
731699
)
732-
// TODO: Compare with JS, check that I'm not missing stuff
733-
// TODO: Port MkAsyncFuncResult?
734700
}
735701

736702
/**
@@ -915,6 +881,7 @@ private predicate exports(Module mod, string prop, DataFlow::Node rhs) {
915881
mod.getPackage().getName() + "." + star.getImportedModuleName() = subMod.getName() and
916882
exports(subMod, prop, rhs)
917883
)
918-
// TODO: named imports (somehow)
884+
// TODO: There should be a better way to do this, I'm just missing it.
885+
// TODO: named imports, which should probably be an edge, unless there is some way imports are just magically "handled".
919886
// TODO: use this predicate with __init__.py?
920887
}

0 commit comments

Comments
 (0)