static Collection<S> getCodeFragmentSafety(S code) { SS map = codeAnalysis_identifierSafetyMap(); Set<S> identifiers = tok_allIdentifiers(code); Collection<S> tags = treeSet(); for (S id : identifiers) { S tag; if (codeAnalysis_isSafeIdentifier(id)) tag = "safe"; // dangerous functions don't start with $ else tag = or2(map.get(id), "?"); tags.addAll(tokSplitAtComma(tag)); } tags = simplifySafetyTags(tags); if (empty(tags)) tags.add("safe"); ret tags; }
Began life as a copy of #1015762
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1018160 |
| Snippet name: | getCodeFragmentSafety - "S1" safety checker (simply identifier based, fixed allowed list) |
| Eternal ID of this version: | #1018160/13 |
| Text MD5: | 369986d2a8b1c23f997d51a7d047665a |
| Author: | stefan |
| Category: | javax / code analysis |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-15 22:09:14 |
| Source code size: | 509 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 658 / 757 |
| Version history: | 12 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1018163 - isSafeCodeFragment #1021662 - codeAnalysis_getUnknownIdentifiers |