Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Callable
Description
- The intermediate language (IL) / intermediate representation (IR) / bitcode are all synonyms for a data structure able to represent code originating from multiple programming languages.
- In our context, the main purpose is to enable an efficient and uniform static code analysis, as part of the dhscanner framework for CI/CD container security checks.
- dhscanner targets mostly languages used for cloud native applications: Python, Ruby, Php, Javascript, Typescript, Java, C# and Golang.
- Typically, a collection of files are first parsed using relevant parsers, then, the resulting abstract syntax trees are sent to code generation, where they are translated into a collection of callables.
- A callable is a sequence of commands corresponding to either a function, a method, a lambda or (in languages like python) a script.
Synopsis
- data Callables = Callables {
- actualCallables :: [Callable]
- data Callable
- data MethodContent = MethodContent {}
- data LambdaContent = LambdaContent {}
- data ScriptContent = ScriptContent {
- filename :: String
- scriptBody :: Cfg
- data Annotation = Annotation {
- annotationFqn :: String
- annotationConstantStrings :: [String]
- data FunctionContent = FunctionContent {
- funcName :: FuncName
- funcBody :: Cfg
- funcAnnotations :: [Annotation]
- funcLocation :: Location
Documentation
Constructors
Callables | |
Fields
|
Four kinds of callables.
Instances
FromJSON Callable Source # | |
ToJSON Callable Source # | |
Generic Callable Source # | |
Show Callable Source # | |
Eq Callable Source # | |
Ord Callable Source # | |
type Rep Callable Source # | |
Defined in Callable type Rep Callable = D1 ('MetaData "Callable" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) ((C1 ('MetaCons "Method" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MethodContent)) :+: C1 ('MetaCons "Lambda" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LambdaContent))) :+: (C1 ('MetaCons "Script" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptContent)) :+: C1 ('MetaCons "Function" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FunctionContent)))) |
data MethodContent Source #
Constructors
MethodContent | |
Fields
|
Instances
FromJSON MethodContent Source # | |
Defined in Callable Methods parseJSON :: Value -> Parser MethodContent # parseJSONList :: Value -> Parser [MethodContent] # omittedField :: Maybe MethodContent # | |
ToJSON MethodContent Source # | |
Defined in Callable Methods toJSON :: MethodContent -> Value # toEncoding :: MethodContent -> Encoding # toJSONList :: [MethodContent] -> Value # toEncodingList :: [MethodContent] -> Encoding # omitField :: MethodContent -> Bool # | |
Generic MethodContent Source # | |
Defined in Callable Associated Types type Rep MethodContent :: Type -> Type | |
Show MethodContent Source # | |
Defined in Callable Methods showsPrec :: Int -> MethodContent -> ShowS show :: MethodContent -> String showList :: [MethodContent] -> ShowS | |
Eq MethodContent Source # | |
Defined in Callable | |
Ord MethodContent Source # | |
Defined in Callable Methods compare :: MethodContent -> MethodContent -> Ordering (<) :: MethodContent -> MethodContent -> Bool (<=) :: MethodContent -> MethodContent -> Bool (>) :: MethodContent -> MethodContent -> Bool (>=) :: MethodContent -> MethodContent -> Bool max :: MethodContent -> MethodContent -> MethodContent min :: MethodContent -> MethodContent -> MethodContent | |
type Rep MethodContent Source # | |
Defined in Callable type Rep MethodContent = D1 ('MetaData "MethodContent" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) (C1 ('MetaCons "MethodContent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "methodName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MethdName) :*: S1 ('MetaSel ('Just "hostingClassName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ClassName)) :*: (S1 ('MetaSel ('Just "hostingClassSupers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Fqn]) :*: (S1 ('MetaSel ('Just "methodBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cfg) :*: S1 ('MetaSel ('Just "methodLocation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location))))) |
data LambdaContent Source #
Constructors
LambdaContent | |
Fields
|
Instances
FromJSON LambdaContent Source # | |
Defined in Callable Methods parseJSON :: Value -> Parser LambdaContent # parseJSONList :: Value -> Parser [LambdaContent] # omittedField :: Maybe LambdaContent # | |
ToJSON LambdaContent Source # | |
Defined in Callable Methods toJSON :: LambdaContent -> Value # toEncoding :: LambdaContent -> Encoding # toJSONList :: [LambdaContent] -> Value # toEncodingList :: [LambdaContent] -> Encoding # omitField :: LambdaContent -> Bool # | |
Generic LambdaContent Source # | |
Defined in Callable Associated Types type Rep LambdaContent :: Type -> Type | |
Show LambdaContent Source # | |
Defined in Callable Methods showsPrec :: Int -> LambdaContent -> ShowS show :: LambdaContent -> String showList :: [LambdaContent] -> ShowS | |
Eq LambdaContent Source # | |
Defined in Callable | |
Ord LambdaContent Source # | |
Defined in Callable Methods compare :: LambdaContent -> LambdaContent -> Ordering (<) :: LambdaContent -> LambdaContent -> Bool (<=) :: LambdaContent -> LambdaContent -> Bool (>) :: LambdaContent -> LambdaContent -> Bool (>=) :: LambdaContent -> LambdaContent -> Bool max :: LambdaContent -> LambdaContent -> LambdaContent min :: LambdaContent -> LambdaContent -> LambdaContent | |
type Rep LambdaContent Source # | |
Defined in Callable type Rep LambdaContent = D1 ('MetaData "LambdaContent" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) (C1 ('MetaCons "LambdaContent" 'PrefixI 'True) (S1 ('MetaSel ('Just "lambdaBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cfg) :*: S1 ('MetaSel ('Just "lambdaLocation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location))) |
data ScriptContent Source #
Constructors
ScriptContent | |
Fields
|
Instances
FromJSON ScriptContent Source # | |
Defined in Callable Methods parseJSON :: Value -> Parser ScriptContent # parseJSONList :: Value -> Parser [ScriptContent] # omittedField :: Maybe ScriptContent # | |
ToJSON ScriptContent Source # | |
Defined in Callable Methods toJSON :: ScriptContent -> Value # toEncoding :: ScriptContent -> Encoding # toJSONList :: [ScriptContent] -> Value # toEncodingList :: [ScriptContent] -> Encoding # omitField :: ScriptContent -> Bool # | |
Generic ScriptContent Source # | |
Defined in Callable Associated Types type Rep ScriptContent :: Type -> Type | |
Show ScriptContent Source # | |
Defined in Callable Methods showsPrec :: Int -> ScriptContent -> ShowS show :: ScriptContent -> String showList :: [ScriptContent] -> ShowS | |
Eq ScriptContent Source # | |
Defined in Callable | |
Ord ScriptContent Source # | |
Defined in Callable Methods compare :: ScriptContent -> ScriptContent -> Ordering (<) :: ScriptContent -> ScriptContent -> Bool (<=) :: ScriptContent -> ScriptContent -> Bool (>) :: ScriptContent -> ScriptContent -> Bool (>=) :: ScriptContent -> ScriptContent -> Bool max :: ScriptContent -> ScriptContent -> ScriptContent min :: ScriptContent -> ScriptContent -> ScriptContent | |
type Rep ScriptContent Source # | |
Defined in Callable type Rep ScriptContent = D1 ('MetaData "ScriptContent" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) (C1 ('MetaCons "ScriptContent" 'PrefixI 'True) (S1 ('MetaSel ('Just "filename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "scriptBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cfg))) |
data Annotation Source #
Constructors
Annotation | |
Fields
|
Instances
FromJSON Annotation Source # | |
Defined in Callable Methods parseJSON :: Value -> Parser Annotation # parseJSONList :: Value -> Parser [Annotation] # omittedField :: Maybe Annotation # | |
ToJSON Annotation Source # | |
Defined in Callable Methods toJSON :: Annotation -> Value # toEncoding :: Annotation -> Encoding # toJSONList :: [Annotation] -> Value # toEncodingList :: [Annotation] -> Encoding # omitField :: Annotation -> Bool # | |
Generic Annotation Source # | |
Defined in Callable Associated Types type Rep Annotation :: Type -> Type | |
Show Annotation Source # | |
Defined in Callable Methods showsPrec :: Int -> Annotation -> ShowS show :: Annotation -> String showList :: [Annotation] -> ShowS | |
Eq Annotation Source # | |
Defined in Callable | |
Ord Annotation Source # | |
Defined in Callable Methods compare :: Annotation -> Annotation -> Ordering (<) :: Annotation -> Annotation -> Bool (<=) :: Annotation -> Annotation -> Bool (>) :: Annotation -> Annotation -> Bool (>=) :: Annotation -> Annotation -> Bool max :: Annotation -> Annotation -> Annotation min :: Annotation -> Annotation -> Annotation | |
type Rep Annotation Source # | |
Defined in Callable type Rep Annotation = D1 ('MetaData "Annotation" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) (C1 ('MetaCons "Annotation" 'PrefixI 'True) (S1 ('MetaSel ('Just "annotationFqn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "annotationConstantStrings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]))) |
data FunctionContent Source #
Constructors
FunctionContent | |
Fields
|
Instances
FromJSON FunctionContent Source # | |
Defined in Callable Methods parseJSON :: Value -> Parser FunctionContent # parseJSONList :: Value -> Parser [FunctionContent] # omittedField :: Maybe FunctionContent # | |
ToJSON FunctionContent Source # | |
Defined in Callable Methods toJSON :: FunctionContent -> Value # toEncoding :: FunctionContent -> Encoding # toJSONList :: [FunctionContent] -> Value # toEncodingList :: [FunctionContent] -> Encoding # omitField :: FunctionContent -> Bool # | |
Generic FunctionContent Source # | |
Defined in Callable Associated Types type Rep FunctionContent :: Type -> Type Methods from :: FunctionContent -> Rep FunctionContent x to :: Rep FunctionContent x -> FunctionContent | |
Show FunctionContent Source # | |
Defined in Callable Methods showsPrec :: Int -> FunctionContent -> ShowS show :: FunctionContent -> String showList :: [FunctionContent] -> ShowS | |
Eq FunctionContent Source # | |
Defined in Callable Methods (==) :: FunctionContent -> FunctionContent -> Bool (/=) :: FunctionContent -> FunctionContent -> Bool | |
Ord FunctionContent Source # | |
Defined in Callable Methods compare :: FunctionContent -> FunctionContent -> Ordering (<) :: FunctionContent -> FunctionContent -> Bool (<=) :: FunctionContent -> FunctionContent -> Bool (>) :: FunctionContent -> FunctionContent -> Bool (>=) :: FunctionContent -> FunctionContent -> Bool max :: FunctionContent -> FunctionContent -> FunctionContent min :: FunctionContent -> FunctionContent -> FunctionContent | |
type Rep FunctionContent Source # | |
Defined in Callable type Rep FunctionContent = D1 ('MetaData "FunctionContent" "Callable" "dhscanner-bitcode-0.1.0.3-inplace" 'False) (C1 ('MetaCons "FunctionContent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "funcName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FuncName) :*: S1 ('MetaSel ('Just "funcBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cfg)) :*: (S1 ('MetaSel ('Just "funcAnnotations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Annotation]) :*: S1 ('MetaSel ('Just "funcLocation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Location)))) |