├── docs ├── csaf │ └── .gitkeep ├── docs │ ├── assets │ │ ├── img │ │ │ ├── cpg-flow.png │ │ │ ├── logo-aisec.jpg │ │ │ ├── overall-view.png │ │ │ ├── codyze-component.png │ │ │ ├── cpg-flow-no-backend.png │ │ │ ├── codyze-analysis-result.png │ │ │ ├── codyze-ast-nodes-table.png │ │ │ ├── Institut-AISEC-Gebaeude-Nacht.jpg │ │ │ ├── overall-view-black-background.png │ │ │ ├── overall-view-white-background.png │ │ │ └── codyze-ast-nodes-overlay-tooltip.png │ │ ├── fonts │ │ │ └── Inter │ │ │ │ └── font-files │ │ │ │ ├── Inter.var.woff2 │ │ │ │ ├── Inter-roman.var.woff2 │ │ │ │ └── Inter-italic.var.woff2 │ │ └── javascripts │ │ │ ├── MathJax-3.2.2 │ │ │ └── es5 │ │ │ │ └── output │ │ │ │ └── chtml │ │ │ │ └── fonts │ │ │ │ └── woff-v2 │ │ │ │ ├── MathJax_Zero.woff │ │ │ │ ├── MathJax_Main-Bold.woff │ │ │ │ ├── MathJax_AMS-Regular.woff │ │ │ │ ├── MathJax_Main-Italic.woff │ │ │ │ ├── MathJax_Math-Italic.woff │ │ │ │ ├── MathJax_Vector-Bold.woff │ │ │ │ ├── MathJax_Fraktur-Bold.woff │ │ │ │ ├── MathJax_Main-Regular.woff │ │ │ │ ├── MathJax_Math-Regular.woff │ │ │ │ ├── MathJax_SansSerif-Bold.woff │ │ │ │ ├── MathJax_Script-Regular.woff │ │ │ │ ├── MathJax_Size1-Regular.woff │ │ │ │ ├── MathJax_Size2-Regular.woff │ │ │ │ ├── MathJax_Size3-Regular.woff │ │ │ │ ├── MathJax_Size4-Regular.woff │ │ │ │ ├── MathJax_Vector-Regular.woff │ │ │ │ ├── MathJax_Fraktur-Regular.woff │ │ │ │ ├── MathJax_Math-BoldItalic.woff │ │ │ │ ├── MathJax_SansSerif-Italic.woff │ │ │ │ ├── MathJax_Calligraphic-Bold.woff │ │ │ │ ├── MathJax_SansSerif-Regular.woff │ │ │ │ ├── MathJax_Typewriter-Regular.woff │ │ │ │ └── MathJax_Calligraphic-Regular.woff │ │ │ └── mathjax.js │ ├── CPG │ │ └── index.md │ └── API │ │ └── index.md ├── mkdocs-material-plugins.txt └── Dockerfile ├── cpg-language-go └── src │ ├── main │ └── resources │ │ ├── .gitkeep │ │ ├── .gitignore │ │ └── download.sh │ └── test │ └── resources │ ├── golang-std │ ├── go.mod │ └── fmt │ │ └── print.go │ ├── golang │ ├── go.mod │ ├── submodule │ │ └── const.go │ ├── packages │ │ ├── api │ │ │ └── apiv1.go │ │ ├── packages.go │ │ └── cmd │ │ │ └── packages │ │ │ └── packages.go │ ├── integration │ │ ├── go.mod │ │ ├── func_darwin_arm64.go │ │ ├── func_linux_arm64.go │ │ ├── func_ios.go │ │ ├── cmd │ │ │ └── buildtags │ │ │ │ └── main.go │ │ └── func_darwin.go │ ├── complex_resolution │ │ ├── go.mod │ │ └── util │ │ │ └── util.go │ ├── short_assign.go │ ├── type_loop.go │ ├── chan.go │ ├── if.go │ ├── dfg.go │ ├── embed.go │ ├── inference.go │ ├── options │ │ ├── srv.go │ │ └── srv_option.go │ ├── cast.go │ ├── ref.go │ ├── unnamed.go │ ├── construct.go │ ├── switch.go │ ├── values.go │ ├── importalias.go │ ├── type_constraints.go │ ├── eval.go │ ├── chained │ │ └── chained.go │ ├── field.go │ ├── call.go │ ├── slices.go │ ├── defer.go │ ├── branch.go │ ├── comment.go │ └── for.go │ ├── golang-modules │ ├── go.mod │ ├── util │ │ └── stuff.go │ ├── awesome.go │ └── cmd │ │ └── awesome │ │ └── main.go │ └── log4j2.xml ├── cpg-core └── src │ ├── test │ └── resources │ │ ├── exclusion │ │ ├── a.file │ │ └── tests │ │ │ └── test.file │ │ └── log4j2.xml │ └── main │ ├── resources │ └── META-INF │ │ └── native-image │ │ ├── de.fraunhofer.aisec │ │ └── cpg │ │ │ ├── jni-config.json │ │ │ ├── resource-config.json │ │ │ └── proxy-config.json │ │ └── org.apache.logging │ │ └── log4j │ │ ├── jni-config.json │ │ ├── proxy-config.json │ │ └── resource-config.json │ └── kotlin │ └── de │ └── fraunhofer │ └── aisec │ └── cpg │ └── passes │ └── package-info.java ├── style └── pre-commit ├── codyze-console └── src │ └── main │ ├── webapp │ ├── .npmrc │ ├── src │ │ ├── lib │ │ │ ├── components │ │ │ │ ├── QueryTreeExplorer.svelte │ │ │ │ ├── forms │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── navigation │ │ │ │ │ ├── Navbar.svelte │ │ │ │ │ └── index.ts │ │ │ │ ├── dashboard │ │ │ │ │ └── index.ts │ │ │ │ ├── ui │ │ │ │ │ └── index.ts │ │ │ │ └── analysis │ │ │ │ │ └── FindingsList.svelte │ │ │ └── index.ts │ │ ├── routes │ │ │ ├── +page.ts │ │ │ ├── new-analysis │ │ │ │ └── +page.ts │ │ │ ├── +error.svelte │ │ │ ├── components │ │ │ │ ├── [componentName] │ │ │ │ │ └── +page.ts │ │ │ │ └── +page.ts │ │ │ ├── +layout.ts │ │ │ └── requirements │ │ │ │ └── +page.ts │ │ ├── app.css │ │ ├── app.d.ts │ │ └── app.html │ ├── .vscode │ │ └── settings.json │ ├── .prettierignore │ ├── .gitignore │ ├── vite.config.ts │ ├── .prettierrc │ └── svelte.config.js │ └── resources │ └── .gitignore ├── cpg-language-cxx └── src │ └── test │ ├── resources │ ├── unity │ │ ├── a.cpp │ │ ├── b.cpp │ │ └── common.h │ ├── c │ │ ├── issue-1045 │ │ │ ├── foo.c │ │ │ ├── foo.h │ │ │ └── bar.c │ │ ├── foobar │ │ │ ├── foo.c │ │ │ ├── foo.h │ │ │ ├── bar.c │ │ │ └── std │ │ │ │ └── stdlib.h │ │ ├── typedef_in_header │ │ │ ├── _header.h │ │ │ ├── header.h │ │ │ └── main.c │ │ ├── goto.c │ │ ├── cast_to_inferred.c │ │ ├── enum.c │ │ ├── struct.c │ │ ├── types.c │ │ ├── implicit_casts.c │ │ ├── typedef_struct.c │ │ ├── switch_eog.c │ │ ├── comments.c │ │ ├── symbol_resolver_fail.c │ │ ├── char_literal.c │ │ └── designated.c │ ├── cxx │ │ ├── extern_c.cpp │ │ ├── fancy_types.cpp │ │ ├── inference │ │ │ ├── construct.h │ │ │ ├── superclass.h │ │ │ ├── inference.h │ │ │ ├── parent_inference.cpp │ │ │ ├── construct.cpp │ │ │ └── superclass.cpp │ │ ├── declaration.h │ │ ├── fix-1226 │ │ │ ├── main1.cpp │ │ │ ├── main2.cpp │ │ │ └── header.h │ │ ├── definition.cpp │ │ ├── enum.cpp │ │ ├── symbols │ │ │ ├── simple_calls.cpp │ │ │ ├── member_calls.cpp │ │ │ └── only_variables.cpp │ │ ├── foreachstmt.cpp │ │ ├── assignmentexpression.cpp │ │ ├── castexpr.cpp │ │ ├── typedef_struct.cpp │ │ ├── declstmt.cpp │ │ ├── alias_loop.cpp │ │ ├── binaryoperator.cpp │ │ ├── outside_class_definition.cpp │ │ ├── arrays.cpp │ │ ├── literals.cpp │ │ ├── operators │ │ │ ├── member_access.cpp │ │ │ ├── call_expression.cpp │ │ │ └── arithmetic.cpp │ │ ├── implicit_casts.cpp │ │ ├── namespaced_function.cpp │ │ ├── objcreation.cpp │ │ └── template_constructor.cpp │ ├── cxxCompilationDatabase │ │ ├── src │ │ │ └── lib1 │ │ │ │ └── lib.c │ │ ├── includes_1 │ │ │ ├── config.h │ │ │ └── header_1.h │ │ ├── includes_2 │ │ │ ├── config.h │ │ │ └── header_2.h │ │ ├── main_simple.c │ │ ├── version.cpp │ │ ├── sys_includes │ │ │ └── sys_header.h │ │ ├── version.c │ │ ├── main_arm64.c │ │ ├── main_tu_1.c │ │ ├── main_tu_2.c │ │ ├── compile_commands_bear.json │ │ ├── compile_commands_simple.json │ │ ├── compile_commands_arch.json │ │ ├── compile_commands_commands.json │ │ ├── main.c │ │ └── compile_commands_arguments.json │ ├── compoundstmt.cpp │ ├── calls │ │ ├── cxxprioresolution │ │ │ ├── defined.cpp │ │ │ ├── undefined.cpp │ │ │ ├── scopedResolutionWithDefaults.cpp │ │ │ └── methodresolution │ │ │ │ └── overloadnoresolution.cpp │ │ ├── ignore-return.cpp │ │ ├── implicitcast │ │ │ ├── implicitcast.cpp │ │ │ ├── ambiguouscall.cpp │ │ │ └── implicitCastInMethod.cpp │ │ └── defaultargs │ │ │ ├── defaultInMethod.cpp │ │ │ ├── partialDefaults.cpp │ │ │ └── defaultInDefinition.cpp │ ├── another-include.h │ ├── bindings │ │ ├── use_then_declare.cpp │ │ └── replace_declaration.cpp │ ├── foo2.cpp │ ├── cfg │ │ ├── ifextra.cpp │ │ ├── goto.cpp │ │ ├── if.cpp │ │ ├── loops.cpp │ │ ├── loopscfg.cpp │ │ ├── forloop.cpp │ │ └── break_continue.cpp │ ├── namespaces.cpp │ ├── call_me_crazy.h │ ├── if.cpp │ ├── shiftexpression.cpp │ ├── types.cpp │ ├── initlistexpression.cpp │ ├── unaryoperator.cpp │ ├── compiling │ │ └── hierarchy │ │ │ └── multistep │ │ │ ├── simple_inheritance.cpp │ │ │ └── multi_inheritance.cpp │ ├── typeidexpr.cpp │ ├── include.cpp │ ├── constructors │ │ ├── implicitcastarg │ │ │ └── constructorImplicit.cpp │ │ ├── defaultarg │ │ │ └── constructorDefault.cpp │ │ └── constructors.cpp │ ├── cpp-this-field.cpp │ ├── variables_extended │ │ └── cpp │ │ │ ├── external_class.h │ │ │ └── external_class.cpp │ ├── cfg.cpp │ ├── components │ │ └── trystmt.cpp │ ├── templates │ │ ├── functiontemplates │ │ │ ├── functionTemplateInvocation4.cpp │ │ │ ├── functionTemplateInvocation2.cpp │ │ │ ├── functionTemplateInvocation3.cpp │ │ │ ├── functionTemplateInvocation6.cpp │ │ │ ├── functionTemplateInvocation5.cpp │ │ │ ├── functionTemplate.cpp │ │ │ ├── functionTemplateInvocation8.cpp │ │ │ ├── functionTemplateMethod.cpp │ │ │ ├── functionTemplateInvocation1.cpp │ │ │ └── functionTemplateInvocation7.cpp │ │ └── classtemplates │ │ │ ├── array.cpp │ │ │ ├── array2.cpp │ │ │ ├── pair3.cpp │ │ │ ├── pair3-2.cpp │ │ │ ├── pair3-1.cpp │ │ │ ├── pair2.cpp │ │ │ └── pair.cpp │ ├── types │ │ ├── fptr_type.cpp │ │ └── type.cpp │ ├── attributes.cpp │ ├── symbols.cpp │ ├── postfixexpression.cpp │ ├── foo.cpp │ ├── function_ptr_or_type_cast.c │ ├── fix-455 │ │ └── main.cpp │ ├── include.h │ ├── method_or_function_call.cpp │ ├── largenegativenumber.cpp │ ├── log4j2.xml │ └── typedefs │ │ └── weird_typedefs.cpp │ └── kotlin │ └── de │ └── fraunhofer │ └── aisec │ └── cpg │ └── frontends │ └── cxx │ └── .gitignore ├── cpg-language-python └── src │ └── test │ └── resources │ ├── python │ ├── packages │ │ └── foobar │ │ │ ├── __init__.py │ │ │ ├── module1.py │ │ │ ├── config │ │ │ └── __init__.py │ │ │ ├── implementation │ │ │ ├── __init__.py │ │ │ ├── internal_foo.py │ │ │ └── internal_bar.py │ │ │ └── __main__.py │ ├── load_includes │ │ ├── stdlib │ │ │ ├── json │ │ │ │ ├── decoder.pyi │ │ │ │ ├── encoder.pyi │ │ │ │ └── __init__.pyi │ │ │ └── builtins.pyi │ │ └── example │ │ │ └── program.py │ ├── big-project │ │ ├── stdlib │ │ │ └── os.pyi │ │ ├── component1 │ │ │ └── mypackage │ │ │ │ └── module.py │ │ └── component2 │ │ │ └── otherpackage │ │ │ └── module.py │ ├── type_hints.py │ ├── simple_import.py │ ├── multi_level_mem_call.py │ ├── superclasses │ │ ├── superclass.py │ │ ├── incorrect.py │ │ ├── superclass_import_full_path.py │ │ └── superclass_import_module_alias.py │ ├── ifexpr.py │ ├── named_expressions.py │ ├── assert.py │ ├── consteval │ │ ├── arithmetic.py │ │ └── platform.py │ ├── literal.py │ ├── with_stmt_EOG.py │ ├── unicode.py │ ├── complex_class.pyi │ ├── if.py │ ├── issue615.py │ ├── modules │ │ ├── c.py │ │ ├── b.py │ │ └── a.py │ ├── nested_replace.py │ ├── class_fields.py │ ├── class_self.py │ ├── import_no_src.py │ ├── calc.py │ ├── import_test.py │ ├── complex_class.py │ ├── issue473.py │ ├── call_confusion.py │ ├── class_type_annotations.py │ ├── simple_class.py │ ├── class_ctor.py │ ├── formatted_values.py │ ├── parent_confusion │ │ └── package │ │ │ └── myclass.py │ ├── datatypes.py │ ├── 1740_endless_cdg_loop.py │ ├── async.py │ ├── issue598.py │ ├── array_dfg.py │ ├── dict_dfg.py │ ├── foobar.py │ ├── function.py │ ├── delete.py │ ├── nested_functions.py │ ├── forloop.py │ ├── issue432.py │ ├── nonlocal.py │ ├── variable_inference.py │ ├── dfg_type.py │ ├── member_dfg.py │ ├── outerNamespace │ │ └── innerNamespace │ │ │ └── comments.py │ ├── fields.py │ ├── annotations.py │ ├── boolop.py │ ├── tuple_assign.py │ ├── with.py │ ├── raise.py │ └── vars.py │ └── log4j2.xml ├── .vscode └── extensions.json ├── cpg-language-typescript └── src │ ├── main │ └── typescript │ │ ├── .gitignore │ │ ├── deno.json │ │ ├── tsconfig.json │ │ └── deno.lock │ └── test │ └── resources │ ├── typescript │ ├── simple.jsx │ ├── lambda.js │ ├── decorator.ts │ ├── function.js │ ├── function.ts │ └── fetch.ts │ └── log4j2.xml ├── codyze-core └── src │ ├── integrationTest │ └── resources │ │ ├── example │ │ └── src │ │ │ ├── module2 │ │ │ └── pkg │ │ │ │ └── mod.py │ │ │ ├── third-party │ │ │ └── mylib │ │ │ │ └── library │ │ │ │ └── lib.py │ │ │ └── module1 │ │ │ └── main.py │ │ ├── encrypt.py │ │ └── simple.py │ ├── main │ └── resources │ │ └── META-INF │ │ └── kotlin │ │ └── script │ │ └── templates │ │ ├── de.fraunhofer.aisec.codyze.CodyzeScript.classname │ │ ├── de.fraunhofer.aisec.codyze.QueryScript.classname │ │ └── de.fraunhofer.aisec.codyze.ConceptScript.classname │ └── test │ └── resources │ └── log4j2.xml ├── cpg-concepts └── src │ ├── integrationTest │ └── resources │ │ ├── python │ │ ├── conf │ │ │ ├── unused.ini │ │ │ ├── dev.ini │ │ │ └── prod.ini │ │ ├── file │ │ │ ├── file_read.py │ │ │ ├── file_write.py │ │ │ ├── tempInTmp.py │ │ │ ├── file_with_branching.py │ │ │ ├── file_loop.py │ │ │ ├── tempOrNot.py │ │ │ ├── file_os_open.py │ │ │ ├── multipleTempFiles.py │ │ │ ├── file_os_open_bad.py │ │ │ ├── file_delete.py │ │ │ ├── tempOrNot2.py │ │ │ ├── write_before_chmod.py │ │ │ ├── tempfile_bad_gettmpdir.py │ │ │ ├── file_mkstemp_mkdtemp.py │ │ │ ├── file-concept-signature.yaml │ │ │ ├── tempfile.py │ │ │ └── file-concept-location.yaml │ │ ├── memory │ │ │ ├── impl │ │ │ │ └── simple.py │ │ │ └── loading.py │ │ ├── stdlib │ │ │ └── configparser.pyi │ │ ├── logging │ │ │ ├── simple_log_alias.py │ │ │ ├── simple_log.py │ │ │ ├── simple_log_get_logger.py │ │ │ └── log_eog_check.py │ │ ├── encrypt_with_key.py │ │ ├── encrypt_with_key_fail.py │ │ └── mypackage │ │ │ └── read_config.py │ │ └── c │ │ ├── libexample │ │ └── lib.c │ │ ├── winexample │ │ └── lib.c │ │ └── winmain │ │ └── load.c │ └── test │ └── resources │ └── log4j2.xml ├── cpg-neo4j ├── src │ ├── integrationTest │ │ └── resources │ │ │ ├── very_long.cpp │ │ │ ├── test.py │ │ │ └── Implementor1.java │ ├── main │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── resources │ │ │ └── log4j2.xml │ └── test │ │ └── resources │ │ └── log4j2.xml └── .gitignore ├── cpg-language-ruby └── src │ └── test │ └── resources │ └── ruby │ ├── iter.rb │ ├── variables.rb │ └── function.rb ├── cpg-language-llvm └── src │ └── test │ └── resources │ ├── llvm │ ├── examples │ │ ├── .gitignore │ │ └── retdec │ │ │ ├── main.c │ │ │ ├── main.ll │ │ │ └── if.c │ ├── .vscode │ │ └── settings.json │ ├── literal_struct.ll │ ├── vector_poison.ll │ ├── freeze.ll │ ├── undef_insertvalue.ll │ ├── indirectbr.ll │ ├── fence.ll │ ├── floatingpoint_const.ll │ ├── alloca.ll │ ├── global_local_var.ll │ ├── callbr.ll │ ├── floatingpoint_ops.ll │ ├── loopPhi.ll │ ├── integer_ops.ll │ └── integer_comparisons.ll │ └── log4j2.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── cpg-language-java └── src │ └── test │ └── resources │ ├── partial │ ├── PrintSomething.java │ ├── TestMethodLevel.java │ ├── TestClassLevel.java │ └── CompleteHello.java │ ├── superCalls │ ├── Interface1.java │ ├── Interface2.java │ └── SuperClass.java │ ├── compiling │ ├── hierarchy │ │ ├── multistep │ │ │ ├── Root.java │ │ │ ├── Unrelated.java │ │ │ ├── Level1B.java │ │ │ ├── Level1.java │ │ │ ├── Level0.java │ │ │ └── Level2.java │ │ ├── Implementor1.java │ │ ├── Implementor2.java │ │ ├── Interface.java │ │ ├── Super.java │ │ └── Sub.java │ ├── ForEach.java │ ├── Variables.java │ ├── enums │ │ └── EnumsImport.java │ ├── FieldAccess.java │ ├── NameExpression.java │ ├── Arrays.java │ ├── OuterClass.java │ └── RecordDeclaration.java │ ├── components │ ├── EnclosedExpr.java │ ├── ClassExpr.java │ ├── ArrayCreationExpr.java │ ├── EmptyStmt.java │ ├── ArrayInitializerExpr.java │ ├── ConditionalExpr.java │ ├── ArrayAccessExpr.java │ ├── InstanceOfExpr.java │ ├── SuperExpr.java │ ├── SynchronizedStmt.java │ ├── ExplicitConstructorInvocationStmt.java │ ├── ForEachStmt.java │ ├── CastExpr.java │ ├── LiteralExpr.java │ ├── ClassOrInterfaceDeclaration.java │ ├── LambdaExpr.java │ ├── MethodReferenceExpr.java │ ├── CastConvert.java │ └── ForStmt.java │ ├── fix-328 │ ├── Animal.java │ └── Cat.java │ ├── types │ ├── Box.java │ ├── B.java │ └── A.java │ ├── java │ └── staticImports │ │ ├── single │ │ ├── A.java │ │ └── B.java │ │ └── asterisk │ │ ├── B.java │ │ └── A.java │ ├── Annotation.java │ ├── variables_extended │ └── java │ │ └── ExternalClass.java │ ├── calls │ ├── SuperClass.java │ └── External.java │ ├── LargeNegativeNumber.java │ ├── cfg │ ├── ShortCircuit.java │ ├── Loops.java │ ├── ForLoop.java │ ├── If.java │ └── BreakContinue.java │ ├── Issue285.java │ ├── eog │ └── EOG.java │ ├── constructors │ └── Constructors.java │ ├── Issue1459.java │ ├── log4j2.xml │ └── InnerClass.java ├── cpg-language-jvm └── src │ └── test │ └── resources │ ├── class │ ├── arrays │ │ └── mypackage │ │ │ ├── Element.java │ │ │ ├── Arrays.class │ │ │ ├── Element.class │ │ │ └── Arrays.java │ ├── inheritance │ │ └── mypackage │ │ │ ├── AnotherExtendedClass.java │ │ │ ├── MyInterface.java │ │ │ ├── Application.class │ │ │ ├── BaseClass.class │ │ │ ├── MyInterface.class │ │ │ ├── ExtendedClass.class │ │ │ ├── AnotherExtendedClass.class │ │ │ ├── BaseClass.java │ │ │ └── ExtendedClass.java │ ├── fields │ │ └── mypackage │ │ │ ├── Fields.class │ │ │ └── Fields.java │ ├── methods │ │ └── mypackage │ │ │ ├── Adder.class │ │ │ ├── Main.class │ │ │ ├── Adder.java │ │ │ └── Main.java │ ├── exceptions │ │ ├── ExceptionTest.class │ │ └── ExceptionTest.java │ └── literals │ │ └── mypackage │ │ └── Literals.class │ ├── jar │ └── literals │ │ └── literals.jar │ └── log4j2.xml ├── codyze-compliance └── src │ ├── integrationTest │ └── resources │ │ └── demo-app │ │ └── components │ │ └── auth │ │ └── auth │ │ ├── encrypt.py │ │ └── main.py │ └── test │ └── resources │ └── log4j2.xml ├── .gitmodules ├── cpg-language-ini └── src │ └── test │ └── resources │ └── config.ini ├── cpg-mcp └── .gitignore ├── .github ├── release.yml └── renovate.json ├── .gitignore ├── codecov.yml ├── CITATION.cff ├── .run └── Codyze Console.run.xml └── cpg-analysis └── src └── test └── resources └── log4j2.xml /docs/csaf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-go/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-core/src/test/resources/exclusion/a.file: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /style/pre-commit: -------------------------------------------------------------------------------- 1 | ./gradlew spotlessCheck 2 | -------------------------------------------------------------------------------- /cpg-core/src/test/resources/exclusion/tests/test.file: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/unity/a.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/unity/b.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/module1.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/QueryTreeExplorer.svelte: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/issue-1045/foo.c: -------------------------------------------------------------------------------- 1 | void foo(size_t n) { } 2 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-std/go.mod: -------------------------------------------------------------------------------- 1 | module std 2 | 3 | go 1.21 -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/load_includes/stdlib/json/decoder.pyi: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/go.mod: -------------------------------------------------------------------------------- 1 | module mymodule 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/big-project/stdlib/os.pyi: -------------------------------------------------------------------------------- 1 | name: str 2 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/extern_c.cpp: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | void test(); 3 | } 4 | -------------------------------------------------------------------------------- /cpg-language-go/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | *.dylib 2 | *.so 3 | *.dll 4 | *.h 5 | 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/type_hints.py: -------------------------------------------------------------------------------- 1 | a = 1 #type: int 2 | 3 | b: str -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "fwcd.kotlin" 4 | ] 5 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true 3 | } 4 | -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/de.fraunhofer.aisec/cpg/jni-config.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/org.apache.logging/log4j/jni-config.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/.gitignore: -------------------------------------------------------------------------------- 1 | LibrariesTest.kt -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/foobar/foo.c: -------------------------------------------------------------------------------- 1 | #include "foo.h" 2 | 3 | void foo(size_t n) { } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/foobar/foo.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void foo(size_t); -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/src/lib1/lib.c: -------------------------------------------------------------------------------- 1 | int function() { 2 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/unity/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int function(); 4 | 5 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-modules/go.mod: -------------------------------------------------------------------------------- 1 | module example.io/awesome 2 | 3 | go 1.16 -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/simple_import.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | mypi = math.pi -------------------------------------------------------------------------------- /cpg-language-typescript/src/main/typescript/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | parser.js 3 | dist 4 | -------------------------------------------------------------------------------- /codyze-console/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | static 2 | node_modules 3 | .vite.deps 4 | .vite 5 | 6 | -------------------------------------------------------------------------------- /codyze-core/src/integrationTest/resources/example/src/module2/pkg/mod.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | pass 3 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/conf/unused.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | verify_ssl = true 3 | -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/de.fraunhofer.aisec/cpg/resource-config.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/issue-1045/foo.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void foo(size_t n); -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/includes_1/config.h: -------------------------------------------------------------------------------- 1 | #define VERSION 1 2 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/includes_2/config.h: -------------------------------------------------------------------------------- 1 | #define VERSION 2 2 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/multi_level_mem_call.py: -------------------------------------------------------------------------------- 1 | foo = bar.baz.zzz("hello") 2 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/superclasses/superclass.py: -------------------------------------------------------------------------------- 1 | class Foobar: 2 | pass 3 | -------------------------------------------------------------------------------- /cpg-neo4j/src/integrationTest/resources/very_long.cpp: -------------------------------------------------------------------------------- 1 | unsigned long long l = 10958011617037158669ull; -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/submodule/const.go: -------------------------------------------------------------------------------- 1 | package submodule 2 | 3 | const Zero = 0 4 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/ifexpr.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | foo = 21 if False else 42 3 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/named_expressions.py: -------------------------------------------------------------------------------- 1 | def named_expression(): 2 | (x := 4) -------------------------------------------------------------------------------- /cpg-language-ruby/src/test/resources/ruby/iter.rb: -------------------------------------------------------------------------------- 1 | a = [1,2,3,4,5] 2 | a.each do |i| 3 | puts i 4 | end -------------------------------------------------------------------------------- /codyze-core/src/main/resources/META-INF/kotlin/script/templates/de.fraunhofer.aisec.codyze.CodyzeScript.classname: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /codyze-core/src/main/resources/META-INF/kotlin/script/templates/de.fraunhofer.aisec.codyze.QueryScript.classname: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/typedef_in_header/_header.h: -------------------------------------------------------------------------------- 1 | typedef struct __myStruct { 2 | 3 | } MyStruct; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/main_simple.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 1; 3 | } 4 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/packages/api/apiv1.go: -------------------------------------------------------------------------------- 1 | package apiv1 2 | 3 | func Do() { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/assert.py: -------------------------------------------------------------------------------- 1 | def test_assert(): 2 | assert 1 == 1, "Test message" -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/consteval/arithmetic.py: -------------------------------------------------------------------------------- 1 | a = 1 + 1 2 | b = a + 10 3 | c = 2**4 4 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/superclasses/incorrect.py: -------------------------------------------------------------------------------- 1 | class MyClass(MyClass): 2 | pass 3 | -------------------------------------------------------------------------------- /codyze-core/src/main/resources/META-INF/kotlin/script/templates/de.fraunhofer.aisec.codyze.ConceptScript.classname: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/goto.c: -------------------------------------------------------------------------------- 1 | void foo() { 2 | goto LAB_123; 3 | LAB_123: 4 | return; 5 | } 6 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/compoundstmt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | return 1; 5 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/go.mod: -------------------------------------------------------------------------------- 1 | module mymodule.io/integration 2 | 3 | go 1.21.1 4 | -------------------------------------------------------------------------------- /codyze-core/src/integrationTest/resources/example/src/third-party/mylib/library/lib.py: -------------------------------------------------------------------------------- 1 | def special_func(): 2 | pass 3 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/fancy_types.cpp: -------------------------------------------------------------------------------- 1 | typedef __decltype(nullptr) nullptr_t; 2 | 3 | nullptr_t ptr; 4 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/construct.h: -------------------------------------------------------------------------------- 1 | class Pair { 2 | public: 3 | Pair(int a, int b); 4 | }; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/includes_1/header_1.h: -------------------------------------------------------------------------------- 1 | int func1() { 2 | return 2; 3 | } 4 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/includes_2/header_2.h: -------------------------------------------------------------------------------- 1 | int func2() { 2 | return 2; 3 | } 4 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/version.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int version = __cplusplus; 3 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/examples/.gitignore: -------------------------------------------------------------------------------- 1 | *.config.json 2 | *.dsm 3 | a.out 4 | *.out 5 | *.out* 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/load_includes/stdlib/builtins.pyi: -------------------------------------------------------------------------------- 1 | class str(Sequence[str]): 2 | pass 3 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/simple.jsx: -------------------------------------------------------------------------------- 1 | function doJsx() { 2 | return
hello
3 | } -------------------------------------------------------------------------------- /docs/docs/assets/img/cpg-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/cpg-flow.png -------------------------------------------------------------------------------- /docs/mkdocs-material-plugins.txt: -------------------------------------------------------------------------------- 1 | mkdocs-git-revision-date-localized-plugin 2 | mkdocs-glightbox 3 | mkdocs-minify-plugin -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/.prettierignore: -------------------------------------------------------------------------------- 1 | # Package Managers 2 | package-lock.json 3 | pnpm-lock.yaml 4 | yarn.lock 5 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/index.ts: -------------------------------------------------------------------------------- 1 | // place files you want to import through the `$lib` alias in this folder. 2 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/conf/dev.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | port = 8080 3 | 4 | [ssl] 5 | enabled = false 6 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/conf/prod.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | port = 80 3 | 4 | [ssl] 5 | enabled = true 6 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/sys_includes/sys_header.h: -------------------------------------------------------------------------------- 1 | int sys_func() { 2 | return 4; 3 | } 4 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/version.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | int version = __STDC_VERSION__; 3 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/complex_resolution/go.mod: -------------------------------------------------------------------------------- 1 | module mymodule.io/complex_resolution 2 | 3 | go 1.21.1 4 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/examples/retdec/main.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | int a = 1; 3 | 4 | return a; 5 | } 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/config/__init__.py: -------------------------------------------------------------------------------- 1 | bar_string = "bar" 2 | foo_string = "foo" 3 | -------------------------------------------------------------------------------- /docs/docs/assets/img/logo-aisec.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/logo-aisec.jpg -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/cxxprioresolution/defined.cpp: -------------------------------------------------------------------------------- 1 | void g(int a) {} 2 | 3 | int main() { 4 | g(3); 5 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/main_arm64.c: -------------------------------------------------------------------------------- 1 | #if defined(__arm64__) 2 | int main() {} 3 | #else 4 | #endif -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/func_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | package integration 2 | 3 | func someSpecific() {} 4 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/short_assign.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | func assign() { 4 | x := 5 5 | 6 | _ = x 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/partial/PrintSomething.java: -------------------------------------------------------------------------------- 1 | String greeting = "Hello world"; 2 | System.out.println(greeting); -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/superCalls/Interface1.java: -------------------------------------------------------------------------------- 1 | public interface Interface1 { 2 | default void target() {} 3 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/superCalls/Interface2.java: -------------------------------------------------------------------------------- 1 | public interface Interface2 { 2 | default void target() {} 3 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/arrays/mypackage/Element.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class Element { 4 | 5 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/load_includes/stdlib/json/encoder.pyi: -------------------------------------------------------------------------------- 1 | class JSONEncoder: 2 | item_separator: str -------------------------------------------------------------------------------- /cpg-neo4j/src/main/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: de.fraunhofer.aisec.cpg_vis_neo4j.Application 3 | 4 | -------------------------------------------------------------------------------- /docs/docs/assets/img/overall-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/overall-view.png -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/c/libexample/lib.c: -------------------------------------------------------------------------------- 1 | int myvar = 2; 2 | 3 | int myfunc(int i) { 4 | return i + 1; 5 | } 6 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_read.py: -------------------------------------------------------------------------------- 1 | with open('example.txt', 'r') as file: 2 | content = file.read() -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/memory/impl/simple.py: -------------------------------------------------------------------------------- 1 | class SimpleImplClass: 2 | def foo(self): 3 | pass 4 | -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/de.fraunhofer.aisec/cpg/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["java.util.function.Consumer"] 3 | ] -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/org.apache.logging/log4j/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["java.util.function.Consumer"] 3 | ] -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/cxxprioresolution/undefined.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | f(3); 3 | } 4 | 5 | void f(int a) { 6 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Root.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Root { 4 | 5 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Unrelated.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Unrelated {} -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/literal.py: -------------------------------------------------------------------------------- 1 | b = True 2 | i = 42 3 | f = 1.0 4 | c = 3 + 5j 5 | t = "Hello" 6 | n = None 7 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/with_stmt_EOG.py: -------------------------------------------------------------------------------- 1 | with open('foo.txt') as file: 2 | file.read() 3 | 4 | print("Done") -------------------------------------------------------------------------------- /cpg-language-typescript/src/main/typescript/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "typescript": "npm:typescript@^5.8.3" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /docs/docs/assets/img/codyze-component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/codyze-component.png -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_write.py: -------------------------------------------------------------------------------- 1 | with open('example.txt', 'w') as file: 2 | file.write('Hello world!') -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/another-include.h: -------------------------------------------------------------------------------- 1 | /* This file is just there to demonstrate include include black and white-listing */ 2 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "stdint.h": "c" 4 | } 5 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/unicode.py: -------------------------------------------------------------------------------- 1 | def normal_func(): 2 | e = "e" 3 | 4 | def unicode_func(): 5 | e = "é" 6 | -------------------------------------------------------------------------------- /cpg-language-ruby/src/test/resources/ruby/variables.rb: -------------------------------------------------------------------------------- 1 | $global = "some string" 2 | 3 | def test() 4 | a = 4.0 5 | puts $global 6 | end 7 | -------------------------------------------------------------------------------- /codyze-compliance/src/integrationTest/resources/demo-app/components/auth/auth/encrypt.py: -------------------------------------------------------------------------------- 1 | def encrypt(param1: str, param2: str): 2 | pass 3 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/tempInTmp.py: -------------------------------------------------------------------------------- 1 | with open('/tmp/example.txt', 'w') as file: 2 | file.write('Hello world!') -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/stdlib/configparser.pyi: -------------------------------------------------------------------------------- 1 | class ConfigParser: 2 | def read(self, filename: str) -> None: ... 3 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/bindings/use_then_declare.cpp: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | void someFun() { 3 | x = 5; 4 | } 5 | int x; 6 | }; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/cast_to_inferred.c: -------------------------------------------------------------------------------- 1 | int foo(const mytype *p) 2 | { 3 | mytype *v; 4 | *v = (mytype)*p; 5 | return 0; 6 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/type_loop.go: -------------------------------------------------------------------------------- 1 | package fmt 2 | 3 | type some struct { 4 | } 5 | 6 | type fmt struct { 7 | some 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/superCalls/SuperClass.java: -------------------------------------------------------------------------------- 1 | public class SuperClass { 2 | public int field; 3 | public void target() {} 4 | } -------------------------------------------------------------------------------- /docs/docs/assets/img/cpg-flow-no-backend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/cpg-flow-no-backend.png -------------------------------------------------------------------------------- /codyze-core/src/integrationTest/resources/encrypt.py: -------------------------------------------------------------------------------- 1 | key = get_secret_from_server() 2 | 3 | err = encrypt("Hello World", key, cipher = "AES-256") 4 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/func_linux_arm64.go: -------------------------------------------------------------------------------- 1 | package integration 2 | 3 | func OS() string { 4 | return "linux" 5 | } 6 | -------------------------------------------------------------------------------- /docs/docs/assets/img/codyze-analysis-result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/codyze-analysis-result.png -------------------------------------------------------------------------------- /docs/docs/assets/img/codyze-ast-nodes-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/codyze-ast-nodes-table.png -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/foo2.cpp: -------------------------------------------------------------------------------- 1 | void foo (int a) { } 2 | 3 | int main() { 4 | foo(3); 5 | 6 | C c; 7 | c.foo(4); 8 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Level1B.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Level1B extends Level0 { 4 | 5 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/complex_class.pyi: -------------------------------------------------------------------------------- 1 | class Foo: 2 | x: int 3 | s: str 4 | def bar(self: Foo, y: int) -> int: ... 5 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/foobar/bar.c: -------------------------------------------------------------------------------- 1 | #include "foo.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | foo(argc); 6 | foo((size_t)argc); 7 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/ifextra.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int j = 3; 5 | if(int i = 0; int k = i == j) j = k; 6 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/declaration.h: -------------------------------------------------------------------------------- 1 | // this is a declaration, so that others can call the function without having the body 2 | int function(); -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/main_tu_1.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | int main() { 4 | VERSION; 5 | FOO; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/main_tu_2.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | int main() { 4 | VERSION; 5 | FOO; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/namespaces.cpp: -------------------------------------------------------------------------------- 1 | namespace FirstNamespace { 2 | class SomeClass { 3 | 4 | }; 5 | }; 6 | 7 | class AnotherClass { 8 | 9 | }; -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/chan.go: -------------------------------------------------------------------------------- 1 | package pa 2 | 3 | func main() { 4 | var v int 5 | var ch = make(chan int) 6 | ch <- v 7 | <-ch 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/if.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | func main() { 4 | var b bool = true 5 | 6 | if b { 7 | b = false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/if.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | sel = True 3 | 4 | if sel: 5 | sel = False 6 | else: 7 | pass 8 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/issue615.py: -------------------------------------------------------------------------------- 1 | test = [(1, 2, 3)] 2 | for t1, t2, t3 in test: 3 | print("bug ... {} {} {}".format(t1, t2, t3)) 4 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/modules/c.py: -------------------------------------------------------------------------------- 1 | def completely_different_func(): 2 | print("I am completely_different_func of c") 3 | return 4 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_with_branching.py: -------------------------------------------------------------------------------- 1 | if foo: 2 | file = open("foo") 3 | else: 4 | file = open("bar") 5 | 6 | file.read() -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/bindings/replace_declaration.cpp: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | int a = 0; 3 | 4 | void main() { 5 | int c = a + 1; 6 | } 7 | }; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/call_me_crazy.h: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | private: 3 | int someFunction() 4 | { 5 | call(me(crazy)); 6 | return 1; 7 | } 8 | 9 | }; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/fix-1226/main1.cpp: -------------------------------------------------------------------------------- 1 | #include "header.h" 2 | 3 | int main() { 4 | int i = 1; 5 | A a; 6 | return a.foo(i); 7 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/fix-1226/main2.cpp: -------------------------------------------------------------------------------- 1 | #include "header.h" 2 | 3 | int main() { 4 | int i = 1; 5 | A a; 6 | return a.foo(i); 7 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/partial/TestMethodLevel.java: -------------------------------------------------------------------------------- 1 | int x = 0; 2 | if (x + 5 > 10) { 3 | return doSomething(x); 4 | } else { 5 | return null; 6 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/big-project/component1/mypackage/module.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | a = os.name 4 | 5 | def foo(bar): 6 | return bar+1 7 | -------------------------------------------------------------------------------- /docs/docs/assets/fonts/Inter/font-files/Inter.var.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/fonts/Inter/font-files/Inter.var.woff2 -------------------------------------------------------------------------------- /docs/docs/assets/img/Institut-AISEC-Gebaeude-Nacht.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/Institut-AISEC-Gebaeude-Nacht.jpg -------------------------------------------------------------------------------- /docs/docs/assets/img/overall-view-black-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/overall-view-black-background.png -------------------------------------------------------------------------------- /docs/docs/assets/img/overall-view-white-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/overall-view-white-background.png -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/dfg.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "db" 4 | 5 | func main() int { 6 | data := &Data{Name: name} 7 | db.Create(data) 8 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/packages/packages.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "mymodule.io/packages/api" 4 | 5 | func DoPackage() { 6 | apiv1.Do() 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/EnclosedExpr.java: -------------------------------------------------------------------------------- 1 | class EnclosedExpr { 2 | 3 | public static void main(String[] args){ 4 | int i = (2* 5); 5 | } 6 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/partial/TestClassLevel.java: -------------------------------------------------------------------------------- 1 | private int field=0; 2 | 3 | public boolean isGreaterThanField(int arg) { 4 | return arg>field; 5 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/literal_struct.ll: -------------------------------------------------------------------------------- 1 | define { i32, i8 } @foo() { 2 | ret { i32, i8 } { i32 4, i8 2 } ; Return a struct of values 4 and 2 3 | } 4 | -------------------------------------------------------------------------------- /docs/docs/assets/img/codyze-ast-nodes-overlay-tooltip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/img/codyze-ast-nodes-overlay-tooltip.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/security-metrics"] 2 | path = external/security-metrics 3 | url = https://github.com/Cybersecurity-Certification-Hub/security-metrics.git 4 | -------------------------------------------------------------------------------- /codyze-core/src/integrationTest/resources/simple.py: -------------------------------------------------------------------------------- 1 | def foo() -> int: 2 | bar = 42 3 | 4 | if bar < 20: 5 | raise "bar is too small" 6 | 7 | return bar 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/enum.c: -------------------------------------------------------------------------------- 1 | typedef enum { 2 | THIS = 0, 3 | THAT = 1, 4 | THE_OTHER = 2, 5 | } MyEnum; 6 | 7 | int main() { 8 | return THE_OTHER; 9 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/struct.c: -------------------------------------------------------------------------------- 1 | struct MyStruct { 2 | int field; 3 | }; 4 | 5 | int main() { 6 | struct MyStruct s; 7 | 8 | return 1; 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/typedef_in_header/header.h: -------------------------------------------------------------------------------- 1 | #include "_header.h" 2 | 3 | extern MyStruct* var; 4 | 5 | int doSomething(MyStruct *, const char*, ...); 6 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/definition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // this is the definition of our function 4 | int function() { 5 | return 1; 6 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/embed.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type MyInterface interface { 4 | MyOtherInterface 5 | } 6 | 7 | type MyOtherInterface interface {} -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/AnotherExtendedClass.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class AnotherExtendedClass extends BaseClass { 4 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/jar/literals/literals.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/jar/literals/literals.jar -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/nested_replace.py: -------------------------------------------------------------------------------- 1 | import mypackage 2 | 3 | def func(value): 4 | mypackage.function(value.another_function()).do_something() 5 | -------------------------------------------------------------------------------- /cpg-language-ruby/src/test/resources/ruby/function.rb: -------------------------------------------------------------------------------- 1 | def my_function(value) 2 | out = 2 * value 3 | return out 4 | end 5 | 6 | def another_function() 7 | a = 2 8 | end -------------------------------------------------------------------------------- /docs/docs/assets/fonts/Inter/font-files/Inter-roman.var.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/fonts/Inter/font-files/Inter-roman.var.woff2 -------------------------------------------------------------------------------- /codyze-compliance/src/integrationTest/resources/demo-app/components/auth/auth/main.py: -------------------------------------------------------------------------------- 1 | print("Hello World") 2 | 3 | def encrypt(param: str): 4 | return very_good_encryption() 5 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_loop.py: -------------------------------------------------------------------------------- 1 | x = ["a", "b", "c"] 2 | file = open("a") 3 | for bla in x: 4 | file.write(bla) 5 | file = open("b") 6 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/foobar/std/stdlib.h: -------------------------------------------------------------------------------- 1 | // this file simulates the std header lib 2 | typedef unsigned long __internal_size_t; 3 | typedef __internal_size_t size_t; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/enum.cpp: -------------------------------------------------------------------------------- 1 | enum MyEnum { 2 | THIS = 0, 3 | THAT = 1, 4 | THE_OTHER = 2, 5 | }; 6 | 7 | int main() { 8 | return MyEnum::THE_OTHER; 9 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/if.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | if(true) { 5 | return 0; 6 | } else { 7 | return 2; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/shiftexpression.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() { 4 | int a; 5 | //int a >> 2; 6 | std::cout << "hello" << std::endl; 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/types.cpp: -------------------------------------------------------------------------------- 1 | class T { 2 | 3 | }; 4 | 5 | class S; 6 | 7 | T t(T); 8 | 9 | int main() { 10 | T(x); 11 | 12 | T t(x); 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-modules/util/stuff.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "example.io/awesome" 4 | 5 | func DoSomethingWith(a *awesome.Awesome) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/packages/cmd/packages/packages.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "mymodule.io/packages" 4 | 5 | func main() { 6 | p.DoPackage() 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ClassExpr.java: -------------------------------------------------------------------------------- 1 | class ClassExpr { 2 | public static void main(String[] args){ 3 | System.out.println(ClassExpr.class); 4 | } 5 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/fix-328/Animal.java: -------------------------------------------------------------------------------- 1 | package my; 2 | 3 | public abstract class Animal implements Behavior { 4 | 5 | protected int myField; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/big-project/component2/otherpackage/module.py: -------------------------------------------------------------------------------- 1 | import mypackage.module 2 | 3 | b = 3 4 | c = mypackage.module.a 5 | module.foo(bar=2) 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/class_fields.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | x: int 3 | y = 123 4 | 5 | def bar(self): 6 | self.z 7 | self.baz = 456 8 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/implementation/__init__.py: -------------------------------------------------------------------------------- 1 | # this also "exports" foo in this module 2 | from .internal_foo import foo 3 | 4 | foo() 5 | -------------------------------------------------------------------------------- /cpg-neo4j/src/integrationTest/resources/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | def main(): 4 | print("hello world") 5 | 6 | 7 | if __name__ == '__main__': 8 | main() 9 | -------------------------------------------------------------------------------- /docs/docs/assets/fonts/Inter/font-files/Inter-italic.var.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/fonts/Inter/font-files/Inter-italic.var.woff2 -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/initlistexpression.cpp: -------------------------------------------------------------------------------- 1 | struct x { 2 | int a; 3 | int b; 4 | }; 5 | 6 | x y = { 1, 2 }; 7 | int z[] = { 2, 3, 4 }; // should result in a int[] 8 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-modules/awesome.go: -------------------------------------------------------------------------------- 1 | package awesome 2 | 3 | type Awesome struct { 4 | } 5 | 6 | func NewAwesome() *Awesome { 7 | return &Awesome{} 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/inference.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "database/sql" 4 | 5 | func doDB() { 6 | var db *sql.DB 7 | db.Query("SELECT * FROM table") 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/options/srv.go: -------------------------------------------------------------------------------- 1 | package options 2 | 3 | type srv struct { 4 | inner *inner 5 | } 6 | 7 | type inner struct { 8 | field int 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/class_self.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | def bar(self, i: int): 3 | self.somevar = i 4 | 5 | def foo(self): 6 | self.bar(123) 7 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/implementation/internal_foo.py: -------------------------------------------------------------------------------- 1 | from ..config import foo_string 2 | 3 | def foo(): 4 | print(foo_string) 5 | pass 6 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/lambda.js: -------------------------------------------------------------------------------- 1 | var dispatcher = require('httpdispatcher') 2 | 3 | dispatcher.onPost(/^\/ratings\/[0-9]*/, function (req, res) { 4 | 5 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/logging/simple_log_alias.py: -------------------------------------------------------------------------------- 1 | import logging as log 2 | 3 | log.info("INFO") 4 | logger = log.getLogger(__name__) 5 | logger.error('ERROR') 6 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ArrayCreationExpr.java: -------------------------------------------------------------------------------- 1 | class ArrayCreationExpr { 2 | public static void main(String[] args){ 3 | String[] strings = new String[5]; 4 | } 5 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/MyInterface.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public interface MyInterface { 4 | 5 | public void doSomething(); 6 | 7 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/import_no_src.py: -------------------------------------------------------------------------------- 1 | from foo import bar 2 | from foo import bar as baz 3 | import foo 4 | 5 | bar() 6 | baz() 7 | foo.foo() 8 | foo.foo2.foo3() 9 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/implementation/internal_bar.py: -------------------------------------------------------------------------------- 1 | import foobar.config 2 | 3 | def bar(): 4 | print(foobar.config.bar_string) 5 | pass 6 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/decorator.ts: -------------------------------------------------------------------------------- 1 | @awesome 2 | class MyClass { 3 | @dontcall 4 | method() { } 5 | 6 | @sensitive("very") 7 | something: Number; 8 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/symbols/simple_calls.cpp: -------------------------------------------------------------------------------- 1 | int some_func() { 2 | return 0; 3 | } 4 | 5 | int simple_calls() { 6 | // call to some_func 7 | some_func(); 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/EmptyStmt.java: -------------------------------------------------------------------------------- 1 | class EmptyStmt { 2 | 3 | public static void main(String[] args) { 4 | while (true) ; 5 | if (true) ;; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/arrays/mypackage/Arrays.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/arrays/mypackage/Arrays.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/fields/mypackage/Fields.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/fields/mypackage/Fields.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/methods/mypackage/Adder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/methods/mypackage/Adder.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/methods/mypackage/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/methods/mypackage/Main.class -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/calc.py: -------------------------------------------------------------------------------- 1 | a = (((3 - 1) / 2) * 4) ** 2 2 | 3 | b = a 4 | b *= 2 5 | 6 | c = (not True and False) or True 7 | d = ((-5 >> 2) & ~7 | (+4 << 1)) ^ 0xffff -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/foreachstmt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | std::vector ls; 6 | 7 | for(auto i : ls) printf("%d\n", i); 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/arrays/mypackage/Element.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/arrays/mypackage/Element.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/exceptions/ExceptionTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/exceptions/ExceptionTest.class -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/vector_poison.ll: -------------------------------------------------------------------------------- 1 | define i32 @main() { ; i32()* 2 | %vec = insertelement <4 x i32> , i32 5, i32 0 3 | ret i32 0 4 | } 5 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/import_test.py: -------------------------------------------------------------------------------- 1 | import pkg.module 2 | from pkg import another_module 3 | import pkg.another_module 4 | 5 | a = pkg.module.foo 6 | b = another_module.foo 7 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/main/typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "esnext", 5 | "moduleResolution": "Node" 6 | } 7 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/logging/simple_log.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.warning('WARN') 4 | logging.info('INFO') 5 | 6 | secret = get_secret() 7 | logging.debug(secret) 8 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/logging/simple_log_get_logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logger = logging.getLogger(__name__) 4 | logger.setLevel(logging.INFO) 5 | logger.error('ERROR') 6 | -------------------------------------------------------------------------------- /cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/package-info.java: -------------------------------------------------------------------------------- 1 | /** Passes extend the initial AST by additional edges (and possibly type nodes). */ 2 | package de.fraunhofer.aisec.cpg.passes; 3 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/fix-1226/header.h: -------------------------------------------------------------------------------- 1 | template 2 | struct A { 3 | int foo(int i); 4 | }; 5 | 6 | template 7 | int A::foo(int i) { 8 | return foo(i + 1); 9 | } -------------------------------------------------------------------------------- /cpg-language-ini/src/test/resources/config.ini: -------------------------------------------------------------------------------- 1 | ; An example INI file 2 | 3 | [SectionA] 4 | key1 = value1 5 | key2 = value2 6 | 7 | [SectionB] 8 | key1 = 123 9 | key2 = 1.2.3.4 10 | key3 = "abc" -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ArrayInitializerExpr.java: -------------------------------------------------------------------------------- 1 | class ArrayInitializerExpr { 2 | 3 | public static void main(String[] args){ 4 | int[] a = new int[]{1, 2 ,3 ,4 ,5}; 5 | } 6 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ConditionalExpr.java: -------------------------------------------------------------------------------- 1 | class ConditionalExpr { 2 | public static void main(String[] args){ 3 | int important = args.length == 0 ? -1 : args.length; 4 | } 5 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/literals/mypackage/Literals.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/literals/mypackage/Literals.class -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/modules/b.py: -------------------------------------------------------------------------------- 1 | def func(): 2 | print("I am func of b") 3 | return 4 | 5 | 6 | def other_func(): 7 | print("I am other_func of b") 8 | return 9 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/tempOrNot.py: -------------------------------------------------------------------------------- 1 | if foo(): 2 | file = open('/tmp/example.txt', 'w') 3 | else: 4 | file = open('/notTmp/example.txt', 'w') 5 | file.write('Hello world!') -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/func_ios.go: -------------------------------------------------------------------------------- 1 | // Some other header 2 | 3 | // Package integration is awesome 4 | package integration 5 | 6 | func OS() string { 7 | return "ios" 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/fix-328/Cat.java: -------------------------------------------------------------------------------- 1 | package my; 2 | 3 | public class Cat extends Animal implements OtherBehavior { 4 | 5 | public Cat() { 6 | super.myField = 2; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/complex_class.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | x = 1 3 | s: str 4 | 5 | def bar(self, y: int): 6 | z = self.x + y 7 | self.x = z 8 | return z 9 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/issue473.py: -------------------------------------------------------------------------------- 1 | if sys.version_info.minor > 9: 2 | phr = {"user_id": user_id} | content 3 | else: 4 | z = {"user_id": user_id} 5 | phr = {**z, **content} 6 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_os_open.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC 4 | with os.open('example.txt', flags, 0o600) as fh: 5 | fh.write('foo') 6 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/multipleTempFiles.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | 5 | tmp1 = tempfile.NamedTemporaryFile(delete=True) 6 | tmp2 = tempfile.NamedTemporaryFile(delete=True) -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/types.c: -------------------------------------------------------------------------------- 1 | // C allows to omit the type specifier, which then defaults to int. 2 | // However, usually a compiler will at least emit a warning here. 3 | main() { 4 | return 1; 5 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/cast.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | type myError string 4 | 5 | func (err myError) Error() string { 6 | return string(err) 7 | } 8 | 9 | var s = error(myError("abc")) 10 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/Implementor1.java: -------------------------------------------------------------------------------- 1 | public class Implementor1 implements Interface { 2 | 3 | @Override 4 | public int getInt() { 5 | return 42; 6 | } 7 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/Implementor2.java: -------------------------------------------------------------------------------- 1 | public class Implementor2 implements Interface { 2 | 3 | @Override 4 | public int getInt() { 5 | return 123; 6 | } 7 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/Interface.java: -------------------------------------------------------------------------------- 1 | public interface Interface { 2 | 3 | int getInt(); 4 | 5 | default String print() { 6 | return "Default print!"; 7 | } 8 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ArrayAccessExpr.java: -------------------------------------------------------------------------------- 1 | class ArrayAccessExpr { 2 | public static void main(String[] args){ 3 | String[] strings = new String[5]; 4 | strings[0] = "\n"; 5 | } 6 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/partial/CompleteHello.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public void sayHello() { 3 | String greeting = "Hello world"; 4 | System.out.println(greeting); 5 | } 6 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/types/Box.java: -------------------------------------------------------------------------------- 1 | public class Box { 2 | // T stands for "Type" 3 | private T t; 4 | 5 | public void set(T t) { this.t = t; } 6 | public T get() { return t; } 7 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/Application.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/inheritance/mypackage/Application.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/BaseClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/inheritance/mypackage/BaseClass.class -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/MyInterface.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/inheritance/mypackage/MyInterface.class -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/call_confusion.py: -------------------------------------------------------------------------------- 1 | from somewhere import context 2 | 3 | class MyClass(): 4 | def some_func(self, context: context.SomeContext): 5 | context.do_something() 6 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/class_type_annotations.py: -------------------------------------------------------------------------------- 1 | class Other: 2 | j: int 3 | 4 | class Foo: 5 | i: int 6 | 7 | def from_other(self, other: Other): 8 | self.i = other.j 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Level1.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Level1 extends Level0 { 4 | 5 | public int getField1() { 6 | return field; 7 | } 8 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/InstanceOfExpr.java: -------------------------------------------------------------------------------- 1 | class InstanceOfExpr { 2 | 3 | public static void main(String[] args){ 4 | if(args[0] instanceof String) 5 | System.out.println("is"); 6 | } 7 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/ExtendedClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/inheritance/mypackage/ExtendedClass.class -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/load_includes/example/program.py: -------------------------------------------------------------------------------- 1 | import json.encoder 2 | 3 | a=json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') 4 | b=json.encoder.JSONEncoder().item_separator 5 | c=str(1) -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/superclasses/superclass_import_full_path.py: -------------------------------------------------------------------------------- 1 | import resources.python.superclasses.superclass 2 | 3 | class base(resources.python.superclasses.superclass.Foobar): 4 | pass -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/superclasses/superclass_import_module_alias.py: -------------------------------------------------------------------------------- 1 | from resources.python import superclasses as super_alias 2 | 3 | class base(super_alias.superclass.Foobar): 4 | pass 5 | 6 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/ref.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "auth" 5 | ) 6 | 7 | var service *auth.Service 8 | 9 | func main() { 10 | service = &auth.Service{Name: "MyName"} 11 | } 12 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/freeze.ll: -------------------------------------------------------------------------------- 1 | define i32 @main() { ; i32()* 2 | %ptr = alloca i32 3 | store i32 undef, i32* %ptr 4 | %w = load i32, i32* %ptr 5 | %x = freeze i32 %w 6 | ret i32 %x 7 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/undef_insertvalue.ll: -------------------------------------------------------------------------------- 1 | define { i32, i8 } @foo() { 2 | %a = insertvalue {i32, i8} undef, i32 100, 0 3 | %b = insertvalue {i32, i8} %a, i8 7, 1 4 | ret { i32, i8 } %b 5 | } 6 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/forms/index.ts: -------------------------------------------------------------------------------- 1 | // Forms and dialogs 2 | export { default as AddConceptDialog } from './AddConceptDialog.svelte'; 3 | export { default as NewAnalysis } from './NewAnalysis.svelte'; 4 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/+page.ts: -------------------------------------------------------------------------------- 1 | import { redirect } from '@sveltejs/kit'; 2 | import type { PageLoad } from './$types'; 3 | 4 | export const load: PageLoad = () => { 5 | redirect(307, '/dashboard'); 6 | }; 7 | -------------------------------------------------------------------------------- /codyze-core/src/integrationTest/resources/example/src/module1/main.py: -------------------------------------------------------------------------------- 1 | from library.lib import special_func 2 | 3 | key = get_secret_from_server() 4 | 5 | err = encrypt("Hello World", key, cipher = "AES-256") 6 | special_func() 7 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/ignore-return.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | Object o1; 3 | someFunction(o1); // intentionally ignore the return value 4 | } 5 | 6 | Object someFunction(Object x) { 7 | return x; 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-std/fmt/print.go: -------------------------------------------------------------------------------- 1 | package fmt 2 | 3 | func Printf(format string, a ...any) (n int, err error) { 4 | // Not a real implementation, and we are ignoring it anyway 5 | return 0, nil 6 | } 7 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/options/srv_option.go: -------------------------------------------------------------------------------- 1 | package options 2 | 3 | type Option func(*srv) 4 | 5 | func WithField(a int) Option { 6 | return func(s *srv) { 7 | s.inner.field = a 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/unaryoperator.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int a; 3 | 4 | a++; 5 | --a; 6 | 7 | int len = sizeof(a); 8 | 9 | bool b = !false; 10 | 11 | int* ptr = 0; 12 | 13 | b = *ptr; 14 | } 15 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/AnotherExtendedClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/cpg-language-jvm/src/test/resources/class/inheritance/mypackage/AnotherExtendedClass.class -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/simple_class.py: -------------------------------------------------------------------------------- 1 | class SomeClass: 2 | def someFunc(self): 3 | pass 4 | 5 | 6 | def foo(): 7 | c1 = SomeClass() 8 | # c2 = SomeClass() 9 | c1.someFunc() 10 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/function.js: -------------------------------------------------------------------------------- 1 | function someFunction() { 2 | var i = someOtherFunction("hello"); 3 | 4 | return i; 5 | } 6 | 7 | function someOtherFunction(s) { 8 | return s.length; 9 | } -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Zero.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Zero.woff -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/compiling/hierarchy/multistep/simple_inheritance.cpp: -------------------------------------------------------------------------------- 1 | class Root {}; 2 | class Level0: Root {}; 3 | class Level1: Level0 {}; 4 | class Level1B: Level0 {}; 5 | class Level2: Level1 {}; 6 | class Unrelated {}; -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/superclass.h: -------------------------------------------------------------------------------- 1 | class A {}; 2 | 3 | namespace N { 4 | class B {}; 5 | }; 6 | 7 | namespace M { 8 | namespace C { 9 | class D {}; 10 | } 11 | } 12 | 13 | class E {}; -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/java/staticImports/single/A.java: -------------------------------------------------------------------------------- 1 | package single; 2 | 3 | public class A { 4 | 5 | public static int test = 42; 6 | 7 | public static void test() { 8 | 9 | } 10 | 11 | class C {} 12 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/c/winexample/lib.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOL WINAPI DllMain( 4 | HINSTANCE hinstDLL, 5 | DWORD fdwReason, 6 | LPVOID lpvReserved 7 | ) { 8 | return TRUE; 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/issue-1045/bar.c: -------------------------------------------------------------------------------- 1 | #include "foo.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | foo(argc); // Infers a new function. 6 | foo((size_t)argc); // References the right function in the graph. 7 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/symbols/member_calls.cpp: -------------------------------------------------------------------------------- 1 | class MyClass { 2 | void foo() { 3 | } 4 | }; 5 | 6 | int member_calls() { 7 | // call to member function 8 | MyClass myClass; 9 | myClass.foo(); 10 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/SuperExpr.java: -------------------------------------------------------------------------------- 1 | class A {int a;} 2 | 3 | class SuperExpr extends A{ 4 | 5 | public SuperExpr(){super.a = 5;} 6 | 7 | 8 | public static void main(String[] args){ 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/class_ctor.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | def __init__(self): 3 | pass 4 | 5 | def foobar(self): 6 | pass 7 | 8 | 9 | def bar(): 10 | foo = Foo() 11 | foo.foobar() 12 | -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/new-analysis/+page.ts: -------------------------------------------------------------------------------- 1 | import type { PageLoad } from './$types'; 2 | 3 | export const load: PageLoad = async ({ fetch }) => { 4 | // No data loading needed for the new analysis page 5 | return {}; 6 | }; 7 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/implicit_casts.c: -------------------------------------------------------------------------------- 1 | void f(int x) {} 2 | 3 | // g simulates a compile error 4 | void g(int x) {} 5 | void g(float x) {} 6 | 7 | int main() { 8 | char x = 'a'; 9 | f(x); 10 | 11 | g(x); 12 | } 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/typedef_struct.c: -------------------------------------------------------------------------------- 1 | typedef struct test { 2 | int a; 3 | int b; 4 | } S; 5 | 6 | int structs() { 7 | S s; 8 | S t; 9 | S* p=&s; 10 | s.a=1; 11 | s.b=2; 12 | printf("%d %d\n", s.a, s.b); 13 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/cmd/buildtags/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "mymodule.io/integration" 7 | ) 8 | 9 | func main() { 10 | fmt.Printf("Your OS: %s", buildtags.OS()) 11 | } 12 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/integration/func_darwin.go: -------------------------------------------------------------------------------- 1 | // Some other header 2 | 3 | //go:build darwin 4 | 5 | // Package integration is awesome 6 | package integration 7 | 8 | func OS() string { 9 | return "darwin" 10 | } 11 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/indirectbr.ll: -------------------------------------------------------------------------------- 1 | define i32 @foo(i32* %addr) nounwind uwtable readnone optsize ssp { 2 | indirectbr i32* %addr, [ label %bb1, label %bb2 ] 3 | 4 | bb1: 5 | ret i32 1 6 | 7 | bb2: 8 | ret i32 2 9 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/formatted_values.py: -------------------------------------------------------------------------------- 1 | a = f'Number: {42:.2f}' 2 | b = f'Hexadecimal: {255:#x}' 3 | c = f'String with conversion: {"Hello, world!"!r}' 4 | d = f'ASCII representation: {"50$"!a}' 5 | e = f'Combined: {42!s:10}' -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/parent_confusion/package/myclass.py: -------------------------------------------------------------------------------- 1 | import other.myclass 2 | 3 | class MyClass(other.myclass.MyClass): 4 | a = 1 5 | 6 | def test(self): 7 | return self.a 8 | 9 | pass 10 | -------------------------------------------------------------------------------- /cpg-mcp/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | target 3 | .gradle 4 | build 5 | .settings 6 | .project 7 | .classpath 8 | .idea 9 | bin 10 | *.pyc 11 | *.pickle 12 | log 13 | .volumes 14 | out 15 | .data/ 16 | logs 17 | /lsp/*.log 18 | . 19 | cpg-neo4j.iml -------------------------------------------------------------------------------- /cpg-neo4j/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | target 3 | .gradle 4 | build 5 | .settings 6 | .project 7 | .classpath 8 | .idea 9 | bin 10 | *.pyc 11 | *.pickle 12 | log 13 | .volumes 14 | out 15 | .data/ 16 | logs 17 | /lsp/*.log 18 | . 19 | cpg-neo4j.iml -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/encrypt_with_key.py: -------------------------------------------------------------------------------- 1 | key = get_secret_from_server() 2 | 3 | err = encrypt("Hello World", key, cipher = "AES-256") 4 | if err: 5 | print("Some error occurred") 6 | del key 7 | else: 8 | del key 9 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/typeidexpr.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int i = sizeof(myClass); 3 | const std::type_info& typeInfo = typeid(myClass); 4 | int j = alignof(A); 5 | int k = typeof(A); 6 | //int l = sizeof...(A); somehow does not work 7 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/datatypes.py: -------------------------------------------------------------------------------- 1 | a = [1, 2, 3, 3] 2 | b = {1, 2, 3, 3} 3 | c = (1, 2, 3) 4 | d = { 5 | "a": "b", 6 | "c": "d", 7 | "e": "f" 8 | } 9 | e = f'Values of a: {a} and b: {b!s}' 10 | f = a[1:3:2] 11 | -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_os_open_bad.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC 4 | with os.open('example.txt', flags, 0o600) as fh: 5 | fh.write('foo') 6 | os.chmod('example.txt', 0o511) 7 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/assignmentexpression.cpp: -------------------------------------------------------------------------------- 1 | int someFunction(int c) { 2 | return 2; 3 | } 4 | 5 | int main() { 6 | int a; 7 | 8 | a = 2; 9 | 10 | int b; 11 | 12 | a = b; 13 | 14 | a = someFunction(b); 15 | } 16 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/castexpr.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | ExtendedClass* e = new ExtendedClass(); 3 | BaseClass* b = (BaseClass*) e; 4 | b = static_cast(e); 5 | b = reinterpret_cast(e); 6 | int d = (int) 0.4f; 7 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/compile_commands_bear.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "/usr/bin/gcc -c lib.c -o lib", 4 | "directory": "src/test/resources/cxxCompilationDatabase/src/lib1", 5 | "file": "lib.c" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Level0.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Level0 extends Root { 4 | 5 | public int field = 0; 6 | 7 | public int getNumber() { 8 | return 0; 9 | } 10 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/methods/mypackage/Adder.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | import java.lang.Integer; 4 | 5 | public class Adder { 6 | 7 | Integer add(Integer a, Integer b) { 8 | return a + b; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/1740_endless_cdg_loop.py: -------------------------------------------------------------------------------- 1 | def this_will_loop(): 2 | double_nested_list = {} 3 | for key, value in double_nested_list: 4 | if True: 5 | for subkey, subvalue in value: 6 | pass -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/typedef_in_header/main.c: -------------------------------------------------------------------------------- 1 | // this file emulates something similar to the FILE* typedef 2 | #include "header.h" 3 | 4 | int main() { 5 | int i; 6 | doSomething(var, "%d", i); 7 | struct __myStruct* s = var; 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/Annotation.java: -------------------------------------------------------------------------------- 1 | @AnnotationForClass(value = 2) 2 | public class Annotation { 3 | 4 | @AnnotatedField 5 | private int field = 1; 6 | 7 | @AnnotatedField("myString") 8 | private int anotherField = 2; 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/async.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | 4 | async def my_func(i: int): 5 | async for obj in generator: 6 | pass 7 | 8 | await asyncio.sleep(i) 9 | 10 | def my_other_func(i: int): 11 | pass 12 | -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/implicitcast/implicitcast.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int multiply (int val) 5 | { 6 | return val * 3; 7 | } 8 | 9 | 10 | int main() { 11 | std::cout << multiply(10.0) << '\n'; 12 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/unnamed.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "context" 4 | 5 | type MyStruct struct{} 6 | 7 | func (MyStruct) MyFunc() int { 8 | return 1 9 | } 10 | 11 | func MyGlobalFunc(_ context.Context) int { 12 | return 2 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/SynchronizedStmt.java: -------------------------------------------------------------------------------- 1 | class SynchronizedStmt { 2 | 3 | public static void main(String[] args){ 4 | Object lock = new Object(); 5 | synchronized(lock){ 6 | System.out.println("Lock is locked"); 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fraunhofer-AISEC/cpg/HEAD/docs/docs/assets/javascripts/MathJax-3.2.2/es5/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | categories: 3 | - title: 🏕 Features 4 | labels: 5 | - '*' 6 | exclude: 7 | labels: 8 | - dependencies 9 | - title: 👒 Dependencies 10 | labels: 11 | - dependencies 12 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/construct.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | type MyStruct struct {} 4 | 5 | func main() { 6 | o := new(MyStruct) 7 | 8 | a := make([]int, 5) 9 | 10 | m := make(map[string]string, 10) 11 | 12 | ch := make(chan int) 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/switch.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import ("fmt") 4 | 5 | func myFunc(i int) { 6 | switch i { 7 | case 1: 8 | first() 9 | case 2: 10 | second() 11 | case 3: 12 | third() 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/variables_extended/java/ExternalClass.java: -------------------------------------------------------------------------------- 1 | package variables_extended; 2 | 3 | public class ExternalClass { 4 | public String varName = "external_instance_field"; 5 | public static String staticVarName = "external_static_field"; 6 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/fence.ll: -------------------------------------------------------------------------------- 1 | @a = global i32 8 2 | 3 | define i32 @main() { ; i32()* 4 | fence acquire 5 | %locA = load i32, i32* @a 6 | 7 | fence syncscope("scope") seq_cst 8 | %locA2 = load i32, i32* @a 9 | 10 | ret i32 1 11 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/floatingpoint_const.ll: -------------------------------------------------------------------------------- 1 | ; declare i32 constant @x 2 | @x = private constant half 1.25 3 | 4 | ; Definition of main function 5 | define half @main() { ; half()* 6 | %a = fadd half 1.25, 1.0 7 | 8 | ret half %a 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/issue598.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | prepare() 3 | genCpg() 4 | exportToJson() 5 | 6 | while True: 7 | x = 1 8 | if x == 2: 9 | print(x) 10 | else: 11 | break 12 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_delete.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | with open('example.txt', 'r') as file: 4 | content = file.read() 5 | 6 | os.remove('example.txt') 7 | 8 | with open('example.txt', 'w') as file: 9 | file.write(content) 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/goto.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | label: 5 | goto label; 6 | } 7 | 8 | void func(int a){ 9 | goto label; 10 | switch(a){ 11 | label: case 0: 12 | default: 13 | goto label; 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/compile_commands_simple.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "/usr/bin/gcc -c main_simple.c -o main_simple", 4 | "directory": "src/test/resources/cxxCompilationDatabase", 5 | "file": "main_simple.c" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/include.cpp: -------------------------------------------------------------------------------- 1 | #include "include.h" 2 | #include "another-include.h" 3 | 4 | int main() { 5 | SomeClass* c = new SomeClass(); 6 | } 7 | 8 | SomeClass::SomeClass() { 9 | } 10 | 11 | int SomeClass::DoSomething() { return someField; } 12 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/ForEach.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | class ForEach { 4 | public void forIterator() { 5 | int[] a = {1,2,3,4,5}; 6 | for(int j : a) { 7 | System.out.println(j); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/types/B.java: -------------------------------------------------------------------------------- 1 | public class B { 2 | public static void main(String[] args) { 3 | // Test recordDeclaration relationship 4 | // Test propagation of specifiers in fields 5 | static final A a = new A(5); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/tempOrNot2.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | if foo(): 5 | tmp = os.path.join(tempfile.gettempdir(), "foo") 6 | else: 7 | tmp = '/not/a/tmp/file' 8 | 9 | file = open(tmp, "w") 10 | file.write("bar") 11 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/write_before_chmod.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | if __name__ == '__main__': 4 | file = "/tmp/foo.txt" 5 | fh = open(file, "w+") 6 | fh.write("Writing to the file before chmod ain't a good idea...") 7 | os.chmod(file, 0o600) -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/constructors/implicitcastarg/constructorImplicit.cpp: -------------------------------------------------------------------------------- 1 | class I { 2 | public: 3 | I(int x) {} 4 | }; 5 | 6 | class H { 7 | public: 8 | H(int x, int y=10) {} 9 | }; 10 | 11 | int main() { 12 | I i1(1.0); 13 | H h1 (2.0); 14 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/typedef_struct.cpp: -------------------------------------------------------------------------------- 1 | typedef struct test { 2 | int a; 3 | int b; 4 | } S; 5 | 6 | int structs() { 7 | S s; 8 | S t; 9 | S* p=&s; 10 | s.a=1; 11 | s.b=2; 12 | printf("%d %d\n", s.a, s.b); 13 | } 14 | 15 | long typedef bla; -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/values.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "net/url" 4 | 5 | func main() { 6 | name := "firstname lastname" 7 | data := "data" 8 | 9 | message := url.Values{ 10 | "Name": []string{name}, 11 | "Data": []string{data}, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/calls/SuperClass.java: -------------------------------------------------------------------------------- 1 | public class SuperClass { 2 | public void superTarget() {} 3 | public void superTarget(int param1, int param2) {} 4 | public void superTarget(int param1, String param2) {} 5 | 6 | public void overridingTarget() {} 7 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/Variables.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | class Processor { 4 | 5 | private int field; 6 | 7 | int process(int input) { 8 | int local = 1; 9 | 10 | local += input; 11 | 12 | return field + local; 13 | } 14 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/array_dfg.py: -------------------------------------------------------------------------------- 1 | def function(): 2 | d = [ 3 | "b", 4 | "d", 5 | "f" 6 | ] 7 | 8 | # Test DFGs for array accesses 9 | d[1] = 10 10 | print(d[1]) 11 | print(d[0]) 12 | print(d) 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/if.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int i = 0; 5 | printf("\n"); 6 | if(i < 1) 7 | i = 1; 8 | printf("\n"); 9 | if(i >= 0) 10 | i = 0; 11 | else 12 | i = 1; 13 | printf("\n"); 14 | return i; 15 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cpp-this-field.cpp: -------------------------------------------------------------------------------- 1 | class T { 2 | int i=0; 3 | int foo() { 4 | return this->i; 5 | } 6 | }; 7 | 8 | struct S { 9 | int i=0; 10 | int foo() { 11 | return this->i; 12 | } 13 | }; 14 | 15 | int main() { 16 | T t; 17 | S s; 18 | } 19 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/compile_commands_arch.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "/usr/bin/clang -arch arm64 -c main_arm64.c -o main_arm64", 4 | "directory": "src/test/resources/cxxCompilationDatabase", 5 | "file": "main_arm64.c" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/importalias.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import ( 4 | fmtother "fmt" 5 | ) 6 | 7 | type formatter struct { 8 | field int 9 | } 10 | 11 | func main() { 12 | fmt := formatter{} 13 | fmt.field = 1 14 | 15 | fmtother.Printf("%d", 1) 16 | } 17 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/LargeNegativeNumber.java: -------------------------------------------------------------------------------- 1 | public class LargeNegativeNumber { 2 | public static void main(String[] args) { 3 | int a = -1; 4 | int b = -2147483648; 5 | long c = -9223372036854775808L; 6 | long d = -9223372036854775807L; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/enums/EnumsImport.java: -------------------------------------------------------------------------------- 1 | package compiling.enums; 2 | 3 | public class EnumsImport { 4 | 5 | public static final int CONSTANT = 39; 6 | 7 | public static int getConstant() { 8 | return CONSTANT; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /cpg-neo4j/src/integrationTest/resources/Implementor1.java: -------------------------------------------------------------------------------- 1 | public class Implementor1 { 2 | 3 | private final static int i = 6; 4 | 5 | public static void main( String... args ) { 6 | final int j; 7 | j = 14; 8 | System.out.println(j); 9 | } 10 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/memory/loading.py: -------------------------------------------------------------------------------- 1 | import loader 2 | 3 | # simulate a loader. It will load the module "simple" and return an "SimpleImplClass" object 4 | bar = loader.Loader("simple").impl 5 | 6 | # bar should now be of type "SimpleImplClass" 7 | bar.foo() 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/switch_eog.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a = 0; 6 | 7 | switch (a) 8 | { 9 | case 1: 10 | return 0; 11 | // default: 12 | } 13 | 14 | // the EOG should follow here as well 15 | printf("%d\n", a); 16 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/loops.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int i = 10; 5 | printf("\n"); 6 | while(i>0) 7 | { 8 | i--; 9 | } 10 | printf("\n"); 11 | do 12 | { 13 | i++; 14 | } 15 | while(i < 10); 16 | printf("\n"); 17 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/complex_resolution/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | type Length int64 4 | 5 | func (l Length) Centimeter() int64 { 6 | return int64(l) 7 | } 8 | 9 | const ( 10 | Centimeter Length = 1 11 | Meter = 100 * Centimeter 12 | ) 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/variables_extended/cpp/external_class.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | using namespace std; 3 | static string staticVarName; 4 | 5 | class ExternalClass { 6 | public: 7 | string varName; 8 | static string staticVarName; 9 | 10 | ExternalClass(); 11 | }; -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/dict_dfg.py: -------------------------------------------------------------------------------- 1 | def function(): 2 | d = { 3 | "a": "b", 4 | "c": "d", 5 | "e": "f" 6 | } 7 | 8 | # Test DFGs for dict accesses 9 | d['b'] = 1 10 | print(d['b']) 11 | print(d['a']) 12 | print(d) 13 | -------------------------------------------------------------------------------- /docs/docs/CPG/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Documentation" 3 | linkTitle: "Documentation" 4 | weight: 20 5 | no_list: true 6 | menu: 7 | main: 8 | weight: 20 9 | description: > 10 | The CPG library is a language-agnostic graph representation of source code. 11 | --- 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/FieldAccess.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | public class FieldAccess { 4 | 5 | private int[] array; 6 | 7 | public static void main(String[] args) { 8 | FieldAccess f = new FieldAccess(); 9 | int l = f.array.length; 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/foobar.py: -------------------------------------------------------------------------------- 1 | def foo(a): 2 | return a+1 3 | 4 | def bar(): 5 | return foo(42) 6 | 7 | 8 | class Foobar: 9 | def bar(self): 10 | return self.foo(41, 1) 11 | 12 | @staticmethod 13 | def foo(a, b): 14 | return a+b 15 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/function.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | bar("some string", s2="another_string") 3 | 4 | 5 | def bar(s: str, s2: str): 6 | print("bar(s) here: ", s) 7 | a = 1 + 2 8 | s3 = baz() 9 | return 10 | 11 | def baz() -> str: 12 | return "foobar" 13 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/index.ts: -------------------------------------------------------------------------------- 1 | // Re-export all component categories for easy importing 2 | export * from './analysis'; 3 | export * from './dashboard'; 4 | export * from './forms'; 5 | export * from './navigation'; 6 | export * from './requirements'; 7 | export * from './ui'; 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/inference.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int somethingGlobal = 0; 4 | 5 | namespace constants { 6 | double pi = std::numbers::pi; 7 | } 8 | 9 | namespace util { 10 | class SomeClass { 11 | public: 12 | void doSomething() {}; 13 | }; 14 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/cfg/ShortCircuit.java: -------------------------------------------------------------------------------- 1 | package cfg; 2 | 3 | public class Loops { 4 | 5 | public static void main(String[] args) { 6 | boolean containsArg = args.length > 0 && args[0].equals("SomeArg"); 7 | boolean empty = args == null || args.length == 0; 8 | } 9 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ExplicitConstructorInvocationStmt.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class ConstructorCallExpressionStmt { 4 | 5 | public ConstructorCallExpressionStmt(){ 6 | super(); 7 | } 8 | 9 | public static void main(String[] args){ 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/tempfile_bad_gettmpdir.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | tmp = os.path.join(tempfile.gettempdir(), "foo") 5 | if not os.path.exists(tmp): 6 | with open(tmp, "w") as file: 7 | file.write("bar") 8 | else: 9 | pass # handle this 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/parent_inference.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | namespace ABC { 3 | struct A { 4 | A(); 5 | void foo(); 6 | }; 7 | } 8 | */ 9 | 10 | struct A : ABC::A { 11 | A() { 12 | foo(); 13 | bar(); 14 | } 15 | void bar() { 16 | 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/variables_extended/cpp/external_class.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "external_class.h" 3 | using namespace std; 4 | 5 | ExternalClass::ExternalClass(){ 6 | varName = "external_instance_field"; 7 | } 8 | 9 | string ExternalClass::staticVarName = "external_static_field"; -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/type_constraints.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | type MyStruct[T any] struct{} 4 | type MyInterface interface{} 5 | 6 | func SomeFunc[T any, S MyInterface]() {} 7 | 8 | func main() { 9 | _ := &MyStruct[MyInterface]{} 10 | SomeFunc[interface{}, MyInterface]() 11 | } 12 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/multistep/Level2.java: -------------------------------------------------------------------------------- 1 | package multistep; 2 | 3 | public class Level2 extends Level1 { 4 | 5 | public int getField2() { 6 | return field; 7 | } 8 | 9 | public int calculate() { 10 | return getNumber() + 1; 11 | } 12 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ForEachStmt.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.List; 3 | 4 | class ForEachStmt { 5 | public static void main(String[] args) { 6 | List ls = Arrays.asList(args); 7 | for (String s : ls) System.out.println(s); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/delete.py: -------------------------------------------------------------------------------- 1 | a = 5 2 | b = a 3 | del a 4 | 5 | my_list = [1, 2, 3] 6 | del my_list[2] 7 | 8 | my_dict = {'a': 1, 'b': 2} 9 | del my_dict['b'] 10 | 11 | class MyClass: 12 | def __init__(self): 13 | self.d = 1 14 | 15 | obj = MyClass() 16 | del obj.d -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | cout << "bla"; 5 | cout << "blubb"; 6 | if(true) { 7 | cout << "zonk"; 8 | return 1; 9 | } else { 10 | { 11 | cout << "zink"; 12 | return 2; 13 | } 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/components/trystmt.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | try { 3 | some_dangerous_operation(); 4 | } catch(const std::exception& e) { 5 | // named exception 6 | } catch(const std::exception&) { 7 | // unnamed exception 8 | } catch(...) { 9 | // catch all 10 | } 11 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply () 6 | { 7 | return 8 * N; 8 | } 9 | 10 | int main() { 11 | std::cout << fixed_multiply<>() << '\n'; 12 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/eval.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | func main() { 8 | x := "G" 9 | y := "T" 10 | z := "P" 11 | 12 | var f string 13 | if len(os.Args) == 2 { 14 | f = x + y + z 15 | } else { 16 | f = x + z + y 17 | } 18 | 19 | _ = f 20 | } 21 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/NameExpression.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | class NameExpression { 3 | private static String TEST = "test"; 4 | 5 | private static String TEST2 = NameExpression.TEST; 6 | 7 | public NameExpression() { 8 | String test3 = NameExpression.TEST2; 9 | } 10 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/exceptions/ExceptionTest.java: -------------------------------------------------------------------------------- 1 | public class ExceptionTest { 2 | public static void main(String[] args) { 3 | try { 4 | throw new IllegalArgumentException(); 5 | } catch(Exception e) { 6 | System.out.println("Oops"); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/methods/mypackage/Main.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | var adder = new Adder(); 7 | var sum = adder.add(1, 2); 8 | 9 | System.out.println(sum); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/modules/a.py: -------------------------------------------------------------------------------- 1 | def func(): 2 | print("I am func of a") 3 | return 4 | 5 | 6 | def other_func(): 7 | print("I am other_func of a") 8 | return 9 | 10 | 11 | class Foobar: 12 | def bar(self): 13 | pass 14 | 15 | 16 | foobar = Foobar() 17 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/declstmt.cpp: -------------------------------------------------------------------------------- 1 | //#include 2 | 3 | int main() { 4 | SSL_CTX* ptr; 5 | 6 | int a = 1; 7 | int* b,c; 8 | int* d; 9 | 10 | std::string text = "some ""text"; 11 | void* ptr2 = NULL; 12 | 13 | class A { 14 | int myField; 15 | } myA; 16 | } 17 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/CastExpr.java: -------------------------------------------------------------------------------- 1 | package cast; 2 | 3 | public class Cast { 4 | public static void main(String[] args) { 5 | // these classes do not exist but we want to test parsing partial stuff 6 | ExtendedClass e = new ExtendedClass(); 7 | BaseClass b = (BaseClass) e; 8 | } 9 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/LiteralExpr.java: -------------------------------------------------------------------------------- 1 | class LiteralExpr { 2 | public static void main(String[] args) { 3 | int i = 1; 4 | String s = "string"; 5 | boolean b = true; 6 | char c = '0'; 7 | double d = 1.0; 8 | long l = 1L; 9 | Object o = null; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/construct.cpp: -------------------------------------------------------------------------------- 1 | // The headers are just there to make it compile with clang, but we will not parse headers. 2 | // You can use `clang++ -std=c++20 tricky_inference.cpp` to check, if it will compile. 3 | #include "construct.h" 4 | 5 | Pair doPair() { 6 | return Pair(1, 0); 7 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/calls/External.java: -------------------------------------------------------------------------------- 1 | public class External extends SuperClass { 2 | 3 | public void externalTarget() {} 4 | public void externalTarget(int param1, int param2) {} 5 | public void externalTarget(int param1, String param2) {} 6 | 7 | @Override 8 | public void overridingTarget() {} 9 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/alloca.ll: -------------------------------------------------------------------------------- 1 | define i32 @main() { ; i32()* 2 | %ptr = alloca i32 ; yields i32*:ptr 3 | store i32 3, i32* %ptr ; yields void 4 | %val = load i32, i32* %ptr ; yields i32:val = i32 3 5 | ret i32 0 6 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/examples/retdec/main.ll: -------------------------------------------------------------------------------- 1 | source_filename = "test" 2 | target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" 3 | 4 | define i64 @main(i64 %argc, i8** %argv) local_unnamed_addr { 5 | dec_label_pc_100003f9c: 6 | ret i64 1, !insn.addr !0 7 | } 8 | 9 | !0 = !{i64 4294983604} 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | target 3 | .gradle 4 | build 5 | .settings 6 | .project 7 | .classpath 8 | .idea 9 | bin 10 | *.pyc 11 | *.pickle 12 | log 13 | .volumes 14 | out 15 | .data/ 16 | logs 17 | /lsp/*.log 18 | 19 | *.dylib 20 | *.so 21 | *.log 22 | 23 | gradle.properties 24 | LibrariesTest.kt 25 | findings.json 26 | 27 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: "70...95" 3 | status: 4 | project: 5 | default: 6 | target: auto 7 | threshold: 0.5% 8 | patch: 9 | default: 10 | target: 75% 11 | comment: 12 | layout: "condensed_header, files, condensed_footer" 13 | ignore: 14 | - "**/ontology/**" 15 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/comments.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Documentation comment 3 | */ 4 | void functionDoc() { 5 | return; 6 | } 7 | 8 | /* 9 | * Multi-line 10 | * comment 11 | */ 12 | void functionMultiline() { 13 | return; 14 | } 15 | 16 | // Simple comment 17 | 18 | void functionSimple() { 19 | return; 20 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/Issue285.java: -------------------------------------------------------------------------------- 1 | public class Issue285 { 2 | void doSomething() { 3 | System.out.println("test"); 4 | 5 | var request = target.path("/").get(); 6 | 7 | Issue285.doSomethingStatic(); 8 | } 9 | 10 | static void doSomethingStatic() { 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/nested_functions.py: -------------------------------------------------------------------------------- 1 | def level1(): 2 | c = 1 3 | def level2(): 4 | d = 1 5 | def level3(): 6 | nonlocal c, d 7 | c = c + 2 8 | d = d + 1 9 | print(c) 10 | 11 | level3() 12 | level2() 13 | level1() -------------------------------------------------------------------------------- /docs/docs/API/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "API Reference" 3 | no_list: true 4 | weight: 2 5 | --- 6 | 7 | 8 | # API Reference 9 | 10 | We auto-generate an API reference using [dokka](https://github.com/Kotlin/dokka). The following versions are available: 11 | 12 | * [main](../dokka/main/) 13 | * [v7.0.1](../dokka/v7.0.1/) 14 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/c/winmain/load.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int WinMain( 5 | HINSTANCE hInstance, 6 | HINSTANCE hPrevInstance, 7 | LPSTR lpCmdLine, 8 | int nCmdShow 9 | ) { 10 | HMODULE lib = LoadLibraryA("winexample.dll"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/types/fptr_type.cpp: -------------------------------------------------------------------------------- 1 | void ((*global_no_param_void))(void); 2 | void (*global_no_param)(); 3 | void ((*global_one_param)(int)); 4 | int (*global_two_param)(int, unsigned long); 5 | 6 | int main() { 7 | void ((*local_one_param)(int)); 8 | int (*local_two_param)(int, unsigned long); 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/chained/chained.go: -------------------------------------------------------------------------------- 1 | package chained 2 | 3 | type Type interface { 4 | Elem() Type 5 | } 6 | 7 | func TypeOf(i any) Type { 8 | return nil 9 | } 10 | 11 | type MyStruct interface{} 12 | 13 | var ( 14 | structType = TypeOf((*MyStruct)(nil)).Elem() 15 | _ = structType 16 | ) 17 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ClassOrInterfaceDeclaration.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class ClassOrInterfaceDeclaration { 4 | 5 | int a; 6 | 7 | class B extends ClassOrInterfaceDeclaration{ 8 | public B(){super.a = 5;} 9 | } 10 | 11 | public static void main(String[] args){ 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/forloop.py: -------------------------------------------------------------------------------- 1 | def forloop(): 2 | varDefinedBeforeLoop = 1 3 | 4 | for varDefinedBeforeLoop in range(varDefinedBeforeLoop): 5 | pass 6 | 7 | for varDefinedInLoop in range(42): 8 | pass 9 | 10 | foo(varDefinedBeforeLoop) 11 | bar(varDefinedInLoop) 12 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/field.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "otherPackage" 4 | 5 | type Receiver struct { 6 | Field int 7 | } 8 | 9 | // For now this must be specified AFTER our type declaration, because otherwise we wont find it 10 | func (r Receiver) myFunc() { 11 | r.Field = otherPackage.OtherField 12 | } 13 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file_mkstemp_mkdtemp.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | fd, path = tempfile.mkstemp() 5 | 6 | tmp = os.fdopen(fd, 'w') 7 | tmp.write('stuff') 8 | 9 | 10 | path = os.path.join(tempfile.mkdtemp(), 'foobarbaz') 11 | 12 | tmp = open(path, "w") 13 | tmp.write("hello world!") 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/alias_loop.cpp: -------------------------------------------------------------------------------- 1 | namespace ABC { 2 | struct A {}; 3 | } 4 | 5 | namespace ABC { 6 | // not sure why this is even possible, but somehow we can define this 7 | // type as itself in this partial namespace 8 | using A = ABC::A; 9 | 10 | void test() { 11 | A a; 12 | } 13 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/binaryoperator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int a; 5 | int b; 6 | 7 | a = b * 2; 8 | a = 1 * 1; 9 | 10 | std::string* notMultiplication = 0 * 0; // just to check if the parser correctly deduces that this is a variable decl with a pointer 11 | 12 | a = 2 >> 2; 13 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_multiply(10.0) << '\n'; 13 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_multiply<>(10.3) << '\n'; 13 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang-modules/cmd/awesome/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "example.io/awesome" 5 | "example.io/awesome/util" 6 | ) 7 | 8 | func main() { 9 | a := awesome.NewAwesome() 10 | 11 | util.DoSomethingWith(a) 12 | util.DoSomethingElse() // this function is part of a file we do not have 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/call.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | func main() { 4 | c := NewMyStruct() 5 | if i := len("a"); i < 1 { 6 | c.myOtherFunc(i) 7 | } 8 | 9 | go c.MyFunc() 10 | 11 | // In Go, numeric literals can be used as any numeric type 12 | sixtyfour(1) 13 | } 14 | 15 | func sixtyfour(i int64) { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation6.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_multiply(20.3) << '\n'; 13 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/cfg/Loops.java: -------------------------------------------------------------------------------- 1 | package cfg; 2 | 3 | public class Loops { 4 | 5 | public static void main(String[] args) { 6 | int i = 10; 7 | System.out.println(); 8 | while(i>0){ 9 | i--; 10 | } 11 | System.out.println(); 12 | do{ 13 | i++; 14 | }while(i < 10); 15 | System.out.println(); 16 | } 17 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/java/staticImports/single/B.java: -------------------------------------------------------------------------------- 1 | package single; 2 | 3 | import static single.A.test; 4 | import single.A.C; 5 | 6 | public class B { 7 | 8 | public static void main(String[] args) { 9 | test(); 10 | int y = test; // single import can retrieve multiple things 11 | 12 | A.C c; 13 | } 14 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/issue432.py: -------------------------------------------------------------------------------- 1 | class counter: 2 | pass 3 | 4 | 5 | def count(c): 6 | if c.inc() < 5: 7 | count(c) 8 | 9 | 10 | class c1(counter): 11 | total = 0 12 | 13 | def inc(self): 14 | self.total = self.total + 1 15 | return self.total 16 | 17 | 18 | count(c1()) 19 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/attributes.cpp: -------------------------------------------------------------------------------- 1 | [[function_attribute()]] 2 | int main() { 3 | } 4 | 5 | [[record_attribute()]] 6 | class SomeClass { 7 | [[property_attribute("a", main, 2)]] 8 | int a; 9 | 10 | // defined by a macro set by the test 11 | PROPERTY_ATTRIBUTE(SomeCategory, SomeOtherThing) 12 | int b; 13 | }; 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/constructors/defaultarg/constructorDefault.cpp: -------------------------------------------------------------------------------- 1 | class D { 2 | public: 3 | D(int x=0, int y=1) {} 4 | }; 5 | 6 | class E { 7 | public: 8 | E(int x, int y=10) {} 9 | }; 10 | 11 | int main() { 12 | D d1; 13 | D d2(2); 14 | D d3(3,4); 15 | 16 | E e1; 17 | E e2(5); 18 | E e3(6,7); 19 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_multiply(20.5) << '\n'; 13 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/LambdaExpr.java: -------------------------------------------------------------------------------- 1 | class Test { 2 | interface A {void a(String s, String t);} 3 | 4 | interface B {int b(int c);} 5 | 6 | public static void main(String[] args){ 7 | A a = (s,t) -> System.out.println(s + " "+ t); 8 | B b = (c)->{ 9 | int ret = c*2; 10 | return ret + 3; 11 | }; 12 | } 13 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/eog/EOG.java: -------------------------------------------------------------------------------- 1 | public class EOG { 2 | void fun(){ 3 | int a = 1; 4 | int b = 2; 5 | int x = 0; 6 | if (a > 0) { 7 | b--; 8 | } else if(a < -2) { 9 | b++; 10 | } else { 11 | x++; 12 | } 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | # Output 4 | .output 5 | .vercel 6 | .netlify 7 | .wrangler 8 | /.svelte-kit 9 | /build 10 | 11 | # OS 12 | .DS_Store 13 | Thumbs.db 14 | 15 | # Env 16 | .env 17 | .env.* 18 | !.env.example 19 | !.env.test 20 | 21 | # Vite 22 | vite.config.js.timestamp-* 23 | vite.config.ts.timestamp-* 24 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/implicitcast/ambiguouscall.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int ambiguous_multiply (int val) 5 | { 6 | return val * 3; 7 | } 8 | 9 | int ambiguous_multiply (float val) { 10 | return val * 5; 11 | } 12 | 13 | int main() { 14 | std::cout << ambiguous_multiply(10.0) << '\n'; 15 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/symbols.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // just to explain the macros, they will not be defined here but in the configuration of the translation manager 4 | //#define HELLO_WORLD "Hello World" 5 | //#define INCREASE(X) X+1 6 | 7 | int main() { 8 | std::cout << HELLO_WORLD; 9 | std::cout << INCREASE(2); 10 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/loopscfg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int i = 10; 5 | printf("\n"); 6 | { 7 | printf("Compound"); 8 | printf("Compound"); 9 | } 10 | while(i>0) 11 | { 12 | i--; 13 | } 14 | printf("\n"); 15 | do 16 | { 17 | i++; 18 | } 19 | while(i < 10); 20 | printf("\n"); 21 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/outside_class_definition.cpp: -------------------------------------------------------------------------------- 1 | namespace my { 2 | class MainClass { 3 | class SubClass { 4 | void doSomething(); 5 | 6 | int field; 7 | }; 8 | }; 9 | 10 | void MainClass::SubClass::doSomething() { 11 | // do something 12 | field = 1; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/compile_commands_commands.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "/usr/bin/gcc -c -I includes_1 -Iincludes_2 -Isys_includes/ -DFOO=1 -D BAR=2 -DINFO=\"hi\" -DDEBUG=1 main.c -o main", 4 | "directory": "src/test/resources/cxxCompilationDatabase", 5 | "file": "main.c", 6 | "output": "main" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/postfixexpression.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int a) { 5 | printf("text"); // function call 6 | 7 | a++; // unary operation 8 | a--; // unary operation 9 | 10 | std::string test = "a"; // just here to make it compile in clang 11 | 12 | test.c_str(); // member call 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class Array 6 | { 7 | private: 8 | T m_Array[N]; 9 | public: 10 | int GetSize() const { return N; } 11 | 12 | }; 13 | 14 | 15 | int main() 16 | { 17 | Array array; 18 | array.GetSize(); 19 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/MethodReferenceExpr.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | class MethodReferenceExpr { 4 | 5 | public static String something(String s){return s + s;} 6 | 7 | public static void main(String[] args){ 8 | Arrays.stream(args).map(MethodReferenceExpr::something).forEach(s -> System.out.println(s)); 9 | } 10 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/fields/mypackage/Fields.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class Fields { 4 | 5 | private int a = 2; 6 | 7 | Fields() { 8 | resetA(); 9 | } 10 | 11 | public void setA(int a) { 12 | this.a = a; 13 | } 14 | 15 | private void resetA() { 16 | setA(10); 17 | } 18 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/array2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class Array 6 | { 7 | private: 8 | T m_Array[N]; 9 | public: 10 | int GetSize() const { return N; } 11 | 12 | }; 13 | 14 | 15 | int main() 16 | { 17 | Array* array = new Array; 18 | } 19 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/pair3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | struct Pair 6 | { 7 | Type1 first; 8 | Type2 second; 9 | }; 10 | 11 | int main() 12 | { 13 | Pair point1; 14 | 15 | //point1.first = 10; 16 | //point1.second = 20; 17 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/types/type.cpp: -------------------------------------------------------------------------------- 1 | int main(){ 2 | // Test unknown 3 | auto unknown; 4 | 5 | // Test type propagation 6 | auto propagated = 0; 7 | 8 | int regularInt = 0; 9 | 10 | // Test ReferenceType chain 11 | int& ref = regularInt; 12 | 13 | // Test PointerType chain 14 | int* ptr = ®ularInt; 15 | 16 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/Arrays.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | public class Arrays { 4 | 5 | public static void main(String[] args) { 6 | int[] a = new int[] {1}; 7 | int b = a[0]; 8 | 9 | int[][] emptyMatrix = new int[1][2]; 10 | 11 | int[][] matrix = new int[][] {new int[] {1, 2}, new int[] {3, 4}}; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/arrays.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int x[] = { 1, 2, 3 }; 3 | 4 | x[0]; // yes this will produce a warning but is still valid and easier to parse for the test 5 | 6 | char (*a)[4]; // this is a pointer to an array of 4 chars. The type is char (*)[4] 7 | char* b[4]; // this is an array of 4 pointers to a char. The type is char *[4] 8 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "header_1.h" 5 | #include "header_2.h" 6 | #include 7 | 8 | int main() { 9 | #ifdef DEBUG 10 | printf("%s\n", INFO); 11 | #endif 12 | func1(); 13 | func2(); 14 | sys_func(); 15 | FOO; 16 | BAR; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/slices.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | a := []int{1,2,3} 7 | 8 | // [1] 9 | b := a[:1] 10 | 11 | // [2, 3] 12 | c := a[1:] 13 | 14 | // [1] 15 | d := a[0:1] 16 | 17 | // [1] 18 | e := a[0:1:1] 19 | 20 | fmt.Printf("%v %v %v %v %v", a, b, c, d, e) 21 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/app.css: -------------------------------------------------------------------------------- 1 | @import 'tailwindcss'; 2 | @plugin '@tailwindcss/forms'; 3 | @plugin '@tailwindcss/typography'; 4 | 5 | @theme { 6 | --font-sans: InterVariable, sans-serif; 7 | --font-mono: 'Noto Sans Mono', monospace; 8 | --font-sans--font-feature-settings: 'cv11', 'ss01'; 9 | --font-sans--font-variation-settings: 'opsz' 24; 10 | } 11 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import tailwindcss from '@tailwindcss/vite'; 3 | import { defineConfig } from 'vite'; 4 | 5 | export default defineConfig({ 6 | plugins: [tailwindcss(), sveltekit()], 7 | server: { 8 | proxy: { 9 | '/api': 'http://localhost:8080' 10 | } 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/CastConvert.java: -------------------------------------------------------------------------------- 1 | class CastConvert { 2 | 3 | private class A{} 4 | 5 | private class B extends A{} 6 | 7 | private class C extends A{} 8 | 9 | public static void main(String[] args){ 10 | A a; 11 | if(args > 0) 12 | a = new B(); 13 | else 14 | a = new C(); 15 | int i = 10.1; 16 | double j = 3; 17 | } 18 | } -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/BaseClass.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class BaseClass { 4 | 5 | public int getMyProperty() { 6 | return myProperty; 7 | } 8 | 9 | public void setMyProperty(int myProperty) { 10 | this.myProperty = myProperty; 11 | } 12 | 13 | protected int myProperty = 5; 14 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/examples/retdec/if.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | int a = rand(); 6 | int b; 7 | 8 | if(a == 1) { 9 | printf("it was 1!\n"); 10 | b = 10; 11 | } else { 12 | printf("it was something else"); 13 | b = 20; 14 | } 15 | 16 | return b; 17 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/global_local_var.ll: -------------------------------------------------------------------------------- 1 | ; External declaration of the rand function 2 | declare i32 @rand() nounwind 3 | @a = global i32 8 4 | @x = constant i32 10 5 | 6 | define i32 @main() { ; i32()* 7 | %a = call i32 @rand() 8 | %locX = load i32, i32* @x 9 | %locA = load i32, i32* @a 10 | %b = add i32 %a, %locA 11 | 12 | ret i32 %b 13 | } -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/function.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Block comment on a function 3 | */ 4 | function someFunction(): number { 5 | // Comment on a variable 6 | const i = someOtherFunction("hello"); 7 | 8 | return i; 9 | } 10 | 11 | // Comment on a Function 12 | function someOtherFunction(s: string): number { 13 | return s.length; 14 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/cxxprioresolution/scopedResolutionWithDefaults.cpp: -------------------------------------------------------------------------------- 1 | void f(int, int); 2 | void f(int, int = 7); 3 | void h() { 4 | f(3); // OK calls f(3,7); 5 | } 6 | void m() { 7 | void f(int, int); 8 | f(8); // Error 9 | void f(int, int = 5); 10 | f(4); // OK calls f(4,5); 11 | } 12 | void n() { 13 | f(6); // OK call f(6,7); 14 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/pair3-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | struct Pair 6 | { 7 | Type1 first; 8 | Type2 second; 9 | }; 10 | 11 | int main() 12 | { 13 | Pair point1; 14 | 15 | point1.first = 10; 16 | point1.second = 20; 17 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://svelte.dev/docs/kit/types#app.d.ts 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface PageState {} 9 | // interface Platform {} 10 | } 11 | } 12 | 13 | export {}; 14 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/components/ForStmt.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.List; 3 | 4 | class ForEachStmt { 5 | public static void main(String[] args) { 6 | List ls = Arrays.asList(args); 7 | int i, j = 0; 8 | 9 | for (i = 1, j = 1; i < ls.size(); i++) { 10 | System.out.println(ls.get(i)); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/nonlocal.py: -------------------------------------------------------------------------------- 1 | def outer_function(): 2 | c = 1 3 | 4 | def nonlocal_write(): 5 | nonlocal c 6 | c = 2 7 | print(c) 8 | 9 | def nonlocal_read(): 10 | print(c) 11 | 12 | def local_write(): 13 | c = 2 14 | print(c) 15 | 16 | def nonlocal_error(): 17 | c = c + 1 18 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/variable_inference.py: -------------------------------------------------------------------------------- 1 | class SomeClass: 2 | def method(self, a): 3 | self.x = a 4 | b = a 5 | return b 6 | 7 | class SomeClass2: 8 | @staticmethod 9 | def static_method(a): 10 | x = a 11 | b = x 12 | return b 13 | 14 | def foo(fooA, b): 15 | fooA = bar(fooA) 16 | return fooA -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/pair3-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | struct Pair 6 | { 7 | Type1 first; 8 | Type2 second; 9 | }; 10 | 11 | int main() 12 | { 13 | Pair point1; 14 | 15 | //point1.first = 10; 16 | //point1.second = 20; 17 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/navigation/Navbar.svelte: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file-concept-signature.yaml: -------------------------------------------------------------------------------- 1 | concepts: 2 | - concept: 3 | name: "de.fraunhofer.aisec.cpg.graph.concepts.file.File" 4 | constructorArguments: 5 | - name: "fileName" 6 | value: "foo" 7 | dfg: 8 | fromThisNodeToConcept: false 9 | fromConceptToThisNode: true 10 | signature: 11 | fqn: "open" -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/logging/log_eog_check.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | """ 4 | This code requires the `getLogger` call to be handled first before the `logger.info` call in order to have correct logger resolution. See https://github.com/Fraunhofer-AISEC/cpg/issues/2479 5 | """ 6 | 7 | logger = logging.getLogger("my_logger") 8 | 9 | def foo(): 10 | logger.error("ERROR") -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/foo.cpp: -------------------------------------------------------------------------------- 1 | class A { 2 | public: 3 | void foo(int a); 4 | }; 5 | 6 | class B { 7 | public: 8 | void foo(int a); 9 | }; 10 | 11 | void B::foo(int a) { 12 | } 13 | 14 | int main() { 15 | A a; 16 | B b; 17 | 18 | a.foo(1); 19 | b.foo(2); 20 | 21 | foo(); 22 | 23 | C c; 24 | c.foo(3); 25 | } 26 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplate.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_multiply(10) << '\n'; 13 | std::cout << fixed_multiply((float) 10.0) << '\n'; 14 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/OuterClass.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | public class OuterClass { 4 | String a = "test"; 5 | 6 | public class InnerClass { 7 | 8 | public class EvenMoreInnerClass { 9 | 10 | String b; 11 | 12 | void doSomething() { 13 | b = OuterClass.this.a; 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/dfg_type.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | def bar(self): 3 | return Bar() 4 | 5 | 6 | class Bar: 7 | def baz(self): 8 | if True: 9 | return "bar" 10 | else: 11 | return 2 12 | 13 | 14 | my = Foo() # "my" is of type Foo 15 | bar = my.bar() # "bar" is of type Bar 16 | a = bar.baz() # "a" is of type str | int 17 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/symbol_resolver_fail.c: -------------------------------------------------------------------------------- 1 | // this macro contains two literals. Because this is a macro, both 2 | // literals will contain the same location and thus, the same hash-code. 3 | // this confuses the EOG walker 4 | #define SOME_MACRO (1u<<1) 5 | 6 | int symbol_resolver_fail() 7 | { 8 | char *address; 9 | if (SOME_MACRO) { 10 | do_call(address); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/forloop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | printf("\n"); 5 | for(int i = 0; bool b = true; i++){ 6 | b = i % 5 == 0; 7 | } 8 | printf("\n"); 9 | for(int i = 0, j = 0; i == j; i++); 10 | printf("\n"); 11 | int k, l; 12 | printf("\n"); 13 | for(k = 0, l = 0; k == l; k++, l++); 14 | printf("\n"); 15 | int a = (k+1, k+l); 16 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/literals.cpp: -------------------------------------------------------------------------------- 1 | char s[] = "string"; 2 | int i = 1; 3 | float f = 0.2f; 4 | double d = 0.2; 5 | bool b = false; 6 | char c = 'c'; 7 | auto hex = 0xfull; 8 | 9 | // ms is a custom literal suffix (provided by . however, we are not handling this at the moment, so this 10 | // will result in an error 11 | auto duration_ms = 250ms; 12 | auto duration_s = 2.5s; 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation8.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | int main() { 12 | std::cout << fixed_division(10) << '\n'; 13 | std::cout << fixed_division(10.0) << '\n'; 14 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": false, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 100, 6 | "tabWidth": 2, 7 | "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], 8 | "overrides": [ 9 | { 10 | "files": "*.svelte", 11 | "options": { 12 | "parser": "svelte" 13 | } 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/+error.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |
7 | {page.error?.message} 8 |
9 |
10 | Back to Dashboard 11 |
12 |
13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/char_literal.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | char a = 'a'; 5 | char zero = '\0'; 6 | char eight = '\10'; 7 | char max_digits = '\377'; 8 | int hex = '\xff'; 9 | 10 | char newline = '\n'; 11 | 12 | char multi = '\1\2'; // 258 13 | char multi2 = '\1234'; // 21300 14 | 15 | char invalid = '\90'; 16 | char invalid2 = '\90\90'; 17 | } 18 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateMethod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class MyClass { 5 | public: 6 | template 7 | T fixed_multiply (T val) 8 | { 9 | auto x = val * N; 10 | return x; 11 | } 12 | }; 13 | 14 | int main() { 15 | MyClass myObj; 16 | myObj.fixed_multiply(3); 17 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/pair2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class Pair 6 | { 7 | public: 8 | Type1 first; 9 | Type2 second; 10 | int n = N; 11 | }; 12 | 13 | int main() 14 | { 15 | Pair point1; 16 | 17 | point1.first = 10; 18 | point1.second = 20; 19 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | T fixed_multiply (T val) 6 | { 7 | auto x = val * N; 8 | return x; 9 | } 10 | 11 | double fixed_multiply(double val) { 12 | return val*100; 13 | } 14 | 15 | int main() { 16 | std::cout << fixed_multiply(10.0) << '\n'; 17 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/encrypt_with_key_fail.py: -------------------------------------------------------------------------------- 1 | key = get_secret_from_server() 2 | 3 | err = encrypt("Hello World", key, cipher = "AES-256") 4 | if err: 5 | print("Some error occurred") 6 | del key 7 | # We cannot end the EOG without anything because the EOG pass won't generate 8 | # an EOG for a missing else branch if there's nothing happening afterward. 9 | print("Do something") 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/constructors/constructors.cpp: -------------------------------------------------------------------------------- 1 | class A { 2 | public: 3 | A() {} 4 | A(int x) {} 5 | A(int x, int y) {} 6 | }; 7 | 8 | int main() { 9 | A a1; 10 | A a2(5); 11 | A a3(5,6); 12 | A a4 = A(); 13 | A a5 = A(5); 14 | A a6 = A(5, 6); 15 | A* a7 = new A; 16 | A* a8 = new A(); 17 | A* a9 = new A(5); 18 | A* a10 = new A(5, 6); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/function_ptr_or_type_cast.c: -------------------------------------------------------------------------------- 1 | void foo(int i) { 2 | } 3 | 4 | struct S { 5 | int a; 6 | } typedef s_t; 7 | 8 | typedef s_t* s_t_p; 9 | 10 | int main() { 11 | void (*ptr)(int) = &foo; 12 | 13 | // this is a function call 14 | (*ptr)(1); 15 | (ptr)(2); 16 | 17 | // this is a type case 18 | (int)(3); 19 | (s_t_p)(4); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/constructors/Constructors.java: -------------------------------------------------------------------------------- 1 | public class Constructors { 2 | public Constructors() {} 3 | public Constructors(int x) {} 4 | public Constructors(int x, int y) {} 5 | 6 | public int main() { 7 | Constructors a1 = new Constructors(); 8 | Constructors a2 = new Constructors(5); 9 | Constructors a3 = new Constructors(5, 6); 10 | Constructors a4; 11 | } 12 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/implicitcast/implicitCastInMethod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class DemoClass { 5 | private: 6 | int calc(int a) { 7 | return a+3; 8 | } 9 | public: 10 | void doSmth(int x) { 11 | cout << x+calc(2.0) << "\n"; 12 | } 13 | }; 14 | 15 | int main() { 16 | DemoClass demoClass; 17 | demoClass.doSmth(10.0); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/Super.java: -------------------------------------------------------------------------------- 1 | public class Super { 2 | 3 | public int superInt; 4 | 5 | public Super(int superInt) { 6 | this.superInt = superInt; 7 | } 8 | 9 | public int getSuperInt() { 10 | return superInt; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "Super[superInt=" + superInt + "]"; 16 | } 17 | } -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | preferred-citation: 2 | type: article 3 | authors: 4 | - family-names: "Weiss" 5 | given-names: "Konrad" 6 | orcid: "https://orcid.org/0000-0000-0000-0000" 7 | - family-names: "Banse" 8 | given-names: "Christian" 9 | orcid: "https://orcid.org/0000-0000-0000-0000" 10 | doi: "10.48550/arXiv.2203.08424" 11 | title: "A Language-Independent Analysis Platform for Source Code" 12 | year: 2022 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/defaultargs/defaultInMethod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class DemoClass { 5 | private: 6 | int calc(int a, int b=5) { 7 | return a+b; 8 | } 9 | public: 10 | void doSmth(int x=1, int y=2) { 11 | cout << calc(x)+y << "\n"; 12 | } 13 | }; 14 | 15 | int main() { 16 | DemoClass demoClass; 17 | demoClass.doSmth(); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/defer.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | type MyStruct struct{} 9 | 10 | func (s MyStruct) Do() { 11 | i := 1 12 | do() 13 | defer that(i) 14 | 15 | if len(os.Args) == 2 { 16 | i++ 17 | return 18 | } 19 | 20 | i++ 21 | fmt.Println("Still here, yay!") 22 | } 23 | 24 | func do() { 25 | 26 | } 27 | 28 | func that(i int) { 29 | fmt.Println(i) 30 | } 31 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/fix-455/main.cpp: -------------------------------------------------------------------------------- 1 | class Test { 2 | public: 3 | int call(int a) { 4 | return a + 1; 5 | } 6 | }; 7 | 8 | int main() { 9 | int foo = 42; 10 | foo = 3; 11 | Test t; 12 | t.call(foo); 13 | 14 | // note, this is not a construct expression, but a function declaration. 15 | // however this is still just a regular declaration statement and the EOG should continue beyond it 16 | Test t2(); 17 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/include.h: -------------------------------------------------------------------------------- 1 | /** 2 | this header file needs to be larger than include.cpp to check if 3 | 4 | we do not run 5 | 6 | into issues when parsing 7 | 8 | the regions and code 9 | 10 | that is why we are producing some extra content here just to make it larger. 11 | 12 | */ 13 | 14 | class SomeClass { 15 | public: 16 | SomeClass(); 17 | 18 | int DoSomething(); 19 | 20 | private: 21 | int someField; 22 | }; -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/cfg/ForLoop.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.aisec.cpgtest; 2 | 3 | public class ForLoop { 4 | 5 | public static void main(String[] args) { 6 | int n, o = 1; 7 | o = 9; 8 | System.out.println(); 9 | for(n = 0, o = 1; o < 3; o++){ 10 | ; 11 | n = 2*o; 12 | } 13 | System.out.println(); 14 | for(int i = 0, j = 1; i < 2; i++, j++); 15 | System.out.println(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/hierarchy/Sub.java: -------------------------------------------------------------------------------- 1 | public class Sub extends Super { 2 | 3 | public int subInt; 4 | 5 | public Sub() { 6 | this(123); 7 | } 8 | 9 | public Sub(int subInt) { 10 | super(42); 11 | this.subInt = subInt; 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return "Sub[superInt=" + superInt + ", subInt=" + subInt + "]"; 17 | } 18 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/member_dfg.py: -------------------------------------------------------------------------------- 1 | def function(): 2 | d = Foo( 3 | "b", 4 | "d", 5 | "f" 6 | ) 7 | 8 | # Test DFGs for member accesses 9 | d.b = 10 10 | print(d.b) 11 | print(d.a) 12 | print(d) 13 | 14 | class Foo: 15 | a = 1 16 | b = 2 17 | c = 3 18 | 19 | def __init__(self, a, b, c): 20 | self.a = a 21 | self.b = b 22 | self.c = c -------------------------------------------------------------------------------- /cpg-language-typescript/src/main/typescript/deno.lock: -------------------------------------------------------------------------------- 1 | { 2 | "version": "4", 3 | "specifiers": { 4 | "npm:typescript@^5.8.3": "5.8.3" 5 | }, 6 | "npm": { 7 | "typescript@5.8.3": { 8 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==" 9 | } 10 | }, 11 | "workspace": { 12 | "dependencies": [ 13 | "npm:typescript@^5.8.3" 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/classtemplates/pair.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | class Pair 6 | { 7 | public: 8 | Type1 first; 9 | Type2 second; 10 | }; 11 | 12 | int main() 13 | { 14 | // Assume as Point struct 15 | Pair point1; 16 | 17 | // Logically same as X and Y members 18 | point1.first = 10; 19 | point1.second = 20; 20 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/java/staticImports/asterisk/B.java: -------------------------------------------------------------------------------- 1 | import static A.*; 2 | 3 | public class B { 4 | 5 | public static void main(String[] args) { 6 | a(); 7 | b(); 8 | b(true); 9 | nonStatic(); // must not be resolved to A.nonStatic but rather an inferred node in B 10 | int y = staticField; 11 | int z = nonStaticField; // must not be resolved to A.nonStaticField but rather an inferred node in B 12 | } 13 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/packages/foobar/__main__.py: -------------------------------------------------------------------------------- 1 | # module foobar.implementation exports "foo" from foobar.implementation.internal_foo, 2 | # so we can directly import it 3 | from foobar.implementation import foo 4 | 5 | # bar is not exported in the package, so we need to import the specific module to 6 | # access it 7 | from foobar.implementation.internal_bar import bar 8 | 9 | bar() 10 | foo() 11 | 12 | print("Main!") 13 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/operators/member_access.cpp: -------------------------------------------------------------------------------- 1 | class Data { 2 | public: 3 | int size; 4 | }; 5 | 6 | class Proxy { 7 | public: 8 | Proxy() { 9 | this->data = new Data(); 10 | } 11 | 12 | Data* operator->() { 13 | return data; 14 | } 15 | 16 | Data* data; 17 | }; 18 | 19 | int main() { 20 | Proxy p; 21 | int size = p->size; 22 | 23 | // int another_size = p.operator->()->size; 24 | } -------------------------------------------------------------------------------- /codyze-core/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cfg/break_continue.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void){ 4 | int i = 10; 5 | printf("\n"); 6 | while (i > 0) { 7 | if (i < 8) continue; 8 | else if (i > 9) break; 9 | i--; 10 | } 11 | printf("\n"); 12 | do { 13 | if (i > 9) break; 14 | if (i < 5) { 15 | i += 2; 16 | continue; 17 | } 18 | i++; 19 | } while (i < 10); 20 | printf("\n"); 21 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/callbr.ll: -------------------------------------------------------------------------------- 1 | 2 | define i32 @main() { ; i32()* 3 | %y = alloca i32 4 | store i32 3, i32* %y 5 | %x = load i32, i32* %y 6 | ; "asm goto" without output constraints. 7 | callbr void asm "", "r,!i"(i32 %x) 8 | to label %fallthrough [label %indirect] 9 | 10 | fallthrough: ; This is the fallthrough target 11 | %b = add i32 %x, 5 12 | ret i32 %b 13 | 14 | indirect: 15 | ret i32 %x 16 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/outerNamespace/innerNamespace/comments.py: -------------------------------------------------------------------------------- 1 | # A comment 2 | 3 | i = 42 # a number 4 | 5 | # a function 6 | 7 | 8 | def foo(): # foo 9 | pass 10 | 11 | 12 | def bar(i, # a parameter 13 | j # another parameter 14 | ): 15 | pass 16 | 17 | 18 | a = ('start' # comment start 19 | 'end') # comment end 20 | 21 | b = { 22 | "a": 1, # a entry 23 | "b": 2 # b entry 24 | } 25 | -------------------------------------------------------------------------------- /cpg-neo4j/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/navigation/index.ts: -------------------------------------------------------------------------------- 1 | // Navigation components 2 | export { default as Navbar } from './Navbar.svelte'; 3 | export { default as Sidebar } from './Sidebar.svelte'; 4 | export { default as PageHeader } from './PageHeader.svelte'; 5 | export { default as TabNavigation } from './TabNavigation.svelte'; 6 | export { default as Breadcrumb } from './Breadcrumb.svelte'; 7 | export { default as BackButton } from './BackButton.svelte'; 8 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/method_or_function_call.cpp: -------------------------------------------------------------------------------- 1 | struct A { 2 | void foo(int i) { 3 | } 4 | }; 5 | 6 | struct B { 7 | void (*bar)(int); 8 | }; 9 | 10 | void bar(int i) { 11 | } 12 | 13 | int main() { 14 | A a; 15 | B b; 16 | b.bar = &bar; 17 | 18 | // foo is a method 19 | (a.foo)(1); 20 | a.foo(2); 21 | 22 | // bar is a function 23 | (b.bar)(3); 24 | (*b.bar)(3); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /cpg-language-go/src/main/resources/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION=v0.0.2 3 | 4 | curl https://github.com/Fraunhofer-AISEC/libgoast/releases/download/${VERSION}/libgoast-amd64.dylib -L -s -o libgoast-amd64.dylib 5 | curl https://github.com/Fraunhofer-AISEC/libgoast/releases/download/${VERSION}/libgoast-arm64.dylib -L -s -o libgoast-arm64.dylib 6 | curl https://github.com/Fraunhofer-AISEC/libgoast/releases/download/${VERSION}/libgoast-amd64.so -L -s -o libgoast-amd64.so 7 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/branch.go: -------------------------------------------------------------------------------- 1 | package p 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | i := 0 7 | 8 | start: 9 | for { 10 | switch i { 11 | case 0: 12 | continue 13 | case 1: 14 | break start // will break out of the switch and the for-loop 15 | case 2: 16 | fallthrough // will fall through case 3 17 | case 3: 18 | fmt.Printf("%d", i) 19 | default: 20 | goto end 21 | } 22 | i++ 23 | } 24 | 25 | end: 26 | } 27 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/comment.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // comment before function 4 | func main(// comment before parameter1 5 | i int, 6 | // comment before parameter2 7 | j int) { 8 | // comment before assignment 9 | a := "a" 10 | 11 | // comment before declaration 12 | var b = a 13 | } 14 | 15 | // comment before struct 16 | type s struct { 17 | // comment before field 18 | myField int 19 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/floatingpoint_ops.ll: -------------------------------------------------------------------------------- 1 | ; External declaration of the rand function 2 | declare half @rand() nounwind 3 | 4 | ; Definition of main function 5 | define half @main() { ; half()* 6 | %x = call half @rand() 7 | %y = call half @rand() 8 | %a = fmul half %y, %x 9 | %b = fadd half %a, %x 10 | %c = fsub half %a, %b 11 | %d = fdiv half %a, %x 12 | %e = frem half %a, %x 13 | %f = fneg half %e 14 | 15 | ret half %b 16 | } -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/loopPhi.ll: -------------------------------------------------------------------------------- 1 | declare i32 @rand() nounwind 2 | 3 | define i32 @loopPhi() { 4 | LoopHeader: 5 | %a = call i32 @rand() 6 | br label %Loop 7 | 8 | Loop: ; Loop that counts from 0 <= i < 10 9 | %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ] 10 | %nextindvar = add i32 %indvar, 1 11 | %cond = icmp eq i32 %nextindvar, 10 12 | br i1 %cond, label %End, label %Loop 13 | 14 | End: 15 | ret i32 %a 16 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/consteval/platform.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if sys.platform == "win32": 4 | def the_func(): 5 | return 1 6 | elif sys.platform != "linux": 7 | def the_func(): 8 | return "not win32 but also not linux" 9 | else: 10 | def the_func(): 11 | return "maybe linux" 12 | 13 | the_func() 14 | 15 | weird_compare = sys.platform == sys.version_info 16 | weird_compare = sys.platform != sys.version_info -------------------------------------------------------------------------------- /codyze-compliance/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/inference/superclass.cpp: -------------------------------------------------------------------------------- 1 | // The headers are just there to make it compile with clang, but we will not parse headers. 2 | // You can use `clang++ -std=c++20 tricky_inference.cpp` to check, if it will compile. 3 | #include "superclass.h" 4 | 5 | class F : A { 6 | 7 | }; 8 | 9 | class G : N::B { 10 | 11 | }; 12 | 13 | namespace O { 14 | class H : E { 15 | class I : M::C::D { 16 | }; 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/fields.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | a = "Hello" 4 | 5 | class MyClass: 6 | copyA = 1 7 | def foo(self): 8 | self.a = 1 9 | print(a) 10 | 11 | def bar(self): 12 | self.os = 1 13 | print(os.name) 14 | self.a = 1 15 | 16 | def baz(self): 17 | print(self.copyA) 18 | doesNotWork(copyA) # not defined 19 | 20 | m = MyClass() 21 | m.foo() 22 | m.bar() 23 | m.baz() 24 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/implicit_casts.cpp: -------------------------------------------------------------------------------- 1 | void f(int x) {} 2 | 3 | void g(char x) {} 4 | void g(int x) {} 5 | void g(float x) {} 6 | 7 | class Base {}; 8 | class One : public Base {}; 9 | class Two : public One {}; 10 | 11 | void h(Base*) {}; 12 | void h(One*) {}; 13 | 14 | int main() { 15 | char x = 'a'; 16 | f(x); 17 | 18 | // this should prefer g(char) 19 | g(x); 20 | 21 | // this should prefer h(One*) 22 | h(new Two()); 23 | } 24 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/java/staticImports/asterisk/A.java: -------------------------------------------------------------------------------- 1 | public class A { 2 | 3 | public static int staticField = 42; 4 | public int nonStaticField = 43; 5 | 6 | public static void a() { 7 | 8 | } 9 | 10 | public static void b() { 11 | 12 | } 13 | 14 | public static void b(boolean param) { 15 | 16 | } 17 | 18 | public static String staticField() { 19 | return "42"; 20 | } 21 | 22 | public void nonStatic() { 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/tempfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | 4 | # behaves as mkstemp would: 5 | # - 0600 permissions 6 | # - write owner only 7 | # behaves like a file object 8 | # has no name 9 | # ceases to exist on close 10 | with tempfile.TemporaryFile() as tmp: 11 | tmp.write('foo') 12 | 13 | tmp = tempfile.NamedTemporaryFile(delete=True) 14 | try: 15 | tmp.write('bar') 16 | finally: 17 | tmp.close() # deletes the file 18 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/templates/functiontemplates/functionTemplateInvocation7.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template void f(T x, T y) { cout << "Template" << endl; } 5 | 6 | void f(int w, int z) { cout << "Non-template" << endl; } 7 | 8 | int main() { 9 | f( 1 , 2 ); // non-template 10 | f('a', 'b'); // template 11 | f( 1 , 'b'); // non-template 12 | f<>( 1 , 'b'); // error; we fall back to non-template for now 13 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Codyze Console 8 | %sveltekit.head% 9 | 10 | 11 |
%sveltekit.body%
12 | 13 | 14 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/components/[componentName]/+page.ts: -------------------------------------------------------------------------------- 1 | import { throwError } from '$lib/errors'; 2 | import type { ComponentJSON } from '$lib/types'; 3 | import type { PageLoad } from './$types'; 4 | 5 | export const load: PageLoad = async ({ fetch, params }) => { 6 | const component: ComponentJSON = await fetch(`/api/component/${params.componentName}`) 7 | .then(throwError) 8 | .then((res) => res.json()); 9 | 10 | return { component }; 11 | }; 12 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/largenegativenumber.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | int a = -1; // regular int 3 | int b = -2147483648; // lowest int value, 2147483648 is too large too fit into int, so the literal itself is a long 4 | long c = -2147483649; // long literal without explicit L notation 5 | long d = -9223372036854775808; // lowest long value, 9223372036854775808 is too large to fit into long, so the literal itself is an unsigned long 6 | } 7 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/symbols/only_variables.cpp: -------------------------------------------------------------------------------- 1 | // global declarations - only semi supported 2 | int a = 1; 3 | 4 | // function declarations 5 | int only_variables() { 6 | // b, c are visible in function 7 | int b = 2; 8 | int c = 3; 9 | 10 | if(a > b) { 11 | // d is visible in then-branch 12 | int d = 4; 13 | return c + d; 14 | } else { 15 | // d is not visible in else-branch 16 | return -c; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/annotations.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request 2 | 3 | app = Flask(__name__) 4 | 5 | 6 | @app.route("/data", methods=['POST']) 7 | def collect_data(): 8 | return "OK", 200 9 | 10 | 11 | @some.otherannotation 12 | def other_func(func): 13 | pass 14 | 15 | 16 | @other_func 17 | def other_other_func(): 18 | pass 19 | 20 | 21 | if __name__ == '__main__': 22 | app.run(host='0.0.0.0', port=8080, debug=True, threaded=True) 23 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/dashboard/index.ts: -------------------------------------------------------------------------------- 1 | // Dashboard components 2 | export { default as CategorySection } from './CategorySection.svelte'; 3 | export { default as ComponentCard } from './ComponentCard.svelte'; 4 | export { default as ComponentsList } from './ComponentsList.svelte'; 5 | export { default as DashboardSection } from './DashboardSection.svelte'; 6 | export { default as StatCard } from './StatCard.svelte'; 7 | export { default as StatsGrid } from './StatsGrid.svelte'; 8 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/compiling/RecordDeclaration.java: -------------------------------------------------------------------------------- 1 | package compiling; 2 | 3 | class SimpleClass { 4 | 5 | private int field; 6 | 7 | private int field1 = 1, field2 = 2; 8 | 9 | SimpleClass() { 10 | // constructor 11 | } 12 | 13 | Integer method() { 14 | System.out.println("Hello world"); 15 | int x = 0; 16 | if (System.currentTimeMillis() > 0) { 17 | x = x + 1; 18 | } else { 19 | x = x -1; 20 | } 21 | return x; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/operators/call_expression.cpp: -------------------------------------------------------------------------------- 1 | struct Data { 2 | int foo() { 3 | return 1; 4 | } 5 | }; 6 | 7 | struct Proxy { 8 | Data *data; 9 | Proxy() { 10 | data = new Data; 11 | } 12 | Data* operator->() { 13 | return data; 14 | } 15 | int bar() { 16 | return 1; 17 | } 18 | }; 19 | 20 | int main() { 21 | Proxy p; 22 | 23 | int i = p->foo(); 24 | int j = p.bar(); 25 | return 1; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/ui/index.ts: -------------------------------------------------------------------------------- 1 | // UI components 2 | export { default as Button } from './Button.svelte'; 3 | export { default as Card } from './Card.svelte'; 4 | export { default as EmptyState } from './EmptyState.svelte'; 5 | export { default as FormField } from './FormField.svelte'; 6 | export { default as LoadingSpinner } from './LoadingSpinner.svelte'; 7 | export { default as SectionCard } from './SectionCard.svelte'; 8 | export { default as StatusBadge } from './StatusBadge.svelte'; 9 | -------------------------------------------------------------------------------- /cpg-core/src/main/resources/META-INF/native-image/org.apache.logging/log4j/resource-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "resources":[ 3 | {"pattern":"\\QMETA-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat\\E"}, 4 | {"pattern":"\\QMETA-INF/services/org.apache.logging.log4j.spi.Provider\\E"}, 5 | {"pattern":"\\QMETA-INF/services/org.apache.logging.log4j.util.PropertySource\\E"}, 6 | {"pattern":"\\QMETA-INF/services/org.slf4j.spi.SLF4JServiceProvider\\E"} 7 | ], 8 | "bundles":[] 9 | } 10 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxxCompilationDatabase/compile_commands_arguments.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "arguments": [ 4 | "/usr/bin/gcc", 5 | "-c", 6 | "-I", 7 | "includes_1", 8 | "-Iincludes_2", 9 | "-Isys_includes/", 10 | "-DFOO=1", 11 | "-D", 12 | "BAR=2", 13 | "-DINFO=\"hi\"", 14 | "-DDEBUG=1", 15 | "main.c" 16 | ], 17 | "directory": "src/test/resources/cxxCompilationDatabase", 18 | "file": "main.c" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/cfg/If.java: -------------------------------------------------------------------------------- 1 | package cfg; 2 | 3 | public class If { 4 | 5 | public static void main(String[] args) { 6 | int i = 0; // To if 7 | System.out.println(); 8 | if(i < 1) 9 | i = 1; 10 | System.out.println(); // Reached by end of condition and else - to if 11 | if(i >= 0) // From condition to then and else branch 12 | i = 0; 13 | else // Comes from condition end 14 | i = 1; 15 | System.out.println(); // Reached by end of then and else 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/types/A.java: -------------------------------------------------------------------------------- 1 | public class A { 2 | // Test uniqueness 3 | private int x; 4 | private int z; 5 | 6 | // Test propagation of specifiers 7 | private final int y = 4; 8 | 9 | public A(int x) { 10 | this.x = x; 11 | } 12 | 13 | public int doSomething() { 14 | // Test propagation in variables 15 | final String s = ""; 16 | int[] array = new int[5]; 17 | C map; 18 | return x; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/arrays/mypackage/Arrays.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class Arrays { 4 | 5 | public Element[] create() { 6 | var arrays = new Element[2]; 7 | arrays[0] = new Element(); 8 | arrays[1] = arrays[0]; 9 | 10 | int len = arrays.length; 11 | 12 | return arrays; 13 | } 14 | 15 | public Element[][] createMulti() { 16 | var multi = new Element[2][10]; 17 | 18 | return multi; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM squidfunk/mkdocs-material 2 | 3 | # Ensure installation of required packages 4 | # - uses updated cache on-the-fly without storing it locally 5 | RUN apk --no-cache add \ 6 | git 7 | 8 | # Install additional plugins (cf. `./mkdocs-material-plugins.txt`) 9 | COPY mkdocs-material-plugins.txt / 10 | RUN python -m pip install --no-cache-dir -r /mkdocs-material-plugins.txt 11 | 12 | # Trust git directory for git revision plugin 13 | RUN git config --global --add safe.directory /docs 14 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/+layout.ts: -------------------------------------------------------------------------------- 1 | import type { LayoutLoad } from './$types'; 2 | import { groupConcepts } from '$lib/concepts'; 3 | 4 | export const ssr = false; 5 | import '@fontsource/noto-sans-mono'; 6 | import 'inter-ui/inter-variable.css'; 7 | import '../app.css'; 8 | 9 | export const load: LayoutLoad = async ({ fetch }) => { 10 | const res = await fetch('/api/classes/concepts'); 11 | const data = await res.json(); 12 | return { conceptGroups: groupConcepts(data.info) }; 13 | }; 14 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/file/file-concept-location.yaml: -------------------------------------------------------------------------------- 1 | concepts: 2 | - concept: 3 | name: "de.fraunhofer.aisec.cpg.graph.concepts.file.File" 4 | constructorArguments: 5 | - name: "fileName" 6 | value: "foo" 7 | dfg: 8 | fromConceptToThisNode: true 9 | location: 10 | file: "src/integrationTest/resources/python/file/file_read.py" 11 | region: "1:6-1:30" 12 | type: "de.fraunhofer.aisec.cpg.graph.statements.expressions.CallExpression" -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/defaultargs/partialDefaults.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | // defining the default arguments 5 | void add(int a, int b, int c=3, int d = 4) { 6 | for(int i = 1; i <= count; ++i) { 7 | cout << c; 8 | } 9 | cout << endl; 10 | } 11 | 12 | int main() { 13 | // Unresolved 14 | add(); 15 | 16 | // OK a=1, b=2, c=3, d=4 17 | add(1,2); 18 | 19 | // OK a=1, b=2, c=5,d=6 20 | add(1,2,5,6); 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /.run/Codyze Console.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/cxxprioresolution/methodresolution/overloadnoresolution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | class Base 4 | { 5 | public: 6 | void calc(int i) 7 | { 8 | cout << "int: " << i; 9 | } 10 | }; 11 | class Overloaded : public Base 12 | { 13 | public: 14 | void calc(int a, int b) 15 | { 16 | cout << "double: " << a+b; 17 | } 18 | }; 19 | int main() 20 | { 21 | Overloaded overload; 22 | overload.calc(1); 23 | return 0; 24 | } -------------------------------------------------------------------------------- /cpg-core/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/Issue1459.java: -------------------------------------------------------------------------------- 1 | public class Issue1459 { 2 | public static final int i1 = 1; 3 | public static final int i2 = i1; 4 | 5 | public static void main(String[] args) { 6 | System.out.println(i2); 7 | } 8 | 9 | class Inner { // EOG predecessor: MemberExpression "i2" 10 | static final int i3 = i2; 11 | } 12 | 13 | class Inner2 {// EOG predecessor: FieldDeclaration "Inner$this" 14 | static final int i4 = FieldRecord.Inner.i3; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cpg-analysis/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-concepts/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/operators/arithmetic.cpp: -------------------------------------------------------------------------------- 1 | class Integer { 2 | public: 3 | Integer(int i) : i(i) {} 4 | void operator++(int) { 5 | i++; 6 | } 7 | 8 | Integer operator+(int j) { 9 | return Integer(this->i+j); 10 | } 11 | 12 | Integer operator+(Integer &j) { 13 | return Integer(this->i+j.i); 14 | } 15 | 16 | void test() {}; 17 | 18 | int i; 19 | }; 20 | 21 | int main() { 22 | Integer i(5); 23 | i++; 24 | 25 | Integer j = i + 2; 26 | auto k = i + j; 27 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/lib/components/analysis/FindingsList.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 |

