@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
45 lines (44 loc) • 3.01 kB
TypeScript
import { type LintingResult, LintingRuleCertainty } from '../linter-format';
import type { MergeableRecord } from '../../util/objects';
import { SourceLocation } from '../../util/range';
import { LintingRuleTag } from '../linter-tags';
import type { InputSources } from '../../queries/catalog/input-sources-query/simple-input-classifier';
/**
* Describes a linting result for a problematic eval usage, including the location of the eval call and the computed input sources that lead to it.
*/
export interface ProblematicEvalResult extends LintingResult {
loc: SourceLocation;
sources: InputSources;
}
export interface ProblematicEvalConfig extends MergeableRecord {
/**
* All calls that should be considered to be valid eval entry points, this will be interpreted as a Regex!
*/
considerAsEval: string;
}
export type ProblematicEvalMetadata = MergeableRecord;
export declare const PROBLEMATIC_EVAL: {
readonly createSearch: (config: ProblematicEvalConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: ProblematicEvalConfig, data: {
normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
dataflow: import("../../dataflow/info").DataflowInformation;
cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
}) => Promise<{
results: ProblematicEvalResult[];
".meta": ProblematicEvalMetadata;
}>;
readonly prettyPrint: {
readonly query: (result: ProblematicEvalResult) => string;
readonly full: (result: ProblematicEvalResult) => string;
};
readonly info: {
readonly name: "Problematic eval";
readonly description: "Detects uses of eval-like functions whose inputs are not statically constant. Prints the computed input-sources for the eval and flags usages that depend on non-constant/trusted inputs.";
readonly tags: readonly [LintingRuleTag.Security, LintingRuleTag.Smell, LintingRuleTag.Readability, LintingRuleTag.Performance];
readonly certainty: LintingRuleCertainty.BestEffort;
readonly defaultConfig: {
readonly considerAsEval: "^eval$";
};
};
};