Skip to content

Commit 8c4e5e8

Browse files
committed
Boilerplate implementation of default predicates from FlowSummaryImpl.qll
1 parent 6b35a76 commit 8c4e5e8

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSummaryPrivate.qll

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,97 @@ private module FlowSummaryStepInput implements Private::StepsInputSig {
374374
}
375375

376376
module Steps = Private::Steps<FlowSummaryStepInput>;
377+
378+
/**
379+
* Gets the textual representation of content `c` used in MaD.
380+
*
381+
* `arg` will be printed in square brackets (`[]`) after the result, unless
382+
* `arg` is the empty string.
383+
*/
384+
string encodeContent(ContentSet c, string arg) { none() }
385+
386+
/**
387+
* Gets the textual representation of return kind `rk` used in MaD.
388+
*
389+
* `arg` will be printed in square brackets (`[]`) after the result, unless
390+
* `arg` is the empty string.
391+
*/
392+
string encodeReturn(ReturnKind rk, string arg) { none() }
393+
394+
/**
395+
* Gets the textual representation of without-content `c` used in MaD.
396+
*
397+
* `arg` will be printed in square brackets (`[]`) after the result, unless
398+
* `arg` is the empty string.
399+
*/
400+
string encodeWithoutContent(ContentSet c, string arg) { none() }
401+
402+
/**
403+
* Gets the textual representation of with-content `c` used in MaD.
404+
*
405+
* `arg` will be printed in square brackets (`[]`) after the result, unless
406+
* `arg` is the empty string.
407+
*/
408+
string encodeWithContent(ContentSet c, string arg) { none() }
409+
410+
/**
411+
* Gets a parameter position corresponding to the unknown token `token`.
412+
*
413+
* The token is unknown because it could not be reverse-encoded using the
414+
* `encodeParameterPosition` predicate. This is useful for example when a
415+
* single token gives rise to multiple parameter positions, such as ranges
416+
* `0..n`.
417+
*/
418+
bindingset[token]
419+
ParameterPosition decodeUnknownParameterPosition(AccessPathSyntax::AccessPathTokenBase token) {
420+
none()
421+
}
422+
423+
/**
424+
* Gets an argument position corresponding to the unknown token `token`.
425+
*
426+
* The token is unknown because it could not be reverse-encoded using the
427+
* `encodeArgumentPosition` predicate. This is useful for example when a
428+
* single token gives rise to multiple argument positions, such as ranges
429+
* `0..n`.
430+
*/
431+
bindingset[token]
432+
ArgumentPosition decodeUnknownArgumentPosition(AccessPathSyntax::AccessPathTokenBase token) {
433+
none()
434+
}
435+
436+
/**
437+
* Gets a content corresponding to the unknown token `token`.
438+
*
439+
* The token is unknown because it could not be reverse-encoded using the
440+
* `encodeContent` predicate.
441+
*/
442+
bindingset[token]
443+
ContentSet decodeUnknownContent(AccessPathSyntax::AccessPathTokenBase token) { none() }
444+
445+
/**
446+
* Gets a return kind corresponding to the unknown token `token`.
447+
*
448+
* The token is unknown because it could not be reverse-encoded using the
449+
* `encodeReturn` predicate.
450+
*/
451+
bindingset[token]
452+
ReturnKind decodeUnknownReturn(AccessPathSyntax::AccessPathTokenBase token) { none() }
453+
454+
/**
455+
* Gets a without-content corresponding to the unknown token `token`.
456+
*
457+
* The token is unknown because it could not be reverse-encoded using the
458+
* `encodeWithoutContent` predicate.
459+
*/
460+
bindingset[token]
461+
ContentSet decodeUnknownWithoutContent(AccessPathSyntax::AccessPathTokenBase token) { none() }
462+
463+
/**
464+
* Gets a with-content corresponding to the unknown token `token`.
465+
*
466+
* The token is unknown because it could not be reverse-encoded using the
467+
* `encodeWithContent` predicate.
468+
*/
469+
bindingset[token]
470+
ContentSet decodeUnknownWithContent(AccessPathSyntax::AccessPathTokenBase token) { none() }

javascript/ql/lib/semmle/javascript/dataflow/internal/sharedlib/DataFlowArg.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,24 @@ module JSFlowSummary implements FlowSummaryImpl::InputSig<Location, JSDataFlow>
3030

3131
// Explicitly implement signature members that have a default
3232
predicate callbackSelfParameterPosition = FlowSummaryPrivate::callbackSelfParameterPosition/0;
33+
34+
predicate encodeContent = FlowSummaryPrivate::encodeContent/2;
35+
36+
predicate encodeReturn = FlowSummaryPrivate::encodeReturn/2;
37+
38+
predicate encodeWithoutContent = FlowSummaryPrivate::encodeWithoutContent/2;
39+
40+
predicate encodeWithContent = FlowSummaryPrivate::encodeWithContent/2;
41+
42+
predicate decodeUnknownParameterPosition = FlowSummaryPrivate::decodeUnknownParameterPosition/1;
43+
44+
predicate decodeUnknownArgumentPosition = FlowSummaryPrivate::decodeUnknownArgumentPosition/1;
45+
46+
predicate decodeUnknownContent = FlowSummaryPrivate::decodeUnknownContent/1;
47+
48+
predicate decodeUnknownReturn = FlowSummaryPrivate::decodeUnknownReturn/1;
49+
50+
predicate decodeUnknownWithoutContent = FlowSummaryPrivate::decodeUnknownWithoutContent/1;
51+
52+
predicate decodeUnknownWithContent = FlowSummaryPrivate::decodeUnknownWithContent/1;
3353
}

0 commit comments

Comments
 (0)