Findings

13 |
    14 | {#each findings as finding, index (index)} 15 | 16 | {/each} 17 |
18 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/namespaced_function.cpp: -------------------------------------------------------------------------------- 1 | namespace ABC { 2 | // The FQN of this struct should be ABC:A 3 | struct A {}; 4 | 5 | void foo(); 6 | void bar(ABC::A a); 7 | }; 8 | 9 | // This is a function (not a method!) within the namespace ABC 10 | void ABC::foo() { 11 | // This "A" type is actually ABC:A because the default scope of this function is the namespace ABC 12 | A a; 13 | bar(a); 14 | } 15 | 16 | void ABC::bar(ABC::A a) { 17 | } 18 | 19 | int main() { 20 | ABC::foo(); 21 | return 0; 22 | } -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cpg-neo4j/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/c/designated.c: -------------------------------------------------------------------------------- 1 | struct Point 2 | { 3 | int x, y, z; 4 | }; 5 | 6 | struct Outer { 7 | struct Point p; 8 | }; 9 | 10 | int main() 11 | { 12 | // Examples of initialization using 13 | // designated initialization 14 | struct Point p1 = {.y = 0, .z = 1, .x = 2}; 15 | struct Point p2 = {.x = 20}; 16 | struct Outer o = {.p.x = 10}; 17 | int foo2[10] = { [3] = 1, [5] = 2 }; 18 | 19 | // This only works in C (!!) 20 | int foo3[10] = { [0 ... 9] = 2 }; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/components/+page.ts: -------------------------------------------------------------------------------- 1 | import type { PageLoad } from './$types'; 2 | 3 | export const load: PageLoad = async ({ fetch }) => { 4 | try { 5 | const response = await fetch('/api/result'); 6 | 7 | if (!response.ok) { 8 | return { components: [] }; 9 | } 10 | 11 | const result = await response.json(); 12 | return { components: result?.components || [] }; 13 | } catch (error) { 14 | console.error('Error loading components:', error); 15 | return { components: [] }; 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/load_includes/stdlib/json/__init__.pyi: -------------------------------------------------------------------------------- 1 | def loads( 2 | s: str | bytes | bytearray, 3 | *, 4 | cls: type[JSONDecoder] | None = None, 5 | object_hook: Callable[[dict[Any, Any]], Any] | None = None, 6 | parse_float: Callable[[str], Any] | None = None, 7 | parse_int: Callable[[str], Any] | None = None, 8 | parse_constant: Callable[[str], Any] | None = None, 9 | object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None, 10 | **kwds: Any, 11 | ) -> Any: ... 12 | 13 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from '@sveltejs/adapter-static'; 2 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; 3 | 4 | /** @type {import('@sveltejs/kit').Config} */ 5 | const config = { 6 | // Consult https://svelte.dev/docs/kit/integrations 7 | // for more information about preprocessors 8 | preprocess: vitePreprocess(), 9 | kit: { 10 | adapter: adapter({ 11 | fallback: 'index.html', 12 | pages: '../resources/static' 13 | }) 14 | } 15 | }; 16 | 17 | export default config; 18 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/boolop.py: -------------------------------------------------------------------------------- 1 | def twoBoolOp(a): 2 | if a and True: 3 | print(a) 4 | return a 5 | 6 | def threeBoolOp(a, b): 7 | if a and True and b: 8 | print(a) 9 | return a 10 | 11 | def nestedBoolOpDifferentOp(a, b): 12 | if a and True or b: 13 | print(a) 14 | return a 15 | 16 | def nestedBoolOpDifferentOp2(a, b): 17 | if a or True and b: 18 | print(a) 19 | return a 20 | 21 | def threeBoolOpNoBool(a): 22 | if a and True and "foo": 23 | print(a) 24 | return a -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/cfg/BreakContinue.java: -------------------------------------------------------------------------------- 1 | package cfg; 2 | 3 | public class BreakContinue { 4 | 5 | public static void main(String[] args) { 6 | int i = 10; 7 | System.out.println(); 8 | while (i > 0) { 9 | if (i < 8) continue; 10 | else if (i > 9) break; 11 | i--; 12 | } 13 | System.out.println(); 14 | do { 15 | if (i > 9) break; 16 | if (i < 5) { 17 | i += 2; 18 | continue; 19 | } 20 | i++; 21 | } while (i < 10); 22 | System.out.println(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/tuple_assign.py: -------------------------------------------------------------------------------- 1 | def returnTuple(a, b): 2 | return (a, b) 3 | 4 | def getTuple(a, b): 5 | (c, d) = returnTuple(a, b) 6 | print(str(c) + " " + str(d)) 7 | 8 | def returnTuple2(a, b): 9 | return a, b 10 | 11 | def getTuple2(a, b): 12 | c, d = returnTuple2(a, b) 13 | print(str(c) + " " + str(d)) 14 | 15 | def getTuple3(a, b): 16 | (c, d) = returnTuple2(a, b) 17 | print(str(c) + " " + str(d)) 18 | 19 | def getTuple4(a, b): 20 | c, d = returnTuple(a, b) 21 | print(str(c) + " " + str(d)) -------------------------------------------------------------------------------- /docs/docs/assets/javascripts/mathjax.js: -------------------------------------------------------------------------------- 1 | window.MathJax = { 2 | tex: { 3 | inlineMath: [['$', '$'], ['\\(', '\\)']], 4 | // displayMath: [ ['$$', '$$'], ['\[', '\]'] ], 5 | processEscapes: true, 6 | processEnvironments: true 7 | }, 8 | options: { 9 | // ignoreHtmlClass: ".*|", 10 | // processHtmlClass: "arithmatex" 11 | } 12 | }; 13 | document$.subscribe(() => { 14 | MathJax.startup.output.clearCache() 15 | MathJax.typesetClear() 16 | MathJax.texReset() 17 | MathJax.typesetPromise() 18 | }) 19 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended", 4 | "schedule:weekly", 5 | ":enableVulnerabilityAlerts" 6 | ], 7 | "patch": { 8 | "enabled": false 9 | }, 10 | "labels": [ 11 | "dependencies" 12 | ], 13 | "packageRules": [ 14 | { 15 | "matchManagers": [ 16 | "gomod" 17 | ], 18 | "addLabels": [ 19 | "go" 20 | ] 21 | }, 22 | { 23 | "matchManagers": [ 24 | "npm" 25 | ], 26 | "addLabels": [ 27 | "npm" 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /cpg-language-java/src/test/resources/InnerClass.java: -------------------------------------------------------------------------------- 1 | public class InnerClass { 2 | 3 | public String s = "outer.s"; 4 | 5 | private class InnerInnerClass { 6 | 7 | public InnerInnerClass(){ 8 | 9 | } 10 | public void setS(String newS){s = newS;}; 11 | } 12 | 13 | /**public static void main(String[] args){ 14 | InnerClass outer = new InnerClass(); 15 | InnerClass.InnerInnerClass inner = outer.new InnerInnerClass(); 16 | inner.setS("new.s"); 17 | System.out.println("os: " + outer.s); 18 | }**/ 19 | } 20 | -------------------------------------------------------------------------------- /cpg-concepts/src/integrationTest/resources/python/mypackage/read_config.py: -------------------------------------------------------------------------------- 1 | import configparser 2 | import os 3 | 4 | if os.environ.get('PROD') == 'true': 5 | config_file = 'prod.ini' 6 | else: 7 | config_file = 'dev.ini' 8 | 9 | config = configparser.ConfigParser() 10 | config.read(config_file) 11 | 12 | default = config['DEFAULT'] 13 | another_default = config['DEFAULT'] 14 | same_config = config 15 | yet_another_default = same_config['DEFAULT'] 16 | port = default['port'] 17 | 18 | ssl_enabled = config['ssl']['enabled'] 19 | 20 | print(port) 21 | print(ssl_enabled) 22 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/objcreation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int method(); 4 | 5 | class Integer { 6 | private: 7 | int i; 8 | 9 | public: 10 | Integer(int i) { 11 | this->i = i; 12 | } 13 | 14 | int method(); 15 | 16 | int getI() { 17 | return i; 18 | } 19 | 20 | }; 21 | 22 | int method() { 23 | return 2; 24 | } 25 | 26 | int main() { 27 | Integer i(4); 28 | i.getI(); 29 | 30 | std::string s("hallo"); 31 | s.c_str(); 32 | 33 | Integer j(method()); 34 | 35 | int k = 4; 36 | 37 | auto l = new Integer(k); 38 | } 39 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/calls/defaultargs/defaultInDefinition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | // defining the default arguments 5 | void display(char c = '*', int count = 3) { 6 | for(int i = 1; i <= count; ++i) { 7 | cout << c; 8 | } 9 | cout << endl; 10 | } 11 | 12 | int main() { 13 | int count = 5; 14 | 15 | // *, 3 will be parameters 16 | display(); 17 | 18 | // #, 3 will be parameters 19 | display('#'); 20 | 21 | // $, 5 will be parameters 22 | display('$', count); 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /cpg-language-go/src/test/resources/golang/for.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | var bytes = []byte{1,2,3,4} 7 | 8 | // Regular old-school for loop 9 | for i := 0; i < 4; i++ { 10 | fmt.Printf("bytes[%d]=%d\n", i, bytes[i]) 11 | } 12 | 13 | // For-each style loop with range expression with key and value. idx and b are created using 14 | // the short assignment syntax. Its scope is limited to the for-block. 15 | for idx, b := range bytes { 16 | fmt.Printf("bytes[%d]=%d; idx=%T b=%T\n", idx, b, idx, b) 17 | } 18 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/with.py: -------------------------------------------------------------------------------- 1 | with open("file.txt", "r") as file: 2 | data = file.read() 3 | 4 | with open("file.txt", "r"): 5 | pass 6 | 7 | class TestContextManager: 8 | def __enter__(self): 9 | print("Entering context") 10 | 11 | def __exit__(self, exc_type, exc_value, traceback): 12 | print("Exiting context") 13 | 14 | def test_multiple(): 15 | with A() as a, B(a) as b, C(a, b) as c: 16 | doSomething(a, c) 17 | 18 | def test_function(): 19 | with TestContextManager() as cm: 20 | print("Inside with block") -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/integer_ops.ll: -------------------------------------------------------------------------------- 1 | ; External declaration of the rand function 2 | declare i32 @rand() nounwind 3 | 4 | ; Definition of main function 5 | define i32 @main() { ; i32()* 6 | %x = call i32 @rand() 7 | %y = call i32 @rand() 8 | %a = mul i32 %y, 32768 9 | %b = add i32 %a, 5 10 | %c = sub i32 %a, %b 11 | %d = sdiv i32 %a, %x 12 | %e = srem i32 %a, %x 13 | %f = xor i32 %a, %x 14 | %g = udiv i32 %a, %x 15 | %h = urem i32 %a, %x 16 | %i = shl i32 %a, %x 17 | %j = lshr i32 %a, %x 18 | %k = ashr i32 %a, %x 19 | 20 | ret i32 %b 21 | } 22 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/compiling/hierarchy/multistep/multi_inheritance.cpp: -------------------------------------------------------------------------------- 1 | class Root {}; 2 | class Level0: Root {}; 3 | class Level0B {}; 4 | class Level1: Level0 {}; 5 | class Level1B: Level0, Level0B {}; 6 | class Level1C: Level0B, Root {}; 7 | class Level2: Level1 {}; 8 | class Level2B: Level1B, Level1C {}; 9 | class Unrelated {}; 10 | /* 11 | Type hierarchy: 12 | Root------------ 13 | | | 14 | Level0 Level0B | 15 | / \ / \ | 16 | Level1 Level1B Level1C 17 | | \ / 18 | Level2 Level2B 19 | */ -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/cxx/template_constructor.cpp: -------------------------------------------------------------------------------- 1 | // MyTemplateClass is a template class with a copy and a move constructor 2 | template 3 | class MyTemplateClass { 4 | public: 5 | MyTemplateClass(const T &t) { 6 | // do something here, probably copy from T 7 | } 8 | MyTemplateClass(T &&t) { 9 | // do something here, probably move from T 10 | } 11 | }; 12 | 13 | // MyClass is a regular class with a copy and a move constructor 14 | class MyClass { 15 | public: 16 | MyClass(const MyClass &m) {} 17 | MyClass(MyClass &&m) {} 18 | }; 19 | -------------------------------------------------------------------------------- /cpg-language-llvm/src/test/resources/llvm/integer_comparisons.ll: -------------------------------------------------------------------------------- 1 | ; External declaration of the rand function 2 | declare i32 @rand() nounwind 3 | 4 | ; Definition of main function 5 | define i32 @main() { ; i32()* 6 | %x = call i32 @rand() 7 | 8 | %a = icmp eq i32 %x, 10 9 | %b = icmp ne i32 %x, 10 10 | %c = icmp ugt i32 %x, 10 11 | %d = icmp ult i32 %x, 10 12 | %e = icmp uge i32 %x, 10 13 | %f = icmp ule i32 %x, 10 14 | %g = icmp sgt i32 %x, 10 15 | %h = icmp slt i32 %x, 10 16 | %i = icmp sge i32 %x, 10 17 | %j = icmp sle i32 %x, 10 18 | 19 | ret i32 %x 20 | } 21 | 22 | -------------------------------------------------------------------------------- /cpg-language-cxx/src/test/resources/typedefs/weird_typedefs.cpp: -------------------------------------------------------------------------------- 1 | // typedef can be used anywhere in the decl-specifier-seq 2 | // more conventionally spelled "typedef unsigned long long int ullong;" 3 | unsigned long typedef long int ullong; 4 | 5 | // usage of type that is identical to typedef 6 | unsigned long long int someUllong1; 7 | // usage of typedef 8 | ullong someUllong2; 9 | 10 | // also possible with structs 11 | struct bar { 12 | int a; 13 | int b; 14 | } typedef baz; 15 | 16 | // just some type that contains a typedef for more confusion 17 | struct foo { 18 | typedef const int a; 19 | }; -------------------------------------------------------------------------------- /cpg-language-jvm/src/test/resources/class/inheritance/mypackage/ExtendedClass.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class ExtendedClass extends BaseClass implements MyInterface { 4 | 5 | public void setMyProperty(int myProperty) { 6 | informSomebody(this.myProperty, myProperty); 7 | super.setMyProperty(myProperty); 8 | } 9 | private void informSomebody(int oldValue, int newValue) { 10 | System.out.println("We changed the value from " + oldValue + " to " + newValue); 11 | } 12 | 13 | @Override 14 | public void doSomething() { 15 | 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/raise.py: -------------------------------------------------------------------------------- 1 | def raise_in_try(): 2 | try: 3 | raise Exception() 4 | except Exception: 5 | print("Caught Exception") 6 | except A: 7 | print("Caught A") 8 | 9 | def raise_in_try2(): 10 | try: 11 | raise Exception() 12 | except A: 13 | print("Caught A") 14 | except Exception: 15 | print("Caught Exception") 16 | 17 | 18 | def raise_without_try(): 19 | raise Exception() 20 | 21 | def raise_empty(): 22 | raise 23 | 24 | def raise_with_parent(): 25 | raise Exception() from A() 26 | -------------------------------------------------------------------------------- /cpg-language-python/src/test/resources/python/vars.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | classFieldNoInitializer: int 3 | classFieldWithInit = 123 4 | classFieldNoInitializer = classFieldWithInit 5 | 6 | def bar(self): 7 | self.classFieldDeclaredInFunction = 456 8 | self.classFieldNoInitializer = 789 9 | self.classFieldWithInit = 12 10 | classFieldNoInitializer = "shadowed" 11 | classFieldWithInit = "shadowed" 12 | classFieldDeclaredInFunction = "shadowed" 13 | 14 | 15 | foo = Foo() 16 | foo.classFieldNoInitializer = 345 17 | foo.classFieldWithInit = 678 18 | -------------------------------------------------------------------------------- /codyze-console/src/main/webapp/src/routes/requirements/+page.ts: -------------------------------------------------------------------------------- 1 | import type { PageLoad } from './$types'; 2 | import type { AnalysisResultJSON } from '$lib/types'; 3 | 4 | export const load: PageLoad = async ({ fetch }) => { 5 | try { 6 | const response = await fetch('/api/result'); 7 | 8 | if (response.ok) { 9 | const result: AnalysisResultJSON = await response.json(); 10 | return { result }; 11 | } 12 | 13 | return { result: null }; 14 | } catch (error) { 15 | console.error('Error loading requirements data:', error); 16 | return { result: null }; 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /cpg-language-typescript/src/test/resources/typescript/fetch.ts: -------------------------------------------------------------------------------- 1 | function handleSubmit(event: any) { 2 | event.preventDefault(); 3 | 4 | const apiUrl = `/api/v1/groups`; 5 | const token = localStorage.getItem("access_token"); 6 | 7 | fetch(apiUrl, { 8 | method: 'POST', 9 | body: JSON.stringify(new CreateGroupRequest()), 10 | headers: { 11 | 'Authorization': `Bearer ${token}`, 12 | 'Content-Type': 'application/json' 13 | } 14 | }) 15 | .then((res) => { 16 | const group = res.json(); 17 | console.log(group); 18 | ) 19 | } --------------------------------------------------------------------------------