Instruction
stringclasses 1
value | Input
stringlengths 79
33k
| Response
stringlengths 106
9.29k
| __index_level_0__
int64 0
2.83k
|
---|---|---|---|
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD list_by_type.
SELECT * FROM (c_tabname)
INTO TABLE rt_content
WHERE type = iv_type
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
METHOD list_by_type.
SELECT * FROM (c_tabname) * <-- There is a problem here
INTO TABLE rt_content
```
Explanation: Potential dangerous statement Dynamic SQL.
| 322 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD modify.
DATA: ls_content TYPE zif_abapgit_persistence=>ty_content.
lock( iv_type = iv_type
iv_value = iv_value ).
ls_content-type = iv_type.
ls_content-value = iv_value.
ls_content-data_str = iv_data.
MODIFY (c_tabname) FROM ls_content.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'DB modify failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY (c_tabname) FROM ls_content.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 323 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD read.
SELECT SINGLE data_str FROM (c_tabname) INTO rv_data
WHERE type = iv_type
AND value = iv_value.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE data_str FROM (c_tabname) INTO rv_data
```
Explanation: Potential dangerous statement Dynamic SQL.
| 324 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD update.
DATA lv_data LIKE iv_data.
lv_data = validate_and_unprettify_xml( iv_data ).
lock( iv_type = iv_type
iv_value = iv_value ).
UPDATE (c_tabname) SET data_str = lv_data
WHERE type = iv_type
AND value = iv_value.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'DB update failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
UPDATE (c_tabname) SET data_str = lv_data
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 325 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE abap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'I'
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
zcx_abapgit_exception=>raise( |Error from RS_CORR_INSERT, Cancelled, { sy-msgid }, { sy-msgno }| ).
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from RS_CORR_INSERT, { sy-msgid }, { sy-msgno }| ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'.
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSE.
zcx_abapgit_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ELSEIF strlen( is_progdir-name ) > 30.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |not found in PROGDIR. Subrc = { sy-subrc }| ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |PROG, error inserting. Subrc = { sy-subrc }| ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
zcl_abapgit_objects_activation=>add(
iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 326 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL is_progdir-name
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 327 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE iv_program "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
```
|
I found vulnerabilities in the line:
```abap
DELETE TEXTPOOL iv_program
```
Explanation: Potential dangerous statement DELETE TEXTPOOL.
| 328 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE iv_program "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "master language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in * <-- There is a problem here
FROM it_tpool
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 329 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
DATA lv_state TYPE c.
DATA lv_delete TYPE abap_bool.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
IF lv_language = mv_language.
lv_state = 'I'. "Textpool in master language needs to be activated
ELSE.
lv_state = 'A'. "Translations are always active
ENDIF.
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE iv_program "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "master language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
ELSE.
IF lines( it_tpool ) = 1 AND lv_language = mv_language.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN. "No action because description in master language is already there
ENDIF.
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE lv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
IF lv_state = 'I'. "Textpool in master language needs to be activated
zcl_abapgit_objects_activation=>add(
iv_type = 'REPT'
iv_name = iv_program
iv_delete = lv_delete ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
ENDIF.
INSERT TEXTPOOL iv_program * <-- There is a problem here
FROM it_tpool
LANGUAGE lv_language
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 330 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_type IMPLEMENTATION.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
lv_typdname = ms_item-obj_name.
" Active version
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |No active version found for { ms_item-obj_type } { ms_item-obj_name }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
delete_ddic( 'G' ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_progname TYPE progname,
lv_state TYPE r3state.
lv_progname = |%_C{ ms_item-obj_name }|.
SELECT SINGLE state
FROM progdir
INTO lv_state
WHERE name = lv_progname.
IF lv_state IS NOT INITIAL.
rv_bool = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECT=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
read( IMPORTING ev_ddtext = lv_ddtext
et_source = lt_source ).
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 331 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 332 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE sap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
lcx_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
lcx_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'. "#EC CI_SUBRC
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
IF sy-msgid = 'EU' AND sy-msgno = '510'.
lcx_exception=>raise( 'User is currently editing program' ).
ELSE.
lcx_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
ELSE.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'not found in PROGDIR' ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'PROG, error inserting' ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD. "deserialize_program
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 333 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL is_progdir-name
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 334 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
UPDATE progdir SET varcl = is_progdir-varcl
```
Explanation: Modify only own DB tables.
| 335 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF ( sy-subrc = 0 AND lines( it_tpool ) = 1 ) OR lines( it_tpool ) = 0.
RETURN. " no action for includes
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
IF lv_language = mv_language. " Add just once
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = iv_program ).
ENDIF.
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL iv_program
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 336 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA: lv_cp TYPE program,
lv_clsname TYPE seoclsname,
lt_tpool_ext TYPE ty_tpool_tt,
lt_tpool TYPE textpool_table.
io_xml->read( EXPORTING iv_name = 'TPOOL'
CHANGING cg_data = lt_tpool_ext ).
lt_tpool = read_tpool( lt_tpool_ext ).
IF lt_tpool[] IS INITIAL.
RETURN.
ENDIF.
lv_clsname = ms_item-obj_name.
lv_cp = cl_oo_classname_service=>get_classpool_name( lv_clsname ).
INSERT TEXTPOOL lv_cp
FROM lt_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = lv_cp ).
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL lv_cp
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 337 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from FUNCTION_DELETE' ).
ENDIF.
ENDIF.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_area
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
* NAMESPACE = ' ' todo
remote_basxml_supported = <ls_func>-remote_basxml
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from RS_FUNCTIONMODULE_INSERT' ).
ENDIF.
INSERT REPORT lv_include FROM lt_source.
* lcl_objects_activation=>add( iv_type = 'FUNC'
* iv_name = <ls_func>-funcname ).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 338 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF ( sy-subrc = 0 AND lines( it_tpool ) = 1 ) OR lines( it_tpool ) = 0.
RETURN. " no action for includes
ENDIF.
INSERT TEXTPOOL ms_item-obj_name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = ms_item-obj_name ).
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL ms_item-obj_name
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 339 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE sap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
lcx_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
lcx_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'. "#EC CI_SUBRC
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
IF sy-msgid = 'EU' AND sy-msgno = '510'.
lcx_exception=>raise( 'User is currently editing program' ).
ELSE.
lcx_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
ELSE.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'not found in PROGDIR' ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'PROG, error inserting' ).
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD. "deserialize_program
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name
```
Explanation: Potential dangerous statement INSERT REPORT.
| 340 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_model.
DATA ls_dm40l TYPE dm40l.
io_xml->read( EXPORTING iv_name = 'DM40L'
CHANGING cg_data = ls_dm40l ).
" See SDU_MODEL_PUT
GET TIME.
ls_dm40l-flg_frame = abap_true.
ls_dm40l-fstdate = sy-datum.
ls_dm40l-fsttime = sy-uzeit.
ls_dm40l-fstuser = sy-uname.
ls_dm40l-lstdate = sy-datum.
ls_dm40l-lsttime = sy-uzeit.
ls_dm40l-lstuser = sy-uname.
MODIFY dm40l FROM ls_dm40l.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SDU_MODEL_PUT' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY dm40l FROM ls_dm40l.
```
Explanation: Modify only own DB tables.
| 342 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF ls_dm40t-langbez NE ls_udmo_text-langbez.
ls_dm40t-langbez = ls_udmo_text-langbez.
ls_dm40t-lstdate = sy-datum.
ls_dm40t-lsttime = sy-uzeit.
ls_dm40t-lstuser = sy-uname.
MODIFY dm40t FROM ls_dm40t.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
MODIFY dm40t FROM ls_dm40t.
```
Explanation: Modify only own DB tables.
| 343 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT lt_udmo_texts INTO ls_udmo_text.
" Does the text already exist? This is the same logic as used
" in the FM SDU_MODEL_PUT
SELECT SINGLE *
FROM dm40t
INTO ls_dm40t
WHERE sprache EQ ls_udmo_text-sprache
AND dmoid EQ ls_udmo_text-dmoid
AND as4local EQ me->mv_activation_state.
IF sy-subrc EQ 0.
" There is already an active description for this language
" but the provided description differs
IF ls_dm40t-langbez NE ls_udmo_text-langbez.
ls_dm40t-langbez = ls_udmo_text-langbez.
ls_dm40t-lstdate = sy-datum.
ls_dm40t-lsttime = sy-uzeit.
ls_dm40t-lstuser = sy-uname.
MODIFY dm40t FROM ls_dm40t.
ENDIF.
ELSE.
" There is no EXISTING active description in this language
ls_dm40t-as4local = ls_udmo_text-as4local.
ls_dm40t-dmoid = ls_udmo_text-dmoid.
ls_dm40t-langbez = ls_udmo_text-langbez.
ls_dm40t-lstdate = sy-datum.
ls_dm40t-lsttime = sy-uzeit.
ls_dm40t-lstuser = sy-uname.
ls_dm40t-sprache = ls_udmo_text-sprache.
INSERT dm40t FROM ls_dm40t.
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT dm40t FROM ls_dm40t.
```
Explanation: Modify only own DB tables.
| 344 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS lcl_oo_class IMPLEMENTATION.
METHOD lif_oo_object_fnc~create.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
CHANGING
class = is_properties
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~generate_locals.
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
EXPORTING
clskey = is_key
force = iv_force
locals_def = it_local_definitions
locals_imp = it_local_implementations
locals_mac = it_local_macros
locals_testclasses = it_local_test_classes
EXCEPTIONS
not_existing = 1
model_only = 2
locals_not_generated = 3
locals_not_initialised = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from generate_locals' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~insert_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
INSERT TEXTPOOL lv_cp
FROM it_text_pool
LANGUAGE iv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = lv_cp ).
ENDMETHOD.
METHOD lif_oo_object_fnc~create_sotr.
DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt,
lt_objects TYPE sotr_objects,
ls_paket TYPE sotr_pack,
lv_object LIKE LINE OF lt_objects.
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF lt_sotr.
LOOP AT it_sotr ASSIGNING <ls_sotr>.
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
EXPORTING
object_vector = <ls_sotr>-header-objid_vec
IMPORTING
objects = lt_objects
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SOTR_OBJECT_GET_OBJECTS' ).
ENDIF.
READ TABLE lt_objects INDEX 1 INTO lv_object.
ASSERT sy-subrc = 0.
ls_paket-paket = iv_package.
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
EXPORTING
paket = ls_paket
crea_lan = <ls_sotr>-header-crea_lan
alias_name = <ls_sotr>-header-alias_name
object = lv_object
entries = <ls_sotr>-entries
concept_default = <ls_sotr>-header-concept
EXCEPTIONS
package_missing = 1
crea_lan_missing = 2
object_missing = 3
paket_does_not_exist = 4
alias_already_exist = 5
object_type_not_found = 6
langu_missing = 7
identical_context_not_allowed = 8
text_too_long = 9
error_in_update = 10
no_master_langu = 11
error_in_concept_id = 12
alias_not_allowed = 13
tadir_entry_creation_failed = 14
internal_error = 15
error_in_correction = 16
user_cancelled = 17
no_entry_found = 18
OTHERS = 19.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SOTR_CREATE_CONCEPT' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_includes.
* note: includes returned might not exist
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
DATA: lv_class_name TYPE seoclsname,
lt_methods TYPE seop_methods_w_include.
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
lv_class_name = iv_object_name.
APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes.
* skip the CS include, as it is sometimes generated on the fly instead of
* when the methods are changed
* APPEND cl_oo_classname_service=>get_cs_name( lv_class_name ) TO rt_includes.
cl_oo_classname_service=>get_all_method_includes(
EXPORTING
clsname = lv_class_name
RECEIVING
result = lt_methods
EXCEPTIONS
class_not_existing = 1 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Class { lv_class_name } not existing| ).
ENDIF.
LOOP AT lt_methods ASSIGNING <ls_method>.
APPEND <ls_method>-incname TO rt_includes.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_class_properties.
CALL FUNCTION 'SEO_CLIF_GET'
EXPORTING
cifkey = is_class_key
version = seoc_version_active
IMPORTING
class = rs_class_properties
EXCEPTIONS
not_existing = 1
deleted = 2
model_only = 3
OTHERS = 4.
IF sy-subrc = 1.
RETURN. " in case only inactive version exists
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from seo_clif_get' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~read_text_pool.
DATA:
lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP
ENDMETHOD.
METHOD lif_oo_object_fnc~read_sotr.
DATA: lv_concept TYPE sotr_head-concept,
lt_seocompodf TYPE STANDARD TABLE OF seocompodf WITH DEFAULT KEY,
ls_header TYPE sotr_head,
lt_entries TYPE sotr_text_tt.
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF rt_sotr,
<ls_seocompodf> LIKE LINE OF lt_seocompodf,
<ls_entry> LIKE LINE OF lt_entries.
SELECT * FROM seocompodf
INTO TABLE lt_seocompodf
WHERE clsname = iv_object_name
AND version = '1'
AND exposure = '2'
AND attdecltyp = '2'
AND type = 'SOTR_CONC'
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
LOOP AT lt_seocompodf ASSIGNING <ls_seocompodf>.
lv_concept = translate( val = <ls_seocompodf>-attvalue from = '''' to = '' ).
CALL FUNCTION 'SOTR_GET_CONCEPT'
EXPORTING
concept = lv_concept
IMPORTING
header = ls_header
TABLES
entries = lt_entries
EXCEPTIONS
no_entry_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
CLEAR: ls_header-paket,
ls_header-crea_name,
ls_header-crea_tstut,
ls_header-chan_name,
ls_header-chan_tstut.
LOOP AT lt_entries ASSIGNING <ls_entry>.
CLEAR: <ls_entry>-version,
<ls_entry>-crea_name,
<ls_entry>-crea_tstut,
<ls_entry>-chan_name,
<ls_entry>-chan_tstut.
ENDLOOP.
APPEND INITIAL LINE TO rt_sotr ASSIGNING <ls_sotr>.
<ls_sotr>-header = ls_header.
<ls_sotr>-entries = lt_entries.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~delete.
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
EXPORTING
clskey = is_deletion_key
EXCEPTIONS
not_existing = 1
is_interface = 2
db_error = 3
no_access = 4
other = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from SEO_CLASS_DELETE_COMPLETE' ).
ENDIF.
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL lv_cp
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 345 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_INCLUDE_SPLIT' ).
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_DELETE' ).
ENDIF.
ENDIF.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error from RS_FUNCTIONMODULE_INSERT: {
sy-subrc } { sy-msgid }{ sy-msgno }| ).
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 346 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 0 AND lv_tabclass = 'TRANSP'.
* it cannot delete table with table wihtout asking
CREATE DATA lr_data TYPE (lv_objname).
ASSIGN lr_data->* TO <ls_data>.
SELECT SINGLE * FROM (lv_objname) INTO <ls_data>.
IF sy-subrc = 0.
lv_no_ask = abap_false.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE * FROM (lv_objname) INTO <ls_data>.
```
Explanation: Potential dangerous statement Dynamic SQL.
| 347 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS lcl_object_type IMPLEMENTATION.
METHOD lif_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD. "lif_object~has_changed_since
METHOD lif_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD lif_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD. "lif_object~get_metadata
METHOD lif_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD. "lif_object~exists
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
lv_typdname = ms_item-obj_name.
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TYPD_GET_OBJECT' ).
ENDIF.
ENDMETHOD. "read
METHOD lif_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD. "serialize
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_DD_TYGR_INSERT_SOURCES' ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD. "create
METHOD lif_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF lif_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
lcl_objects_activation=>add_item( ms_item ).
ENDMETHOD. "deserialize
METHOD lif_object~delete.
DATA: lv_objname TYPE rsedd0-ddobjname.
lv_objname = ms_item-obj_name.
CALL FUNCTION 'RS_DD_DELETE_OBJ'
EXPORTING
no_ask = abap_true
objname = lv_objname
objtype = 'G'
EXCEPTIONS
not_executed = 1
object_not_found = 2
object_not_specified = 3
permission_failure = 4
dialog_needed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error deleting TYPE' ).
ENDIF.
ENDMETHOD. "delete
METHOD lif_object~jump.
jump_se11( iv_radio = 'RSRD1-TYMA'
iv_field = 'RSRD1-TYMA_VAL' ).
ENDMETHOD. "jump
METHOD lif_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE lcl_comparison_null.
ENDMETHOD.
ENDCLASS. "lcl_object_type IMPLEMENTATION
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 348 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 349 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE sap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
zcx_abapgit_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'. "#EC CI_SUBRC
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSE.
zcx_abapgit_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ELSE.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'not found in PROGDIR' ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'PROG, error inserting' ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD. "deserialize_program
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 350 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
UPDATE progdir SET varcl = is_progdir-varcl
```
Explanation: Modify only own DB tables.
| 352 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
DATA lv_state TYPE c.
DATA lv_delete TYPE abap_bool.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
IF lv_language = mv_language.
lv_state = 'I'. "Textpool in master language needs to be activated
ELSE.
lv_state = 'A'. "Translations are always active
ENDIF.
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE iv_program "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "master language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
ELSE.
IF lines( it_tpool ) = 1 AND lv_language = mv_language.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN. "No action because description in master language is already there
ENDIF.
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE lv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
IF lv_state = 'I'. "Textpool in master language needs to be activated
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = iv_program
iv_delete = lv_delete ).
ENDIF.
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
ENDIF.
INSERT TEXTPOOL iv_program * <-- There is a problem here
FROM it_tpool
LANGUAGE lv_language
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 355 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
ENDIF.
TRY.
check_rfc_parameters( <ls_func> ).
CATCH zcx_abapgit_exception INTO lx_error.
ii_log->add_error(
iv_msg = |Function module { <ls_func>-funcname }: { lx_error->get_text( ) }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDTRY.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
corrnum = lv_corrnum
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ii_log->add_success( iv_msg = |Function module { <ls_func>-funcname } imported|
is_item = ms_item ).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 356 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_with_ext.
" Special treatment for extensions
" If the program name exceeds 30 characters it is not a usual ABAP program but might be
" some extension, which requires the internal addition EXTENSION TYPE
" https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm?file=abapinsert_report_internal.htm
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = is_progdir
i_progname = is_progdir-name
i_state = 'I'
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error updating program directory' ).
ENDIF.
zcl_abapgit_objects_activation=>add(
iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name
```
Explanation: Potential dangerous statement INSERT REPORT.
| 357 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 2.
" Drop also any inactive code that is left in REPOSRC
DELETE REPORT lv_program ##SUBRC_OK.
" Remove inactive objects from work area
lv_obj_name = lv_program.
CALL FUNCTION 'RS_DELETE_FROM_WORKING_AREA'
EXPORTING
object = 'REPS'
obj_name = lv_obj_name
immediate = 'X'
actualize_working_area = 'X'.
CALL FUNCTION 'RS_DELETE_FROM_WORKING_AREA'
EXPORTING
object = 'REPT'
obj_name = lv_obj_name
immediate = 'X'
actualize_working_area = 'X'.
ELSEIF sy-subrc <> 0.
```
|
I found vulnerabilities in the line:
```abap
DELETE REPORT lv_program ##SUBRC_OK.
```
Explanation: Potential dangerous statement DELETE REPORT.
| 358 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF lt_old <> it_source.
INSERT REPORT iv_program FROM it_source.
ASSERT sy-subrc = 0.
rv_updated = abap_true.
ELSE.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT iv_program FROM it_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 359 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS lcl_oo_class IMPLEMENTATION.
METHOD lif_oo_object_fnc~create.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
CHANGING
class = is_properties
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~generate_locals.
CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS'
EXPORTING
clskey = is_key
force = iv_force
locals_def = it_local_definitions
locals_imp = it_local_implementations
locals_mac = it_local_macros
locals_testclasses = it_local_test_classes
EXCEPTIONS
not_existing = 1
model_only = 2
locals_not_generated = 3
locals_not_initialised = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from generate_locals' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~insert_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
INSERT TEXTPOOL lv_cp
FROM it_text_pool
LANGUAGE iv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = lv_cp ).
ENDMETHOD.
METHOD lif_oo_object_fnc~create_sotr.
DATA: lt_sotr TYPE lif_defs=>ty_sotr_tt,
lt_objects TYPE sotr_objects,
ls_paket TYPE sotr_pack,
lv_object LIKE LINE OF lt_objects.
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF lt_sotr.
LOOP AT it_sotr ASSIGNING <ls_sotr>.
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
EXPORTING
object_vector = <ls_sotr>-header-objid_vec
IMPORTING
objects = lt_objects
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SOTR_OBJECT_GET_OBJECTS' ).
ENDIF.
READ TABLE lt_objects INDEX 1 INTO lv_object.
ASSERT sy-subrc = 0.
ls_paket-paket = iv_package.
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
EXPORTING
paket = ls_paket
crea_lan = <ls_sotr>-header-crea_lan
alias_name = <ls_sotr>-header-alias_name
object = lv_object
entries = <ls_sotr>-entries
concept_default = <ls_sotr>-header-concept
EXCEPTIONS
package_missing = 1
crea_lan_missing = 2
object_missing = 3
paket_does_not_exist = 4
alias_already_exist = 5
object_type_not_found = 6
langu_missing = 7
identical_context_not_allowed = 8
text_too_long = 9
error_in_update = 10
no_master_langu = 11
error_in_concept_id = 12
alias_not_allowed = 13
tadir_entry_creation_failed = 14
internal_error = 15
error_in_correction = 16
user_cancelled = 17
no_entry_found = 18
OTHERS = 19.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SOTR_CREATE_CONCEPT' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_includes.
* note: includes returned might not exist
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
DATA: lv_class_name TYPE seoclsname,
lt_methods TYPE seop_methods_w_include.
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
lv_class_name = iv_object_name.
APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes.
* skip the CS include, as it is sometimes generated on the fly instead of
* when the methods are changed
* APPEND cl_oo_classname_service=>get_cs_name( lv_class_name ) TO rt_includes.
cl_oo_classname_service=>get_all_method_includes(
EXPORTING
clsname = lv_class_name
RECEIVING
result = lt_methods
EXCEPTIONS
class_not_existing = 1 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Class { lv_class_name } not existing| ).
ENDIF.
LOOP AT lt_methods ASSIGNING <ls_method>.
APPEND <ls_method>-incname TO rt_includes.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_class_properties.
CALL FUNCTION 'SEO_CLIF_GET'
EXPORTING
cifkey = is_class_key
version = seoc_version_active
IMPORTING
class = rs_class_properties
EXCEPTIONS
not_existing = 1
deleted = 2
model_only = 3
OTHERS = 4.
IF sy-subrc = 1.
RETURN. " in case only inactive version exists
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from seo_clif_get' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~read_text_pool.
DATA:
lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP
ENDMETHOD.
METHOD lif_oo_object_fnc~read_sotr.
DATA: lv_concept TYPE sotr_head-concept,
lt_seocompodf TYPE STANDARD TABLE OF seocompodf WITH DEFAULT KEY,
ls_header TYPE sotr_head,
lt_entries TYPE sotr_text_tt.
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF rt_sotr,
<ls_seocompodf> LIKE LINE OF lt_seocompodf,
<ls_entry> LIKE LINE OF lt_entries.
SELECT * FROM seocompodf
INTO TABLE lt_seocompodf
WHERE clsname = iv_object_name
AND version = '1'
AND exposure = '2'
AND attdecltyp = '2'
AND type = 'SOTR_CONC'
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
LOOP AT lt_seocompodf ASSIGNING <ls_seocompodf>.
lv_concept = translate( val = <ls_seocompodf>-attvalue from = '''' to = '' ).
CALL FUNCTION 'SOTR_GET_CONCEPT'
EXPORTING
concept = lv_concept
IMPORTING
header = ls_header
TABLES
entries = lt_entries
EXCEPTIONS
no_entry_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
CLEAR: ls_header-paket,
ls_header-crea_name,
ls_header-crea_tstut,
ls_header-chan_name,
ls_header-chan_tstut.
LOOP AT lt_entries ASSIGNING <ls_entry>.
CLEAR: <ls_entry>-version,
<ls_entry>-crea_name,
<ls_entry>-crea_tstut,
<ls_entry>-chan_name,
<ls_entry>-chan_tstut.
ENDLOOP.
APPEND INITIAL LINE TO rt_sotr ASSIGNING <ls_sotr>.
<ls_sotr>-header = ls_header.
<ls_sotr>-entries = lt_entries.
ENDLOOP.
ENDMETHOD.
METHOD lif_oo_object_fnc~delete.
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
EXPORTING
clskey = is_deletion_key
EXCEPTIONS
not_existing = 1
is_interface = 2
db_error = 3
no_access = 4
other = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from SEO_CLASS_DELETE_COMPLETE' ).
ENDIF.
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL lv_cp
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 360 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS lcl_oo_base IMPLEMENTATION.
METHOD lif_oo_object_fnc~create.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~deserialize_source.
TRY.
deserialize_abap_source_new(
is_clskey = is_key
it_source = it_source ).
CATCH cx_sy_dyn_call_error.
deserialize_abap_source_old(
is_clskey = is_key
it_source = it_source ).
ENDTRY.
ENDMETHOD.
METHOD lif_oo_object_fnc~generate_locals.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD deserialize_abap_source_old.
"for backwards compatability down to 702
DATA: lo_source TYPE REF TO cl_oo_source.
CREATE OBJECT lo_source
EXPORTING
clskey = is_clskey
EXCEPTIONS
class_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from CL_OO_SOURCE' ).
ENDIF.
TRY.
lo_source->access_permission( seok_access_modify ).
lo_source->set_source( it_source ).
lo_source->save( ).
lo_source->access_permission( seok_access_free ).
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'permission error' ).
CATCH cx_oo_source_save_failure.
zcx_abapgit_exception=>raise( 'save failure' ).
ENDTRY.
ENDMETHOD.
METHOD deserialize_abap_source_new.
DATA: lo_factory TYPE REF TO object,
lo_source TYPE REF TO object.
CALL METHOD ('CL_OO_FACTORY')=>('CREATE_INSTANCE')
RECEIVING
result = lo_factory.
CALL METHOD lo_factory->('CREATE_CLIF_SOURCE')
EXPORTING
clif_name = is_clskey-clsname
RECEIVING
result = lo_source.
TRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~LOCK').
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'source_new, access permission exception' ).
ENDTRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SET_SOURCE')
EXPORTING
source = it_source.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SAVE').
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~UNLOCK').
ENDMETHOD.
METHOD lif_oo_object_fnc~add_to_activation_list.
lcl_objects_activation=>add_item( is_item ).
ENDMETHOD.
METHOD lif_oo_object_fnc~update_descriptions.
DELETE FROM seocompotx WHERE clsname = is_key-clsname. "#EC CI_SUBRC
INSERT seocompotx FROM TABLE it_descriptions. "#EC CI_SUBRC
ENDMETHOD.
METHOD lif_oo_object_fnc~insert_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~create_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~create_documentation.
CALL FUNCTION 'DOCU_UPD'
EXPORTING
id = 'CL'
langu = iv_language
object = iv_object_name
TABLES
line = it_lines
EXCEPTIONS
ret_code = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from DOCU_UPD' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_includes.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~exists.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = iv_object_name
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
rv_exists = boolc( sy-subrc <> 2 ).
ENDMETHOD.
METHOD lif_oo_object_fnc~serialize_abap.
DATA lo_oo_serializer TYPE REF TO lcl_oo_serializer.
CREATE OBJECT lo_oo_serializer.
CASE iv_type.
WHEN seop_ext_class_locals_def.
rt_source = lo_oo_serializer->serialize_locals_def( is_class_key ).
WHEN seop_ext_class_locals_imp.
rt_source = lo_oo_serializer->serialize_locals_imp( is_class_key ).
WHEN seop_ext_class_macros.
rt_source = lo_oo_serializer->serialize_macros( is_class_key ).
WHEN seop_ext_class_testclasses.
rt_source = lo_oo_serializer->serialize_testclasses( is_class_key ).
mv_skip_test_classes = lo_oo_serializer->are_test_classes_skipped( ).
WHEN OTHERS.
rt_source = lo_oo_serializer->serialize_abap_clif_source( is_class_key ).
ENDCASE.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_skip_test_classes.
rv_skip = mv_skip_test_classes.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_class_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~get_interface_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_documentation.
DATA: lv_state TYPE dokstate,
lv_object TYPE dokhl-object,
lt_lines TYPE tlinetab.
lv_object = iv_class_name.
CALL FUNCTION 'DOCU_GET'
EXPORTING
id = 'CL'
langu = iv_language
object = lv_object
IMPORTING
dokstate = lv_state
TABLES
line = lt_lines
EXCEPTIONS
no_docu_on_screen = 1
no_docu_self_def = 2
no_docu_temp = 3
ret_code = 4
OTHERS = 5.
IF sy-subrc = 0 AND lv_state = 'R'.
rt_lines = lt_lines.
ELSE.
CLEAR rt_lines.
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~read_descriptions.
SELECT * FROM seocompotx INTO TABLE rt_descriptions
WHERE clsname = iv_obejct_name
AND descript <> ''
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
ENDMETHOD.
METHOD lif_oo_object_fnc~delete.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_superclass.
SELECT SINGLE refclsname FROM vseoextend INTO rv_superclass
WHERE clsname = iv_classname.
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM seocompotx WHERE clsname = is_key-clsname.
```
Explanation: Modify only own DB tables.
```abap
INSERT seocompotx FROM TABLE it_descriptions.
```
Explanation: Modify only own DB tables.
| 362 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE sap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
zcx_abapgit_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'. "#EC CI_SUBRC
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
lcl_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
lcl_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSE.
zcx_abapgit_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
lcl_language=>restore_login_language( ).
ELSE.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'not found in PROGDIR' ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'PROG, error inserting' ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
lcl_objects_activation=>add( iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD. "deserialize_program
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 364 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF ( sy-subrc = 0 AND lines( it_tpool ) = 1 ) OR lines( it_tpool ) = 0.
RETURN. " no action for includes
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
IF lv_language = mv_language. " Add just once
lcl_objects_activation=>add( iv_type = 'REPT'
iv_name = iv_program ).
ENDIF.
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL iv_program
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 367 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD list_by_type.
SELECT * FROM (c_tabname)
INTO TABLE rt_content
WHERE type = iv_type. "#EC CI_SUBRC
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
METHOD list_by_type.
SELECT * FROM (c_tabname) * <-- There is a problem here
INTO TABLE rt_content
```
Explanation: Potential dangerous statement Dynamic SQL.
| 368 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD add.
DATA ls_table TYPE ty_content.
ls_table-type = iv_type.
ls_table-value = iv_value.
ls_table-data_str = iv_data.
INSERT (c_tabname) FROM ls_table. "#EC CI_SUBRC
ASSERT sy-subrc = 0.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
INSERT (c_tabname) FROM ls_table.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 370 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD update.
DATA lv_data LIKE iv_data.
lv_data = validate_and_unprettify_xml( iv_data ).
lock( iv_type = iv_type
iv_value = iv_value ).
UPDATE (c_tabname) SET data_str = lv_data
WHERE type = iv_type
AND value = iv_value.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'DB update failed' ).
ENDIF.
ENDMETHOD. "update
```
|
I found vulnerabilities in the line:
```abap
UPDATE (c_tabname) SET data_str = lv_data
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 372 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD modify.
DATA: ls_content TYPE ty_content.
lock( iv_type = iv_type
iv_value = iv_value ).
ls_content-type = iv_type.
ls_content-value = iv_value.
ls_content-data_str = iv_data.
MODIFY (c_tabname) FROM ls_content.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'DB modify failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY (c_tabname) FROM ls_content.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 373 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD read.
SELECT SINGLE data_str FROM (c_tabname) INTO rv_data
WHERE type = iv_type
AND value = iv_value. "#EC CI_SUBRC
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE lcx_not_found.
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE data_str FROM (c_tabname) INTO rv_data
```
Explanation: Potential dangerous statement Dynamic SQL.
| 374 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD create_report.
INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type.
ASSERT sy-subrc = 0.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 375 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD update_cs_number_of_methods.
" Indirect access to keep downward compatibility
DATA lr_cache_entry TYPE REF TO data.
FIELD-SYMBOLS: <lg_cache_entry> TYPE any,
<lg_field> TYPE any.
TRY.
CREATE DATA lr_cache_entry TYPE ('SEO_CS_CACHE').
CATCH cx_sy_create_data_error.
* does not exist in some older systems
RETURN.
ENDTRY.
ASSIGN lr_cache_entry->* TO <lg_cache_entry>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_classname.
ASSIGN COMPONENT 'NO_OF_METHOD_IMPLS' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_number_of_impl_methods.
MODIFY ('SEO_CS_CACHE') FROM <lg_cache_entry>.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY ('SEO_CS_CACHE') FROM <lg_cache_entry>.
```
Explanation: Modify only own DB tables.
| 376 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_oo_class IMPLEMENTATION.
METHOD create_report.
INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD determine_method_include.
DATA: ls_mtdkey TYPE seocpdkey.
ls_mtdkey-clsname = iv_name.
ls_mtdkey-cpdname = iv_method.
cl_oo_classname_service=>get_method_include(
EXPORTING
mtdkey = ls_mtdkey
RECEIVING
result = rv_program
EXCEPTIONS
method_not_existing = 1 ).
IF sy-subrc = 0.
RETURN.
ENDIF.
CALL FUNCTION 'SEO_METHOD_GENERATE_INCLUDE'
EXPORTING
suppress_mtdkey_check = abap_true
mtdkey = ls_mtdkey
EXCEPTIONS
not_existing = 1
model_only = 2
include_existing = 3
method_imp_not_generated = 4
method_imp_not_initialised = 5
_internal_class_not_existing = 6
_internal_method_overflow = 7
cancelled = 8
method_is_abstract_implemented = 9
method_is_final_implemented = 10
internal_error_insert_report = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from SEO_METHOD_GENERATE_INCLUDE. Subrc = { sy-subrc }| ).
ENDIF.
rv_program = cl_oo_classname_service=>get_method_include( ls_mtdkey ).
ENDMETHOD.
METHOD generate_classpool.
DATA: ls_clskey TYPE seoclskey.
ls_clskey-clsname = iv_name.
CALL FUNCTION 'SEO_CLASS_GENERATE_CLASSPOOL'
EXPORTING
clskey = ls_clskey
suppress_corr = abap_true
EXCEPTIONS
not_existing = 1
model_only = 2
class_pool_not_generated = 3
class_stment_not_generated = 4
locals_not_generated = 5
macros_not_generated = 6
public_sec_not_generated = 7
protected_sec_not_generated = 8
private_sec_not_generated = 9
typeref_not_generated = 10
class_pool_not_initialised = 11
class_stment_not_initialised = 12
locals_not_initialised = 13
macros_not_initialised = 14
public_sec_not_initialised = 15
protected_sec_not_initialised = 16
private_sec_not_initialised = 17
typeref_not_initialised = 18
_internal_class_overflow = 19
OTHERS = 20.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from SEO_CLASS_GENERATE_CLASSPOOL. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD init_scanner.
DATA: lx_exc TYPE REF TO cx_root,
lv_message TYPE string.
TRY.
ro_scanner = cl_oo_source_scanner_class=>create_class_scanner(
clif_name = iv_name
source = it_source ).
ro_scanner->scan( ).
CATCH cx_clif_scan_error.
zcx_abapgit_exception=>raise( 'error initializing CLAS scanner' ).
CATCH cx_root INTO lx_exc.
lv_message = lx_exc->get_text( ).
zcx_abapgit_exception=>raise( lv_message ).
ENDTRY.
ENDMETHOD.
METHOD update_cs_number_of_methods.
" Indirect access to keep downward compatibility
DATA lr_cache_entry TYPE REF TO data.
FIELD-SYMBOLS: <lg_cache_entry> TYPE any,
<lg_field> TYPE any.
TRY.
CREATE DATA lr_cache_entry TYPE ('SEO_CS_CACHE').
CATCH cx_sy_create_data_error.
* does not exist in some older systems
RETURN.
ENDTRY.
ASSIGN lr_cache_entry->* TO <lg_cache_entry>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_classname.
ASSIGN COMPONENT 'NO_OF_METHOD_IMPLS' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_number_of_impl_methods.
MODIFY ('SEO_CS_CACHE') FROM <lg_cache_entry>.
ENDMETHOD.
METHOD update_full_class_include.
CONSTANTS: lc_class_source_extension TYPE c LENGTH 2 VALUE 'CS',
lc_include_program_type TYPE c LENGTH 1 VALUE 'I',
lc_active_version TYPE r3state VALUE 'A'.
create_report( iv_program = cl_oo_classname_service=>get_cs_name( iv_classname )
it_source = it_source
iv_extension = lc_class_source_extension
iv_program_type = lc_include_program_type
iv_version = lc_active_version ).
" Assuming that all methods that were scanned are implemented
update_cs_number_of_methods( iv_classname = iv_classname
iv_number_of_impl_methods = lines( it_methods ) ).
ENDMETHOD.
METHOD update_meta.
DATA: lo_update TYPE REF TO cl_oo_class_section_source,
ls_clskey TYPE seoclskey,
lv_scan_error TYPE abap_bool.
ls_clskey-clsname = iv_name.
TRY.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
cifkey = ls_clskey
version = seoc_version_active.
CREATE OBJECT lo_update TYPE ('CL_OO_CLASS_SECTION_SOURCE')
EXPORTING
clskey = ls_clskey
exposure = iv_exposure
state = 'A'
source = it_source
suppress_constrctr_generation = abap_true
EXCEPTIONS
class_not_existing = 1
read_source_error = 2
OTHERS = 3 ##SUBRC_OK.
CATCH cx_sy_dyn_call_param_not_found.
* downport to 702, see https://github.com/larshp/abapGit/issues/933
* this will READ REPORT instead of using it_source, which should be okay
CREATE OBJECT lo_update TYPE cl_oo_class_section_source
EXPORTING
clskey = ls_clskey
exposure = iv_exposure
state = 'A'
EXCEPTIONS
class_not_existing = 1
read_source_error = 2
OTHERS = 3.
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error instantiating CL_OO_CLASS_SECTION_SOURCE. Subrc = { sy-subrc }| ).
ENDIF.
lo_update->set_dark_mode( abap_true ).
TRY.
CALL METHOD lo_update->('SET_AMDP_SUPPORT')
EXPORTING
enabled = abap_true.
CATCH cx_sy_dyn_call_illegal_method ##NO_HANDLER.
* AMDP not supported in this system, ignore error
ENDTRY.
lo_update->scan_section_source(
RECEIVING
scan_error = lv_scan_error
EXCEPTIONS
scan_abap_source_error = 1
OTHERS = 2 ).
IF sy-subrc <> 0 OR lv_scan_error = abap_true.
zcx_abapgit_exception=>raise( |CLAS, error while scanning source. Subrc = { sy-subrc }| ).
ENDIF.
* this will update the SEO* database tables
lo_update->revert_scan_result( ).
IF iv_exposure = seoc_exposure_public.
generate_classpool( iv_name ).
ENDIF.
ENDMETHOD.
METHOD update_report.
DATA: lt_old TYPE string_table.
READ REPORT iv_program INTO lt_old.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Fatal error. Include { iv_program } should have been created previously!| ).
ENDIF.
IF lt_old <> it_source.
INSERT REPORT iv_program FROM it_source.
ASSERT sy-subrc = 0.
rv_updated = abap_true.
ELSE.
rv_updated = abap_false.
ENDIF.
ENDMETHOD.
METHOD update_source_index.
CONSTANTS:
lc_version_active TYPE r3state VALUE 'A', "#EC NOTEXT
lc_version_inactive TYPE r3state VALUE 'I'. "#EC NOTEXT
" dynamic invocation, IF_OO_SOURCE_POS_INDEX_HELPER doesn't exist in 702.
DATA lo_index_helper TYPE REF TO object.
TRY.
CREATE OBJECT lo_index_helper TYPE ('CL_OO_SOURCE_POS_INDEX_HELPER').
CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~CREATE_INDEX_WITH_SCANNER')
EXPORTING
class_name = iv_clsname
version = lc_version_active
scanner = io_scanner.
CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~DELETE_INDEX')
EXPORTING
class_name = iv_clsname
version = lc_version_inactive.
CATCH cx_root.
" it's probably okay to no update the index
RETURN.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create.
DATA: lt_vseoattrib TYPE seoo_attributes_r.
FIELD-SYMBOLS: <lv_clsname> TYPE seoclsname.
* same as in super class, but with "version = seoc_version_active"
ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE cg_properties TO <lv_clsname>.
ASSERT sy-subrc = 0.
lt_vseoattrib = convert_attrib_to_vseoattrib(
iv_clsname = <lv_clsname>
it_attributes = it_attributes ).
TRY.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
version = seoc_version_active
suppress_dialog = abap_true " Parameter missing in 702
CHANGING
class = cg_properties
attributes = lt_vseoattrib
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
CATCH cx_sy_dyn_call_param_not_found.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
version = seoc_version_active
CHANGING
class = cg_properties
attributes = lt_vseoattrib
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from SEO_CLASS_CREATE_COMPLETE. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create_sotr.
DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt,
lt_objects TYPE sotr_objects,
ls_paket TYPE sotr_pack,
lv_object LIKE LINE OF lt_objects.
FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF lt_sotr.
LOOP AT it_sotr ASSIGNING <ls_sotr>.
CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS'
EXPORTING
object_vector = <ls_sotr>-header-objid_vec
IMPORTING
objects = lt_objects
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error from SOTR_OBJECT_GET_OBJECTS. Subrc = { sy-subrc }| ).
ENDIF.
READ TABLE lt_objects INDEX 1 INTO lv_object.
ASSERT sy-subrc = 0.
ls_paket-paket = iv_package.
CALL FUNCTION 'SOTR_CREATE_CONCEPT'
EXPORTING
paket = ls_paket
crea_lan = <ls_sotr>-header-crea_lan
alias_name = <ls_sotr>-header-alias_name
object = lv_object
entries = <ls_sotr>-entries
concept_default = <ls_sotr>-header-concept
EXCEPTIONS
package_missing = 1
crea_lan_missing = 2
object_missing = 3
paket_does_not_exist = 4
alias_already_exist = 5
object_type_not_found = 6
langu_missing = 7
identical_context_not_allowed = 8
text_too_long = 9
error_in_update = 10
no_master_langu = 11
error_in_concept_id = 12
alias_not_allowed = 13
tadir_entry_creation_failed = 14
internal_error = 15
error_in_correction = 16
user_cancelled = 17
no_entry_found = 18
OTHERS = 19.
IF sy-subrc <> 0 AND sy-subrc <> 5.
zcx_abapgit_exception=>raise( |Error from SOTR_CREATE_CONCEPT. Subrc = { sy-subrc }| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~delete.
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
EXPORTING
clskey = is_deletion_key
EXCEPTIONS
not_existing = 1
is_interface = 2
db_error = 3
no_access = 4
other = 5
OTHERS = 6.
IF sy-subrc = 1.
* ignore deletion of objects that does not exist
* this can happen when the SXCI object is deleted before the implementing CLAS
RETURN.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from SEO_CLASS_DELETE_COMPLETE. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~deserialize_source.
DATA: lv_updated TYPE abap_bool,
lv_program TYPE program,
lo_scanner TYPE REF TO cl_oo_source_scanner_class,
lt_methods TYPE cl_oo_source_scanner_class=>type_method_implementations,
lv_method LIKE LINE OF lt_methods,
lt_public TYPE seop_source_string,
lt_source TYPE seop_source_string.
"Buffer needs to be refreshed,
"otherwise standard SAP CLIF_SOURCE reorder methods alphabetically
CALL FUNCTION 'SEO_BUFFER_INIT'.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
cifkey = is_key
version = seoc_version_inactive.
lo_scanner = init_scanner(
it_source = it_source
iv_name = is_key-clsname ).
* public
lt_public = lo_scanner->get_public_section_source( ).
IF lt_public IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_pubsec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_public ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_public
it_source = lt_public ).
ENDIF.
ENDIF.
* protected
lt_source = lo_scanner->get_protected_section_source( ).
IF lt_source IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_prosec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_source ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_protected
it_source = lt_source ).
ENDIF.
ENDIF.
* private
lt_source = lo_scanner->get_private_section_source( ).
IF lt_source IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_prisec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_source ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_private
it_source = lt_source ).
ENDIF.
ENDIF.
* methods
lt_methods = lo_scanner->get_method_implementations( ).
LOOP AT lt_methods INTO lv_method.
TRY.
lt_source = lo_scanner->get_method_impl_source( lv_method ).
CATCH cx_oo_clif_component.
zcx_abapgit_exception=>raise( 'error from GET_METHOD_IMPL_SOURCE' ).
ENDTRY.
lv_program = determine_method_include(
iv_name = is_key-clsname
iv_method = lv_method ).
update_report(
iv_program = lv_program
it_source = lt_source ).
ENDLOOP.
* full class include
update_full_class_include( iv_classname = is_key-clsname
it_source = it_source
it_methods = lt_methods ).
update_source_index(
iv_clsname = is_key-clsname
io_scanner = lo_scanner ).
* TODO, perhaps move this call to somewhere else, to be done while cleaning up the CLAS deserialization
zcl_abapgit_objects_activation=>add(
iv_type = 'CLAS'
iv_name = is_key-clsname ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~generate_locals.
DATA: lv_program TYPE programm.
IF lines( it_local_definitions ) > 0.
lv_program = cl_oo_classname_service=>get_ccdef_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_definitions ).
ENDIF.
IF lines( it_local_implementations ) > 0.
lv_program = cl_oo_classname_service=>get_ccimp_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_implementations ).
ENDIF.
IF lines( it_local_macros ) > 0.
lv_program = cl_oo_classname_service=>get_ccmac_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_macros ).
ENDIF.
IF lines( it_local_test_classes ) > 0.
lv_program = cl_oo_classname_service=>get_ccau_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_test_classes ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_class_properties.
CALL FUNCTION 'SEO_CLIF_GET'
EXPORTING
cifkey = is_class_key
version = seoc_version_active
IMPORTING
class = rs_class_properties
EXCEPTIONS
not_existing = 1
deleted = 2
model_only = 3
OTHERS = 4.
IF sy-subrc = 1.
RETURN. " in case only inactive version exists
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from SEO_CLIF_GET. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_includes.
* note: includes returned might not exist
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
DATA: lv_class_name TYPE seoclsname,
lt_methods TYPE seop_methods_w_include.
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
lv_class_name = iv_object_name.
APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes.
* skip the CS include, as it is sometimes generated on the fly instead of
* when the methods are changed
cl_oo_classname_service=>get_all_method_includes(
EXPORTING
clsname = lv_class_name
RECEIVING
result = lt_methods
EXCEPTIONS
class_not_existing = 1 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Class { lv_class_name } not existing| ).
ENDIF.
LOOP AT lt_methods ASSIGNING <ls_method>.
APPEND <ls_method>-incname TO rt_includes.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~insert_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
INSERT TEXTPOOL lv_cp
FROM it_text_pool
LANGUAGE iv_language
STATE iv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
zcl_abapgit_objects_activation=>add( iv_type = 'REPT'
iv_name = lv_cp ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_sotr.
rt_sotr = zcl_abapgit_sotr_handler=>read_sotr_seocomp( iv_object_name ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL lv_cp
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 378 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD delete.
lock( iv_type = iv_type
iv_value = iv_value ).
DELETE FROM (c_tabname)
WHERE type = iv_type
AND value = iv_value.
IF sy-subrc <> 0.
lcx_exception=>raise( 'DB Delete failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM (c_tabname)
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 382 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD update.
validate_xml( iv_data ).
lock( iv_type = iv_type
iv_value = iv_value ).
UPDATE (c_tabname) SET data_str = iv_data
WHERE type = iv_type
AND value = iv_value.
IF sy-subrc <> 0.
lcx_exception=>raise( 'DB update failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
UPDATE (c_tabname) SET data_str = iv_data
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 383 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD modify.
DATA: ls_content TYPE ty_content.
lock( iv_type = iv_type
iv_value = iv_value ).
ls_content-type = iv_type.
ls_content-value = iv_value.
ls_content-data_str = iv_data.
MODIFY (c_tabname) FROM ls_content.
IF sy-subrc <> 0.
lcx_exception=>raise( 'DB modify failed' ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY (c_tabname) FROM ls_content.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 384 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 2.
" Drop also any inactive code that is left in REPOSRC
DELETE REPORT lv_program ##SUBRC_OK.
ELSEIF sy-subrc <> 0.
```
|
I found vulnerabilities in the line:
```abap
DELETE REPORT lv_program ##SUBRC_OK.
```
Explanation: Potential dangerous statement DELETE REPORT.
| 386 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE sap_bool,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
zcx_abapgit_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'. "#EC CI_SUBRC
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
lv_exists = abap_true.
ELSE.
lv_exists = abap_false.
ENDIF.
IF lv_exists = abap_true.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSE.
zcx_abapgit_exception=>raise( 'PROG, error updating' ).
ENDIF.
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ELSE.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
IF strlen( is_progdir-name ) > 30.
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT' ).
ENDIF.
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'not found in PROGDIR' ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'PROG, error inserting' ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
zcl_abapgit_objects_activation=>add(
iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD. "deserialize_program
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 388 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
DATA lv_state TYPE c.
DATA lv_delete TYPE abap_bool.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
IF lv_language = mv_language.
lv_state = 'I'. "Textpool in master language needs to be activated
ELSE.
lv_state = 'A'. "Translations are always active
ENDIF.
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE iv_program "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "master language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
ELSE.
IF lines( it_tpool ) = 1 AND lv_language = mv_language.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN. "No action because description in master language is already there
ENDIF.
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE lv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
IF lv_state = 'I'. "Textpool in master language needs to be activated
zcl_abapgit_objects_activation=>add(
iv_type = 'REPT'
iv_name = iv_program
iv_delete = lv_delete ).
ENDIF.
ENDMETHOD. "deserialize_textpool
```
|
I found vulnerabilities in the line:
```abap
ENDIF.
INSERT TEXTPOOL iv_program * <-- There is a problem here
FROM it_tpool
LANGUAGE lv_language
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 392 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_where INTO lv_where.
SELECT * FROM (iv_name) APPENDING TABLE <lg_tab> WHERE (lv_where).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
SELECT * FROM (iv_name) APPENDING TABLE <lg_tab> WHERE (lv_where).
```
Explanation: Potential dangerous statement Dynamic SQL.
| 393 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF lines( it_where ) = 0.
SELECT * FROM (iv_name) INTO TABLE <lg_tab>.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
SELECT * FROM (iv_name) INTO TABLE <lg_tab>.
```
Explanation: Potential dangerous statement Dynamic SQL.
| 394 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
ENDIF.
TRY.
check_rfc_parameters( <ls_func> ).
CATCH zcx_abapgit_exception INTO lx_error.
ii_log->add_error(
iv_msg = |Function module { <ls_func>-funcname }: { lx_error->get_text( ) }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDTRY.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
corrnum = iv_transport
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ii_log->add_success( iv_msg = |Function module { <ls_func>-funcname } imported|
is_item = ms_item ).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 395 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD delete_report.
DELETE REPORT iv_program ##SUBRC_OK.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
DELETE REPORT iv_program ##SUBRC_OK.
```
Explanation: Potential dangerous statement DELETE REPORT.
| 397 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_oo_class IMPLEMENTATION.
METHOD create_report.
INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD delete_report.
DELETE REPORT iv_program ##SUBRC_OK.
ENDMETHOD.
METHOD determine_method_include.
DATA: ls_mtdkey TYPE seocpdkey.
ls_mtdkey-clsname = iv_name.
ls_mtdkey-cpdname = iv_method.
cl_oo_classname_service=>get_method_include(
EXPORTING
mtdkey = ls_mtdkey
RECEIVING
result = rv_program
EXCEPTIONS
method_not_existing = 1 ).
IF sy-subrc = 0.
RETURN.
ENDIF.
CALL FUNCTION 'SEO_METHOD_GENERATE_INCLUDE'
EXPORTING
suppress_mtdkey_check = abap_true
mtdkey = ls_mtdkey
EXCEPTIONS
not_existing = 1
model_only = 2
include_existing = 3
method_imp_not_generated = 4
method_imp_not_initialised = 5
_internal_class_not_existing = 6
_internal_method_overflow = 7
cancelled = 8
method_is_abstract_implemented = 9
method_is_final_implemented = 10
internal_error_insert_report = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
rv_program = cl_oo_classname_service=>get_method_include( ls_mtdkey ).
ENDMETHOD.
METHOD generate_classpool.
DATA: ls_clskey TYPE seoclskey.
ls_clskey-clsname = iv_name.
CALL FUNCTION 'SEO_CLASS_GENERATE_CLASSPOOL'
EXPORTING
clskey = ls_clskey
suppress_corr = abap_true
EXCEPTIONS
not_existing = 1
model_only = 2
class_pool_not_generated = 3
class_stment_not_generated = 4
locals_not_generated = 5
macros_not_generated = 6
public_sec_not_generated = 7
protected_sec_not_generated = 8
private_sec_not_generated = 9
typeref_not_generated = 10
class_pool_not_initialised = 11
class_stment_not_initialised = 12
locals_not_initialised = 13
macros_not_initialised = 14
public_sec_not_initialised = 15
protected_sec_not_initialised = 16
private_sec_not_initialised = 17
typeref_not_initialised = 18
_internal_class_overflow = 19
OTHERS = 20.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD init_scanner.
DATA: lx_exc TYPE REF TO cx_root,
lv_message TYPE string,
lv_classname TYPE abap_abstypename.
FIELD-SYMBOLS: <lv_line> TYPE i.
TRY.
ro_scanner = cl_oo_source_scanner_class=>create_class_scanner(
clif_name = iv_name
source = it_source ).
ro_scanner->scan( ).
CATCH cx_clif_scan_error.
zcx_abapgit_exception=>raise( 'error initializing CLAS scanner' ).
CATCH cx_root INTO lx_exc.
lv_classname = cl_abap_classdescr=>get_class_name( lx_exc ).
IF lv_classname = '\CLASS=CX_OO_CLIF_SCAN_ERROR_DETAIL'.
ASSIGN lx_exc->('SOURCE_POSITION-LINE') TO <lv_line>.
ASSERT sy-subrc = 0.
lv_message = |{ lx_exc->get_text( ) }, line { <lv_line> }|.
ELSE.
lv_message = lx_exc->get_text( ).
ENDIF.
zcx_abapgit_exception=>raise( lv_message ).
ENDTRY.
ENDMETHOD.
METHOD update_cs_number_of_methods.
" Indirect access to keep downward compatibility
DATA lr_cache_entry TYPE REF TO data.
FIELD-SYMBOLS: <lg_cache_entry> TYPE any,
<lg_field> TYPE any.
TRY.
CREATE DATA lr_cache_entry TYPE ('SEO_CS_CACHE').
CATCH cx_sy_create_data_error.
* does not exist in some older systems
RETURN.
ENDTRY.
ASSIGN lr_cache_entry->* TO <lg_cache_entry>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_classname.
ASSIGN COMPONENT 'NO_OF_METHOD_IMPLS' OF STRUCTURE <lg_cache_entry>
TO <lg_field>.
ASSERT sy-subrc = 0.
<lg_field> = iv_number_of_impl_methods.
MODIFY ('SEO_CS_CACHE') FROM <lg_cache_entry>.
ENDMETHOD.
METHOD update_full_class_include.
CONSTANTS: lc_class_source_extension TYPE c LENGTH 2 VALUE 'CS',
lc_include_program_type TYPE c LENGTH 1 VALUE 'I',
lc_active_version TYPE r3state VALUE 'A'.
create_report( iv_program = cl_oo_classname_service=>get_cs_name( iv_classname )
it_source = it_source
iv_extension = lc_class_source_extension
iv_program_type = lc_include_program_type
iv_version = lc_active_version ).
" Assuming that all methods that were scanned are implemented
update_cs_number_of_methods( iv_classname = iv_classname
iv_number_of_impl_methods = lines( it_methods ) ).
ENDMETHOD.
METHOD update_meta.
DATA: lo_update TYPE REF TO cl_oo_class_section_source,
ls_clskey TYPE seoclskey,
lv_scan_error TYPE abap_bool.
ls_clskey-clsname = iv_name.
TRY.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
cifkey = ls_clskey
version = seoc_version_active.
CREATE OBJECT lo_update TYPE ('CL_OO_CLASS_SECTION_SOURCE')
EXPORTING
clskey = ls_clskey
exposure = iv_exposure
state = 'A'
source = it_source
suppress_constrctr_generation = abap_true
EXCEPTIONS
class_not_existing = 1
read_source_error = 2
OTHERS = 3 ##SUBRC_OK.
CATCH cx_sy_dyn_call_param_not_found.
* downport to 702, see https://github.com/abapGit/abapGit/issues/933
* this will READ REPORT instead of using it_source, which should be okay
CREATE OBJECT lo_update TYPE cl_oo_class_section_source
EXPORTING
clskey = ls_clskey
exposure = iv_exposure
state = 'A'
EXCEPTIONS
class_not_existing = 1
read_source_error = 2
OTHERS = 3.
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lo_update->set_dark_mode( abap_true ).
TRY.
CALL METHOD lo_update->('SET_AMDP_SUPPORT')
EXPORTING
enabled = abap_true.
CATCH cx_sy_dyn_call_illegal_method ##NO_HANDLER.
* AMDP not supported in this system, ignore error
ENDTRY.
lo_update->scan_section_source(
RECEIVING
scan_error = lv_scan_error
EXCEPTIONS
scan_abap_source_error = 1
OTHERS = 2 ).
IF sy-subrc <> 0 OR lv_scan_error = abap_true.
zcx_abapgit_exception=>raise( |CLAS, error while scanning source. Subrc = { sy-subrc }| ).
ENDIF.
* this will update the SEO* database tables
lo_update->revert_scan_result( ).
IF iv_exposure = seoc_exposure_public.
generate_classpool( iv_name ).
ENDIF.
ENDMETHOD.
METHOD update_report.
DATA: lt_old TYPE string_table.
READ REPORT iv_program INTO lt_old.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Fatal error. Include { iv_program } should have been created previously!| ).
ENDIF.
IF lt_old <> it_source.
INSERT REPORT iv_program FROM it_source.
ASSERT sy-subrc = 0.
rv_updated = abap_true.
ELSE.
rv_updated = abap_false.
ENDIF.
ENDMETHOD.
METHOD update_source_index.
CONSTANTS:
lc_version_active TYPE r3state VALUE 'A',
lc_version_inactive TYPE r3state VALUE 'I'.
" dynamic invocation, IF_OO_SOURCE_POS_INDEX_HELPER doesn't exist in 702.
DATA lo_index_helper TYPE REF TO object.
TRY.
CREATE OBJECT lo_index_helper TYPE ('CL_OO_SOURCE_POS_INDEX_HELPER').
CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~CREATE_INDEX_WITH_SCANNER')
EXPORTING
class_name = iv_clsname
version = lc_version_active
scanner = io_scanner.
CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~DELETE_INDEX')
EXPORTING
class_name = iv_clsname
version = lc_version_inactive.
CATCH cx_root.
" it's probably okay to no update the index
RETURN.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create.
DATA: lt_vseoattrib TYPE seoo_attributes_r.
FIELD-SYMBOLS: <lv_clsname> TYPE seoclsname.
* same as in super class, but with "version = seoc_version_active"
ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE cg_properties TO <lv_clsname>.
ASSERT sy-subrc = 0.
lt_vseoattrib = convert_attrib_to_vseoattrib(
iv_clsname = <lv_clsname>
it_attributes = it_attributes ).
TRY.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
version = seoc_version_active
suppress_dialog = abap_true " Parameter missing in 702
CHANGING
class = cg_properties
attributes = lt_vseoattrib
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
CATCH cx_sy_dyn_call_param_not_found.
CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE'
EXPORTING
devclass = iv_package
overwrite = iv_overwrite
version = seoc_version_active
CHANGING
class = cg_properties
attributes = lt_vseoattrib
EXCEPTIONS
existing = 1
is_interface = 2
db_error = 3
component_error = 4
no_access = 5
other = 6
OTHERS = 7.
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create_sotr.
zcl_abapgit_sotr_handler=>create_sotr(
iv_package = iv_package
io_xml = ii_xml ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~delete.
CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE'
EXPORTING
clskey = is_deletion_key
EXCEPTIONS
not_existing = 1
is_interface = 2
db_error = 3
no_access = 4
other = 5
OTHERS = 6.
IF sy-subrc = 1.
* ignore deletion of objects that does not exist
* this can happen when the SXCI object is deleted before the implementing CLAS
RETURN.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~deserialize_source.
DATA: lv_updated TYPE abap_bool,
lv_program TYPE program,
lo_scanner TYPE REF TO cl_oo_source_scanner_class,
lt_methods TYPE cl_oo_source_scanner_class=>type_method_implementations,
lv_method LIKE LINE OF lt_methods,
lt_public TYPE seop_source_string,
lt_source TYPE seop_source_string.
"Buffer needs to be refreshed,
"otherwise standard SAP CLIF_SOURCE reorder methods alphabetically
CALL FUNCTION 'SEO_BUFFER_INIT'.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
cifkey = is_key
version = seoc_version_inactive.
lo_scanner = init_scanner(
it_source = it_source
iv_name = is_key-clsname ).
* public
lt_public = lo_scanner->get_public_section_source( ).
IF lt_public IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_pubsec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_public ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_public
it_source = lt_public ).
ENDIF.
ENDIF.
* protected
lt_source = lo_scanner->get_protected_section_source( ).
IF lt_source IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_prosec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_source ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_protected
it_source = lt_source ).
ENDIF.
ENDIF.
* private
lt_source = lo_scanner->get_private_section_source( ).
IF lt_source IS NOT INITIAL.
lv_program = cl_oo_classname_service=>get_prisec_name( is_key-clsname ).
lv_updated = update_report( iv_program = lv_program
it_source = lt_source ).
IF lv_updated = abap_true.
update_meta( iv_name = is_key-clsname
iv_exposure = seoc_exposure_private
it_source = lt_source ).
ENDIF.
ENDIF.
* methods
lt_methods = lo_scanner->get_method_implementations( ).
LOOP AT lt_methods INTO lv_method.
TRY.
lt_source = lo_scanner->get_method_impl_source( lv_method ).
CATCH cx_oo_clif_component.
zcx_abapgit_exception=>raise( 'error from GET_METHOD_IMPL_SOURCE' ).
ENDTRY.
lv_program = determine_method_include(
iv_name = is_key-clsname
iv_method = lv_method ).
update_report(
iv_program = lv_program
it_source = lt_source ).
ENDLOOP.
* full class include
update_full_class_include( iv_classname = is_key-clsname
it_source = it_source
it_methods = lt_methods ).
update_source_index(
iv_clsname = is_key-clsname
io_scanner = lo_scanner ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~exists.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = is_object_name
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
rv_exists = boolc( sy-subrc = 0 OR sy-subrc = 4 ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~generate_locals.
DATA: lv_program TYPE programm.
IF lines( it_local_definitions ) > 0.
lv_program = cl_oo_classname_service=>get_ccdef_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_definitions ).
ENDIF.
IF lines( it_local_implementations ) > 0.
lv_program = cl_oo_classname_service=>get_ccimp_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_implementations ).
ENDIF.
IF lines( it_local_macros ) > 0.
lv_program = cl_oo_classname_service=>get_ccmac_name( is_key-clsname ).
update_report( iv_program = lv_program
it_source = it_local_macros ).
ENDIF.
lv_program = cl_oo_classname_service=>get_ccau_name( is_key-clsname ).
IF lines( it_local_test_classes ) > 0.
update_report( iv_program = lv_program
it_source = it_local_test_classes ).
ELSE.
" Drop the include to remove left-over test classes
delete_report( lv_program ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_class_properties.
CALL FUNCTION 'SEO_CLIF_GET'
EXPORTING
cifkey = is_class_key
version = seoc_version_active
IMPORTING
class = rs_class_properties
EXCEPTIONS
not_existing = 1
deleted = 2
model_only = 3
OTHERS = 4.
IF sy-subrc = 1.
RETURN. " in case only inactive version exists
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_includes.
* note: includes returned might not exist
* method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702
DATA: lv_class_name TYPE seoclsname,
lt_methods TYPE seop_methods_w_include.
FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods.
lv_class_name = iv_object_name.
APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes.
APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes.
* skip the CS include, as it is sometimes generated on the fly instead of
* when the methods are changed
cl_oo_classname_service=>get_all_method_includes(
EXPORTING
clsname = lv_class_name
RECEIVING
result = lt_methods
EXCEPTIONS
class_not_existing = 1 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Class { lv_class_name } not existing| ).
ENDIF.
LOOP AT lt_methods ASSIGNING <ls_method>.
APPEND <ls_method>-incname TO rt_includes.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~insert_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
INSERT TEXTPOOL lv_cp
FROM it_text_pool
LANGUAGE iv_language
STATE iv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
zcl_abapgit_objects_activation=>add( iv_type = 'REPT'
iv_name = lv_cp ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_sotr.
zcl_abapgit_sotr_handler=>read_sotr(
iv_pgmid = 'LIMU'
iv_object = 'CPUB'
iv_obj_name = iv_object_name
io_xml = ii_xml ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_text_pool.
DATA: lv_cp TYPE program.
lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ).
READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT TEXTPOOL lv_cp
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 400 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_program.
DATA: lv_exists TYPE abap_bool,
lt_empty_src LIKE it_source,
lv_progname TYPE reposrc-progname,
ls_tpool LIKE LINE OF it_tpool,
lv_title TYPE rglif-title,
ls_progdir_new TYPE progdir.
FIELD-SYMBOLS: <lg_any> TYPE any.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'I'
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'.
IF sy-subrc = 0.
* there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
* cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
lv_title = ls_tpool-entry.
ENDIF.
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
lv_exists = boolc( sy-subrc = 0 ).
IF lv_exists = abap_true.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = lv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSEIF sy-msgid = 'EU' AND sy-msgno = '522'.
* for generated table maintenance function groups, the author is set to SAP* instead of the user which
* generates the function group. This hits some standard checks, pulling new code again sets the author
* to the current user which avoids the check
zcx_abapgit_exception=>raise( |Delete function group and pull again, { is_progdir-name } (EU522)| ).
ELSE.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ELSEIF strlen( is_progdir-name ) > 30.
* function module RPY_PROGRAM_INSERT cannot handle function group includes
" special treatment for extensions
" if the program name exceeds 30 characters it is not a usual
" ABAP program but might be some extension, which requires the internal
" addition EXTENSION TYPE, see
" http://help.sap.com/abapdocu_751/en/abapinsert_report_internal.htm#!ABAP_ADDITION_1@1@
" This e.g. occurs in case of transportable Code Inspector variants (ending with ===VC)
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
EXTENSION TYPE is_progdir-name+30.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT REPORT .. EXTENSION TYPE' ).
ENDIF.
ELSE.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |not found in PROGDIR. Subrc = { sy-subrc }| ).
ENDIF.
* todo, package?
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
ls_progdir_new-sqlx = is_progdir-sqlx.
ls_progdir_new-uccheck = is_progdir-uccheck.
ls_progdir_new-clas = is_progdir-clas.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |PROG, error inserting. Subrc = { sy-subrc }| ).
ENDIF.
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl = space AND ls_progdir_new-varcl = abap_true.
* function module UPDATE_PROGDIR does not update VARCL
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
zcl_abapgit_objects_activation=>add(
iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
```abap
ELSE.
INSERT REPORT is_progdir-name * <-- There is a problem here
FROM it_source
```
Explanation: Potential dangerous statement INSERT REPORT.
| 402 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE lv_language "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
```
|
I found vulnerabilities in the line:
```abap
DELETE TEXTPOOL iv_program
```
Explanation: Potential dangerous statement DELETE TEXTPOOL.
| 404 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE lv_language "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "main language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in * <-- There is a problem here
FROM it_tpool
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 405 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_textpool.
DATA lv_language TYPE langu.
DATA lv_state TYPE c.
DATA lv_delete TYPE abap_bool.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
IF lv_language = mv_language.
lv_state = 'I'. "Textpool in main language needs to be activated
ELSE.
lv_state = 'A'. "Translations are always active
ENDIF.
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE lv_language "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "main language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
ELSE.
IF lines( it_tpool ) = 1 AND lv_language = mv_language.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN. "No action because description in main language is already there
ENDIF.
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE lv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
IF lv_state = 'I'. "Textpool in main language needs to be activated
zcl_abapgit_objects_activation=>add(
iv_type = 'REPT'
iv_name = iv_program
iv_delete = lv_delete ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
ENDIF.
INSERT TEXTPOOL iv_program * <-- There is a problem here
FROM it_tpool
LANGUAGE lv_language
```
Explanation: Potential dangerous statement INSERT TEXTPOOL.
| 406 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS lcl_oo_base IMPLEMENTATION.
METHOD lif_oo_object_fnc~create.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~deserialize_source.
TRY.
deserialize_abap_source_new(
is_clskey = is_key
it_source = it_source ).
CATCH cx_sy_dyn_call_error.
deserialize_abap_source_old(
is_clskey = is_key
it_source = it_source ).
ENDTRY.
ENDMETHOD.
METHOD lif_oo_object_fnc~generate_locals.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD deserialize_abap_source_old.
"for backwards compatability down to 702
DATA: lo_source TYPE REF TO cl_oo_source.
CREATE OBJECT lo_source
EXPORTING
clskey = is_clskey
EXCEPTIONS
class_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from CL_OO_SOURCE' ).
ENDIF.
TRY.
lo_source->access_permission( seok_access_modify ).
lo_source->set_source( it_source ).
lo_source->save( ).
lo_source->access_permission( seok_access_free ).
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'permission error' ).
CATCH cx_oo_source_save_failure.
zcx_abapgit_exception=>raise( 'save failure' ).
ENDTRY.
ENDMETHOD.
METHOD deserialize_abap_source_new.
DATA: lo_factory TYPE REF TO object,
lo_source TYPE REF TO object,
lo_settings TYPE REF TO object,
lr_settings TYPE REF TO data.
FIELD-SYMBOLS <lo_settings> TYPE any.
CALL METHOD ('CL_OO_FACTORY')=>('CREATE_INSTANCE')
RECEIVING
result = lo_factory.
CALL METHOD lo_factory->('CREATE_SETTINGS')
EXPORTING
modification_mode_enabled = abap_true
RECEIVING
result = lo_settings.
CREATE DATA lr_settings TYPE REF TO ('IF_OO_CLIF_SOURCE_SETTINGS').
ASSIGN lr_settings->* to <lo_settings>.
<lo_settings> ?= lo_settings.
CALL METHOD lo_factory->('CREATE_CLIF_SOURCE')
EXPORTING
clif_name = is_clskey-clsname
settings = <lo_settings>
RECEIVING
result = lo_source.
TRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~LOCK').
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'source_new, access permission exception' ).
ENDTRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SET_SOURCE')
EXPORTING
source = it_source.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SAVE').
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~UNLOCK').
ENDMETHOD.
METHOD lif_oo_object_fnc~add_to_activation_list.
lcl_objects_activation=>add_item( is_item ).
ENDMETHOD.
METHOD lif_oo_object_fnc~update_descriptions.
DELETE FROM seocompotx WHERE clsname = is_key-clsname. "#EC CI_SUBRC
INSERT seocompotx FROM TABLE it_descriptions. "#EC CI_SUBRC
ENDMETHOD.
METHOD lif_oo_object_fnc~insert_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~create_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~create_documentation.
CALL FUNCTION 'DOCU_UPD'
EXPORTING
id = 'CL'
langu = iv_language
object = iv_object_name
TABLES
line = it_lines
EXCEPTIONS
ret_code = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from DOCU_UPD' ).
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_includes.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~exists.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = iv_object_name
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
rv_exists = boolc( sy-subrc <> 2 ).
ENDMETHOD.
METHOD lif_oo_object_fnc~serialize_abap.
DATA lo_oo_serializer TYPE REF TO lcl_oo_serializer.
CREATE OBJECT lo_oo_serializer.
CASE iv_type.
WHEN seop_ext_class_locals_def.
rt_source = lo_oo_serializer->serialize_locals_def( is_class_key ).
WHEN seop_ext_class_locals_imp.
rt_source = lo_oo_serializer->serialize_locals_imp( is_class_key ).
WHEN seop_ext_class_macros.
rt_source = lo_oo_serializer->serialize_macros( is_class_key ).
WHEN seop_ext_class_testclasses.
rt_source = lo_oo_serializer->serialize_testclasses( is_class_key ).
mv_skip_test_classes = lo_oo_serializer->are_test_classes_skipped( ).
WHEN OTHERS.
rt_source = lo_oo_serializer->serialize_abap_clif_source( is_class_key ).
ENDCASE.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_skip_test_classes.
rv_skip = mv_skip_test_classes.
ENDMETHOD.
METHOD lif_oo_object_fnc~get_class_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~get_interface_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_documentation.
DATA: lv_state TYPE dokstate,
lv_object TYPE dokhl-object,
lt_lines TYPE tlinetab.
lv_object = iv_class_name.
CALL FUNCTION 'DOCU_GET'
EXPORTING
id = 'CL'
langu = iv_language
object = lv_object
IMPORTING
dokstate = lv_state
TABLES
line = lt_lines
EXCEPTIONS
no_docu_on_screen = 1
no_docu_self_def = 2
no_docu_temp = 3
ret_code = 4
OTHERS = 5.
IF sy-subrc = 0 AND lv_state = 'R'.
rt_lines = lt_lines.
ELSE.
CLEAR rt_lines.
ENDIF.
ENDMETHOD.
METHOD lif_oo_object_fnc~read_descriptions.
SELECT * FROM seocompotx INTO TABLE rt_descriptions
WHERE clsname = iv_obejct_name
AND descript <> ''
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
ENDMETHOD.
METHOD lif_oo_object_fnc~delete.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD lif_oo_object_fnc~read_superclass.
SELECT SINGLE refclsname FROM vseoextend INTO rv_superclass
WHERE clsname = iv_classname.
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM seocompotx WHERE clsname = is_key-clsname.
```
Explanation: Modify only own DB tables.
```abap
INSERT seocompotx FROM TABLE it_descriptions.
```
Explanation: Modify only own DB tables.
| 410 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_type IMPLEMENTATION.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
lv_typdname = ms_item-obj_name.
" Active version
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
" Inactive version
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
r3state = 'I'
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
ENDIF.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
delete_ddic( 'G' ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found
zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
jump_se11( ).
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 423 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_INCLUDE_SPLIT' ).
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_DELETE' ).
ENDIF.
ENDIF.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error from RS_FUNCTIONMODULE_INSERT: {
sy-subrc } { sy-msgid }{ sy-msgno }| ).
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 424 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_where INTO lv_where.
SELECT * FROM (iv_name) INTO TABLE <lg_tab> WHERE (lv_where).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
SELECT * FROM (iv_name) INTO TABLE <lg_tab> WHERE (lv_where).
```
Explanation: Potential dangerous statement Dynamic SQL.
| 425 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT mt_object_table ASSIGNING <ls_table>.
lv_where = get_where_clause( <ls_table>-tobj_name ).
ASSERT NOT lv_where IS INITIAL.
DELETE FROM (<ls_table>-tobj_name) WHERE (lv_where).
IF <ls_table>-tobj_name = lv_primary.
ASSERT sy-dbcnt <= 1. "Just to be on the very safe side
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM (<ls_table>-tobj_name) WHERE (lv_where).
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 427 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT mt_object_table ASSIGNING <ls_table>.
CREATE DATA lr_ref TYPE STANDARD TABLE OF (<ls_table>-tobj_name).
ASSIGN lr_ref->* TO <lt_data>.
io_xml->read(
EXPORTING
iv_name = <ls_table>-tobj_name
CHANGING
cg_data = <lt_data> ).
INSERT (<ls_table>-tobj_name) FROM TABLE <lt_data>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error inserting data, {
<ls_table>-tobj_name }| ).
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT (<ls_table>-tobj_name) FROM TABLE <lt_data>.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 428 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD exists.
DATA: lv_where_clause TYPE string,
lv_primary TYPE objsl-tobj_name,
lr_table_line TYPE REF TO data.
FIELD-SYMBOLS: <lg_table_line> TYPE any.
lv_primary = get_primary_table( ).
lv_where_clause = get_where_clause( lv_primary ).
CREATE DATA lr_table_line TYPE (lv_primary).
ASSIGN lr_table_line->* TO <lg_table_line>.
SELECT SINGLE * FROM (lv_primary) INTO <lg_table_line> WHERE (lv_where_clause).
rv_bool = boolc( sy-dbcnt > 0 ).
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE * FROM (lv_primary) INTO <lg_table_line> WHERE (lv_where_clause).
```
Explanation: Potential dangerous statement Dynamic SQL.
| 429 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT mt_object_table ASSIGNING <ls_object_table>.
CREATE DATA lr_ref TYPE STANDARD TABLE OF (<ls_object_table>-tobj_name).
ASSIGN lr_ref->* TO <lt_data>.
lv_where = get_where_clause( <ls_object_table>-tobj_name ).
SELECT * FROM (<ls_object_table>-tobj_name)
INTO TABLE <lt_data>
WHERE (lv_where)
ORDER BY PRIMARY KEY.
io_xml->add(
iv_name = <ls_object_table>-tobj_name
ig_data = <lt_data> ).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
SELECT * FROM (<ls_object_table>-tobj_name)
```
Explanation: Potential dangerous statement Dynamic SQL.
| 430 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD validate.
DATA: lv_where TYPE string,
lv_primary TYPE objsl-tobj_name,
lr_ref TYPE REF TO data.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.
lv_primary = get_primary_table( ).
CREATE DATA lr_ref TYPE STANDARD TABLE OF (lv_primary).
ASSIGN lr_ref->* TO <lt_data>.
io_xml->read(
EXPORTING
iv_name = lv_primary
CHANGING
cg_data = <lt_data> ).
IF lines( <lt_data> ) = 0.
zcx_abapgit_exception=>raise( |Primary table { lv_primary
} not found in imported container | ).
ELSEIF lines( <lt_data> ) <> 1.
zcx_abapgit_exception=>raise( |Primary table { lv_primary
} contains more than one instance! | ).
ENDIF.
lv_where = get_where_clause( lv_primary ).
* validate that max one local instance was affected by the import
SELECT COUNT(*) FROM (lv_primary) WHERE (lv_where).
IF sy-dbcnt > 1.
zcx_abapgit_exception=>raise( |More than one instance exists locally in primary table {
lv_primary }| ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
SELECT COUNT(*) FROM (lv_primary) WHERE (lv_where).
```
Explanation: Potential dangerous statement Dynamic SQL.
| 431 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS ZCL_ABAPGIT_OBJECT_TYPE IMPLEMENTATION.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_DD_TYGR_INSERT_SOURCES' ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
lv_typdname = ms_item-obj_name.
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TYPD_GET_OBJECT' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_objname TYPE rsedd0-ddobjname.
lv_objname = ms_item-obj_name.
CALL FUNCTION 'RS_DD_DELETE_OBJ'
EXPORTING
no_ask = abap_true
objname = lv_objname
objtype = 'G'
EXCEPTIONS
not_executed = 1
object_not_found = 2
object_not_specified = 3
permission_failure = 4
dialog_needed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error deleting TYPE' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
jump_se11( iv_radio = 'RSRD1-TYMA'
iv_field = 'RSRD1-TYMA_VAL' ).
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 434 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from FUNCTION_DELETE' ).
ENDIF.
ENDIF.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_area
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
* NAMESPACE = ' ' todo
remote_basxml_supported = <ls_func>-remote_basxml
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from RS_FUNCTIONMODULE_INSERT' ).
ENDIF.
INSERT REPORT lv_include FROM lt_source.
* lcl_objects_activation=>add( iv_type = 'FUNC'
* iv_name = <ls_func>-funcname ).
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_include FROM lt_source.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 436 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT mt_object_table ASSIGNING <ls_table>.
CREATE DATA lr_ref TYPE STANDARD TABLE OF (<ls_table>-tobj_name).
ASSIGN lr_ref->* TO <lt_data>.
io_xml->read(
EXPORTING
iv_name = <ls_table>-tobj_name
CHANGING
cg_data = <lt_data> ).
INSERT (<ls_table>-tobj_name) FROM TABLE <lt_data>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error inserting data, { <ls_table>-tobj_name }| ).
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
INSERT (<ls_table>-tobj_name) FROM TABLE <lt_data>.
```
Explanation: Modify only own DB tables | Potential dangerous statement Dynamic SQL.
| 453 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD validate.
DATA: lv_where TYPE string,
lv_primary TYPE objsl-tobj_name,
lr_ref TYPE REF TO data.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.
lv_primary = get_primary_table( ).
CREATE DATA lr_ref TYPE STANDARD TABLE OF (lv_primary).
ASSIGN lr_ref->* TO <lt_data>.
io_xml->read(
EXPORTING
iv_name = lv_primary
CHANGING
cg_data = <lt_data> ).
IF lines( <lt_data> ) = 0.
zcx_abapgit_exception=>raise( |Primary table { lv_primary } not found in imported container| ).
ELSEIF lines( <lt_data> ) <> 1.
zcx_abapgit_exception=>raise( |Primary table { lv_primary } contains more than one instance!| ).
ENDIF.
lv_where = get_where_clause( lv_primary ).
* validate that max one local instance was affected by the import
SELECT COUNT(*) FROM (lv_primary) WHERE (lv_where).
IF sy-dbcnt > 1.
zcx_abapgit_exception=>raise( |More than one instance exists locally in primary table { lv_primary }| ).
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
SELECT COUNT(*) FROM (lv_primary) WHERE (lv_where).
```
Explanation: Potential dangerous statement Dynamic SQL.
| 456 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF lv_subrc = 0.
* it cannot delete table with table without asking
CREATE DATA lr_data TYPE (lv_objname).
ASSIGN lr_data->* TO <lg_data>.
SELECT SINGLE * FROM (lv_objname) INTO <lg_data>.
IF sy-subrc = 0.
lv_no_ask = abap_false.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE * FROM (lv_objname) INTO <lg_data>.
```
Explanation: Potential dangerous statement Dynamic SQL.
| 458 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_type IMPLEMENTATION.
METHOD zif_abapgit_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
lv_typdname = ms_item-obj_name.
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TYPD_GET_OBJECT' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_DD_TYGR_INSERT_SOURCES' ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_objname TYPE rsedd0-ddobjname.
lv_objname = ms_item-obj_name.
CALL FUNCTION 'RS_DD_DELETE_OBJ'
EXPORTING
no_ask = abap_true
objname = lv_objname
objtype = 'G'
EXCEPTIONS
not_executed = 1
object_not_found = 2
object_not_specified = 3
permission_failure = 4
dialog_needed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error deleting TYPE' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
jump_se11( iv_radio = 'RSRD1-TYMA'
iv_field = 'RSRD1-TYMA_VAL' ).
ENDMETHOD.
METHOD zif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 459 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS ZCL_ABAPGIT_OBJECT_TYPE IMPLEMENTATION.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_DD_TYGR_INSERT_SOURCES' ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
lv_typdname = ms_item-obj_name.
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TYPD_GET_OBJECT' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_objname TYPE rsedd0-ddobjname.
lv_objname = ms_item-obj_name.
CALL FUNCTION 'RS_DD_DELETE_OBJ'
EXPORTING
no_ask = abap_true
objname = lv_objname
objtype = 'G'
EXCEPTIONS
not_executed = 1
object_not_found = 2
object_not_specified = 3
permission_failure = 4
dialog_needed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error deleting TYPE' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
jump_se11( iv_radio = 'RSRD1-TYMA'
iv_field = 'RSRD1-TYMA_VAL' ).
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 462 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_sicf IMPLEMENTATION.
METHOD change_sicf.
DATA: lt_icfhndlist TYPE icfhndlist,
lt_existing TYPE TABLE OF icfhandler,
ls_icfserdesc TYPE icfserdesc.
FIELD-SYMBOLS: <ls_existing> LIKE LINE OF lt_existing.
lt_icfhndlist = to_icfhndlist( it_icfhandler ).
* Do not add handlers if they already exist, it will make the below
* call to SAP standard code raise an exception
SELECT * FROM icfhandler INTO TABLE lt_existing
WHERE icf_name = is_icfservice-icf_name.
LOOP AT lt_existing ASSIGNING <ls_existing>.
DELETE TABLE lt_icfhndlist FROM <ls_existing>-icfhandler.
ENDLOOP.
MOVE-CORRESPONDING is_icfservice TO ls_icfserdesc.
cl_icf_tree=>if_icf_tree~change_node(
EXPORTING
icf_name = is_icfservice-orig_name
icfparguid = iv_parent
icfdocu = is_icfdocu
doculang = mv_language
icfhandlst = lt_icfhndlist
package = iv_package
application = space
icfserdesc = ls_icfserdesc
icfactive = abap_true
EXCEPTIONS
empty_icf_name = 1
no_new_virtual_host = 2
special_service_error = 3
parent_not_existing = 4
enqueue_error = 5
node_already_existing = 6
empty_docu = 7
doculang_not_installed = 8
security_info_error = 9
user_password_error = 10
password_encryption_error = 11
invalid_url = 12
invalid_otr_concept = 13
formflg401_error = 14
handler_error = 15
transport_error = 16
tadir_error = 17
package_not_found = 18
wrong_application = 19
not_allow_application = 20
no_application = 21
invalid_icfparguid = 22
alt_name_invalid = 23
alternate_name_exist = 24
wrong_icf_name = 25
no_authority = 26
OTHERS = 27 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SICF - error from change_node. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD find_parent.
cl_icf_tree=>if_icf_tree~service_from_url(
EXPORTING
url = iv_url
hostnumber = 0
IMPORTING
icfnodguid = rv_parent
EXCEPTIONS
wrong_application = 1
no_application = 2
not_allow_application = 3
wrong_url = 4
no_authority = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SICF - error from service_from_url. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD insert_sicf.
DATA: lt_icfhndlist TYPE icfhndlist,
ls_icfserdesc TYPE icfserdesc,
ls_icfdocu TYPE icfdocu,
lv_parent TYPE icfparguid.
lt_icfhndlist = to_icfhndlist( it_icfhandler ).
lv_parent = find_parent( iv_url ).
* nice, it seems that the structure should be mistreated
ls_icfdocu = is_icfdocu-icf_docu.
MOVE-CORRESPONDING is_icfservice TO ls_icfserdesc.
cl_icf_tree=>if_icf_tree~insert_node(
EXPORTING
icf_name = is_icfservice-orig_name
icfparguid = lv_parent
icfdocu = ls_icfdocu
doculang = mv_language
icfhandlst = lt_icfhndlist
package = iv_package
application = space
icfserdesc = ls_icfserdesc
icfactive = abap_true
EXCEPTIONS
empty_icf_name = 1
no_new_virtual_host = 2
special_service_error = 3
parent_not_existing = 4
enqueue_error = 5
node_already_existing = 6
empty_docu = 7
doculang_not_installed = 8
security_info_error = 9
user_password_error = 10
password_encryption_error = 11
invalid_url = 12
invalid_otr_concept = 13
formflg401_error = 14
handler_error = 15
transport_error = 16
tadir_error = 17
package_not_found = 18
wrong_application = 19
not_allow_application = 20
no_application = 21
invalid_icfparguid = 22
alt_name_invalid = 23
alternate_name_exist = 24
wrong_icf_name = 25
no_authority = 26
OTHERS = 27 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SICF - error from insert_node: { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lt_serv_info TYPE icfservtbl,
ls_serv_info LIKE LINE OF lt_serv_info,
ls_key TYPE ty_sicf_key.
FIELD-SYMBOLS: <ls_icfhandler> LIKE LINE OF et_icfhandler.
CLEAR es_icfservice.
CLEAR es_icfdocu.
CLEAR et_icfhandler.
CLEAR ev_url.
ls_key = read_tadir_sicf( ms_item-obj_name )-obj_name.
cl_icf_tree=>if_icf_tree~get_info_from_serv(
EXPORTING
icf_name = ls_key-icf_name
icfparguid = ls_key-icfparguid
icf_langu = mv_language
IMPORTING
serv_info = lt_serv_info
icfdocu = es_icfdocu
url = ev_url
EXCEPTIONS
wrong_name = 1
wrong_parguid = 2
incorrect_service = 3
no_authority = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SICF - error from get_info_from_serv. Subrc = { sy-subrc }| ).
ENDIF.
ASSERT lines( lt_serv_info ) = 1.
READ TABLE lt_serv_info INDEX 1 INTO ls_serv_info.
ASSERT sy-subrc = 0.
MOVE-CORRESPONDING ls_serv_info-service TO es_icfservice.
IF iv_clear = abap_true.
CLEAR es_icfservice-icf_cuser.
CLEAR es_icfservice-icf_cdate.
CLEAR es_icfservice-icf_muser.
CLEAR es_icfservice-icf_mdate.
ENDIF.
CLEAR es_icfdocu-icfparguid.
APPEND LINES OF ls_serv_info-handlertbl TO et_icfhandler.
LOOP AT et_icfhandler ASSIGNING <ls_icfhandler>.
CLEAR <ls_icfhandler>-icfparguid.
ENDLOOP.
ENDMETHOD.
METHOD read_sicf_url.
* note: this method is called dynamically from some places
DATA: lv_name TYPE icfname,
lv_url TYPE string,
lv_parguid TYPE icfparguid.
lv_name = iv_obj_name.
lv_parguid = iv_obj_name+15.
cl_icf_tree=>if_icf_tree~get_info_from_serv(
EXPORTING
icf_name = lv_name
icfparguid = lv_parguid
IMPORTING
url = lv_url
EXCEPTIONS
wrong_name = 1
wrong_parguid = 2
incorrect_service = 3
no_authority = 4
OTHERS = 5 ).
IF sy-subrc = 0.
rv_hash = zcl_abapgit_hash=>sha1_raw( zcl_abapgit_convert=>string_to_xstring_utf8( lv_url ) ).
ENDIF.
ENDMETHOD.
METHOD read_tadir_sicf.
* note: this method is called dynamically from some places
DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt,
lv_hash TYPE text25,
lv_obj_name TYPE tadir-obj_name.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir.
lv_hash = iv_obj_name+15.
CONCATENATE iv_obj_name(15) '%' INTO lv_obj_name.
SELECT * FROM tadir INTO CORRESPONDING FIELDS OF TABLE lt_tadir
WHERE pgmid = iv_pgmid
AND object = 'SICF'
AND obj_name LIKE lv_obj_name
ORDER BY PRIMARY KEY. "#EC CI_GENBUFF
LOOP AT lt_tadir ASSIGNING <ls_tadir>.
IF read_sicf_url( <ls_tadir>-obj_name ) = lv_hash.
rs_tadir = <ls_tadir>.
RETURN.
ENDIF.
ENDLOOP.
IF lines( lt_tadir ) = 1.
READ TABLE lt_tadir INDEX 1 ASSIGNING <ls_tadir>.
ASSERT sy-subrc = 0.
rs_tadir = <ls_tadir>.
ENDIF.
ENDMETHOD.
METHOD to_icfhndlist.
FIELD-SYMBOLS: <ls_list> LIKE LINE OF it_list.
* convert to sorted table
LOOP AT it_list ASSIGNING <ls_list>.
INSERT <ls_list>-icfhandler INTO TABLE rt_list.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA: ls_icfservice TYPE icfservice.
read( EXPORTING iv_clear = abap_false
IMPORTING es_icfservice = ls_icfservice ).
rv_user = ls_icfservice-icf_muser.
IF rv_user IS INITIAL.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: ls_icfservice TYPE icfservice.
read( IMPORTING es_icfservice = ls_icfservice ).
IF ls_icfservice IS INITIAL.
" It seems that the ICF service doesn't exist anymore.
" But that's ok, because some objects like SAPC manage
" the lifecycle of its ICF service by itself and already
" deleted the service.
RETURN.
ENDIF.
IF ls_icfservice-icfparguid CO '0'.
" not supported by the SAP standard API
zcx_abapgit_exception=>raise( 'SICF - cannot delete root node, delete node manually' ).
ENDIF.
" Delete Application Customizing Data the hard way, as it isn't done by the API.
" If we wouldn't we would get errors from the API if entrys exist.
" Transaction SICF does the same.
DELETE FROM icfapplcust
WHERE icf_name = ls_icfservice-icf_name
AND icfparguid = ls_icfservice-icfparguid.
cl_icf_tree=>if_icf_tree~delete_node(
EXPORTING
icfparguid = ls_icfservice-icfparguid
CHANGING
icf_name = ls_icfservice-icf_name
EXCEPTIONS
no_virtual_host_delete = 1
special_service_error = 2
enqueue_error = 3
node_not_existing = 4
node_has_childs = 5
node_is_aliased = 6
node_not_in_original_system = 7
transport_error = 8
tadir_error = 9
db_error = 10
no_authority = 11
OTHERS = 12 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SICF - error from delete_node. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_icfservice TYPE icfservice,
ls_read TYPE icfservice,
ls_icfdocu TYPE icfdocu,
lv_url TYPE string,
lv_exists TYPE abap_bool,
lt_icfhandler TYPE TABLE OF icfhandler.
io_xml->read( EXPORTING iv_name = 'URL'
CHANGING cg_data = lv_url ).
io_xml->read( EXPORTING iv_name = 'ICFSERVICE'
CHANGING cg_data = ls_icfservice ).
io_xml->read( EXPORTING iv_name = 'ICFDOCU'
CHANGING cg_data = ls_icfdocu ).
io_xml->read( EXPORTING iv_name = 'ICFHANDLER_TABLE'
CHANGING cg_data = lt_icfhandler ).
lv_exists = zif_abapgit_object~exists( ).
IF lv_exists = abap_false.
insert_sicf( is_icfservice = ls_icfservice
is_icfdocu = ls_icfdocu
it_icfhandler = lt_icfhandler
iv_package = iv_package
iv_url = lv_url ).
ELSE.
read( IMPORTING es_icfservice = ls_read ).
change_sicf( is_icfservice = ls_icfservice
is_icfdocu = ls_icfdocu
it_icfhandler = lt_icfhandler
iv_package = iv_package
iv_parent = ls_read-icfparguid ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir,
ls_key TYPE ty_sicf_key.
ls_tadir = read_tadir_sicf( ms_item-obj_name ).
rv_bool = boolc( NOT ls_tadir IS INITIAL ).
IF rv_bool = abap_true.
ls_key = ls_tadir-obj_name.
SELECT SINGLE icfaltnme FROM icfservice INTO ls_key-icf_name
WHERE icf_name = ls_key-icf_name
AND icfparguid = ls_key-icfparguid.
rv_bool = boolc( sy-subrc = 0 ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_argument TYPE seqg3-garg.
lv_argument = ms_item-obj_name(15).
lv_argument+15(1) = '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESICFSER'
iv_argument = lv_argument ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
ls_bcdata-program = 'RSICFTREE'.
ls_bcdata-dynpro = '1000'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
ls_bcdata-dynpro = space.
ls_bcdata-dynbegin = space.
ls_bcdata-fnam = 'ICF_SERV'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=ONLI'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SICF'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SICF' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_icfservice TYPE icfservice,
ls_icfdocu TYPE icfdocu,
lv_url TYPE string,
lt_icfhandler TYPE TABLE OF icfhandler.
read( IMPORTING es_icfservice = ls_icfservice
es_icfdocu = ls_icfdocu
et_icfhandler = lt_icfhandler
ev_url = lv_url ).
IF ls_icfservice IS INITIAL.
RETURN.
ENDIF.
CLEAR ls_icfservice-icf_mandt.
CLEAR ls_icfservice-icfnodguid.
CLEAR ls_icfservice-icfparguid.
CLEAR ls_icfservice-icf_user.
CLEAR ls_icfservice-icf_cclnt.
CLEAR ls_icfservice-icf_mclnt.
io_xml->add( iv_name = 'URL'
ig_data = lv_url ).
io_xml->add( iv_name = 'ICFSERVICE'
ig_data = ls_icfservice ).
io_xml->add( iv_name = 'ICFDOCU'
ig_data = ls_icfdocu ).
io_xml->add( iv_name = 'ICFHANDLER_TABLE'
ig_data = lt_icfhandler ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM icfapplcust
```
Explanation: Modify only own DB tables.
| 470 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT is_properties-attributes ASSIGNING <ls_attribute>.
lo_attribute-clsname = iv_clif_name.
lo_attribute-cmpname = <ls_attribute>-name.
lo_attribute-langu = iv_language.
lo_attribute-descript = <ls_attribute>-description.
MODIFY seocompotx FROM lo_attribute.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seocompotx FROM lo_attribute.
```
Explanation: Modify only own DB tables.
| 471 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT is_properties-methods ASSIGNING <ls_method>.
lo_method-clsname = iv_clif_name.
lo_method-cmpname = <ls_method>-name.
lo_method-langu = iv_language.
lo_method-descript = <ls_method>-description.
MODIFY seocompotx FROM lo_method.
LOOP AT <ls_method>-parameters ASSIGNING <ls_parameter>.
lo_method_parameter-clsname = iv_clif_name.
lo_method_parameter-cmpname = <ls_method>-name.
lo_method_parameter-sconame = <ls_parameter>-name.
lo_method_parameter-langu = iv_language.
lo_method_parameter-descript = <ls_parameter>-description.
MODIFY seosubcotx FROM lo_method_parameter.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seocompotx FROM lo_method.
```
Explanation: Modify only own DB tables.
| 472 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT <ls_method>-parameters ASSIGNING <ls_parameter>.
lo_method_parameter-clsname = iv_clif_name.
lo_method_parameter-cmpname = <ls_method>-name.
lo_method_parameter-sconame = <ls_parameter>-name.
lo_method_parameter-langu = iv_language.
lo_method_parameter-descript = <ls_parameter>-description.
MODIFY seosubcotx FROM lo_method_parameter.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seosubcotx FROM lo_method_parameter.
```
Explanation: Modify only own DB tables.
| 473 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT <ls_method>-exceptions ASSIGNING <ls_exception>.
lo_method_exception-clsname = iv_clif_name.
lo_method_exception-cmpname = <ls_method>-name.
lo_method_exception-sconame = <ls_exception>-name.
lo_method_exception-langu = iv_language.
lo_method_exception-descript = <ls_exception>-description.
MODIFY seosubcotx FROM lo_method_exception.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seosubcotx FROM lo_method_exception.
```
Explanation: Modify only own DB tables.
| 474 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT is_properties-events ASSIGNING <ls_event>.
lo_event-clsname = iv_clif_name.
lo_event-cmpname = <ls_event>-name.
lo_event-langu = iv_language.
lo_event-descript = <ls_event>-description.
MODIFY seocompotx FROM lo_event.
LOOP AT <ls_event>-parameters ASSIGNING <ls_parameter>.
lo_event_parameter-clsname = iv_clif_name.
lo_event_parameter-cmpname = <ls_event>-name.
lo_event_parameter-sconame = <ls_parameter>-name.
lo_event_parameter-langu = iv_language.
lo_event_parameter-descript = <ls_parameter>-description.
MODIFY seosubcotx FROM lo_event_parameter.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seocompotx FROM lo_event.
```
Explanation: Modify only own DB tables.
| 475 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT <ls_event>-parameters ASSIGNING <ls_parameter>.
lo_event_parameter-clsname = iv_clif_name.
lo_event_parameter-cmpname = <ls_event>-name.
lo_event_parameter-sconame = <ls_parameter>-name.
lo_event_parameter-langu = iv_language.
lo_event_parameter-descript = <ls_parameter>-description.
MODIFY seosubcotx FROM lo_event_parameter.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seosubcotx FROM lo_event_parameter.
```
Explanation: Modify only own DB tables.
| 476 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT is_properties-types ASSIGNING <ls_type>.
lo_type-clsname = iv_clif_name.
lo_type-cmpname = <ls_type>-name.
lo_type-langu = iv_language.
lo_type-descript = <ls_type>-description.
MODIFY seocompotx FROM lo_type.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY seocompotx FROM lo_type.
```
Explanation: Modify only own DB tables.
| 477 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF lv_subrc = 0.
* it cannot delete table with table wihtout asking
CREATE DATA lr_data TYPE (lv_objname).
ASSIGN lr_data->* TO <lg_data>.
SELECT SINGLE * FROM (lv_objname) INTO <lg_data>.
IF sy-subrc = 0.
lv_no_ask = abap_false.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
SELECT SINGLE * FROM (lv_objname) INTO <lg_data>.
```
Explanation: Potential dangerous statement Dynamic SQL.
| 478 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS ZCL_ABAPGIT_OBJECT_DOCT IMPLEMENTATION.
METHOD constructor.
super->constructor(
is_item = is_item
iv_language = iv_language ).
mi_longtexts = zcl_abapgit_factory=>get_longtexts( ).
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = mi_longtexts->changed_by(
iv_object_name = ms_item-obj_name
iv_longtext_id = c_id ).
IF rv_user IS INITIAL.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
mi_longtexts->delete(
iv_object_name = ms_item-obj_name
iv_longtext_id = c_id ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
mi_longtexts->deserialize(
iv_longtext_name = c_name
ii_xml = io_xml
iv_master_language = mv_language ).
tadir_insert( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_id TYPE dokil-id,
lv_object TYPE dokhl-object.
lv_object = ms_item-obj_name.
SELECT SINGLE id FROM dokil INTO lv_id
WHERE id = c_id
AND object = lv_object. "#EC CI_GENBUFF
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_dokentry TYPE dokentry,
ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
" We need to modify dokentry directly, otherwise
" Batch Input on SE61 wouldn't work because it stores
" the last seen Document Class in this table. There's
" no standard function to do this. SE61 does this
" directly in its dialog modules
ls_dokentry-username = sy-uname.
ls_dokentry-langu = sy-langu.
ls_dokentry-class = c_id.
MODIFY dokentry FROM ls_dokentry.
ls_bcdata-program = 'SAPMSDCU'.
ls_bcdata-dynpro = '0100'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'RSDCU-OBJECT7'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=SHOW'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SE61'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, DOCT' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
mi_longtexts->serialize(
iv_longtext_name = c_name
iv_object_name = ms_item-obj_name
iv_longtext_id = c_id
ii_xml = io_xml ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
MODIFY dokentry FROM ls_dokentry.
```
Explanation: Modify only own DB tables.
| 479 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD delete_msgid.
delete_documentation( iv_message_id ).
DELETE FROM t100a WHERE arbgb = iv_message_id.
IF sy-subrc = 0 OR sy-subrc = 4.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = iv_message_id
operation = 'DELETE'
program = space
type = 'CN'.
DELETE FROM t100o WHERE arbgb = iv_message_id.
DELETE FROM t100t WHERE arbgb = iv_message_id. "#EC CI_NOFIRST
DELETE FROM t100u WHERE arbgb = iv_message_id.
DELETE FROM t100x WHERE arbgb = iv_message_id.
DELETE FROM t100 WHERE arbgb = iv_message_id.
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM t100a WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
| 481 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF sy-subrc = 0 OR sy-subrc = 4.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = iv_message_id
operation = 'DELETE'
program = space
type = 'CN'.
DELETE FROM t100o WHERE arbgb = iv_message_id.
DELETE FROM t100t WHERE arbgb = iv_message_id. "#EC CI_NOFIRST
DELETE FROM t100u WHERE arbgb = iv_message_id.
DELETE FROM t100x WHERE arbgb = iv_message_id.
DELETE FROM t100 WHERE arbgb = iv_message_id.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM t100o WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
```abap
DELETE FROM t100t WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
```abap
DELETE FROM t100u WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
```abap
DELETE FROM t100x WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
```abap
DELETE FROM t100 WHERE arbgb = iv_message_id.
```
Explanation: Modify only own DB tables.
| 482 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD deserialize_texts.
DATA: lv_msg_id TYPE rglif-message_id,
ls_t100 TYPE t100,
lt_t100t TYPE TABLE OF t100t,
lt_t100_texts TYPE ty_t100_texts,
lt_t100u TYPE TABLE OF t100u.
FIELD-SYMBOLS: <ls_t100_text> TYPE ty_t100_text.
lv_msg_id = ms_item-obj_name.
SELECT * FROM t100u INTO TABLE lt_t100u
WHERE arbgb = lv_msg_id ORDER BY PRIMARY KEY. "#EC CI_GENBUFF
ii_xml->read( EXPORTING iv_name = 'T100_TEXTS'
CHANGING cg_data = lt_t100_texts ).
ii_xml->read( EXPORTING iv_name = 'T100T'
CHANGING cg_data = lt_t100t ).
MODIFY t100t FROM TABLE lt_t100t. "#EC CI_SUBRC
LOOP AT lt_t100_texts ASSIGNING <ls_t100_text>.
"check if message exists
READ TABLE lt_t100u TRANSPORTING NO FIELDS
WITH KEY arbgb = lv_msg_id msgnr = <ls_t100_text>-msgnr BINARY SEARCH.
CHECK sy-subrc = 0. "if original message doesn't exist no translations added
MOVE-CORRESPONDING <ls_t100_text> TO ls_t100.
ls_t100-arbgb = lv_msg_id.
MODIFY t100 FROM ls_t100.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY t100t FROM TABLE lt_t100t.
```
Explanation: Modify only own DB tables.
| 483 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT lt_t100_texts ASSIGNING <ls_t100_text>.
"check if message exists
READ TABLE lt_t100u TRANSPORTING NO FIELDS
WITH KEY arbgb = lv_msg_id msgnr = <ls_t100_text>-msgnr BINARY SEARCH.
CHECK sy-subrc = 0. "if original message doesn't exist no translations added
MOVE-CORRESPONDING <ls_t100_text> TO ls_t100.
ls_t100-arbgb = lv_msg_id.
MODIFY t100 FROM ls_t100.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY t100 FROM ls_t100.
```
Explanation: Modify only own DB tables.
| 484 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT lt_t100 ASSIGNING <ls_t100>.
DELETE lt_before WHERE msgnr = <ls_t100>-msgnr.
MODIFY t100 FROM <ls_t100>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
CLEAR ls_t100u.
MOVE-CORRESPONDING <ls_t100> TO ls_t100u ##enh_ok.
ls_t100u-name = sy-uname.
ls_t100u-datum = sy-datum.
ls_t100u-selfdef = '3'.
MODIFY t100u FROM ls_t100u.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100U modify failed' ).
ENDIF.
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
MODIFY t100 FROM <ls_t100>.
```
Explanation: Modify only own DB tables.
```abap
MODIFY t100u FROM ls_t100u.
```
Explanation: Modify only own DB tables.
| 485 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_msag IMPLEMENTATION.
METHOD delete_documentation.
DATA: lv_key_s TYPE dokhl-object.
CLEAR lv_key_s.
CALL FUNCTION 'DOCU_OBJECT_NAME_CONCATENATE'
EXPORTING
docu_id = 'NA'
element = iv_message_id
addition = ' '
IMPORTING
object = lv_key_s
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'DOKU_DELETE_ALL'
EXPORTING
doku_id = 'NA'
doku_object = lv_key_s
generic_use = 'X'
suppress_authority = space
suppress_enqueue = space
suppress_transport = space
EXCEPTIONS
header_without_text = 01
index_without_header = 02
no_authority_for_devclass_xxxx = 03
no_docu_found = 04
object_is_already_enqueued = 05
object_is_enqueued_by_corr = 06
user_break = 07.
ENDMETHOD.
METHOD delete_msgid.
delete_documentation( iv_message_id ).
DELETE FROM t100a WHERE arbgb = iv_message_id.
IF sy-subrc = 0 OR sy-subrc = 4.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = iv_message_id
operation = 'DELETE'
program = space
type = 'CN'.
DELETE FROM t100o WHERE arbgb = iv_message_id.
DELETE FROM t100t WHERE arbgb = iv_message_id. "#EC CI_NOFIRST
DELETE FROM t100u WHERE arbgb = iv_message_id.
DELETE FROM t100x WHERE arbgb = iv_message_id.
DELETE FROM t100 WHERE arbgb = iv_message_id.
ENDIF.
ENDMETHOD.
METHOD deserialize_texts.
DATA: lv_msg_id TYPE rglif-message_id,
ls_t100 TYPE t100,
lt_t100t TYPE TABLE OF t100t,
lt_t100_texts TYPE ty_t100_texts,
lt_t100u TYPE TABLE OF t100u.
FIELD-SYMBOLS: <ls_t100_text> TYPE ty_t100_text.
lv_msg_id = ms_item-obj_name.
SELECT * FROM t100u INTO TABLE lt_t100u
WHERE arbgb = lv_msg_id ORDER BY PRIMARY KEY. "#EC CI_GENBUFF
ii_xml->read( EXPORTING iv_name = 'T100_TEXTS'
CHANGING cg_data = lt_t100_texts ).
ii_xml->read( EXPORTING iv_name = 'T100T'
CHANGING cg_data = lt_t100t ).
MODIFY t100t FROM TABLE lt_t100t. "#EC CI_SUBRC
LOOP AT lt_t100_texts ASSIGNING <ls_t100_text>.
"check if message exists
READ TABLE lt_t100u TRANSPORTING NO FIELDS
WITH KEY arbgb = lv_msg_id msgnr = <ls_t100_text>-msgnr BINARY SEARCH.
CHECK sy-subrc = 0. "if original message doesn't exist no translations added
MOVE-CORRESPONDING <ls_t100_text> TO ls_t100.
ls_t100-arbgb = lv_msg_id.
MODIFY t100 FROM ls_t100.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD free_access_permission.
CALL FUNCTION 'RS_ACCESS_PERMISSION'
EXPORTING
mode = 'FREE'
object = iv_message_id
object_class = 'T100'.
ENDMETHOD.
METHOD serialize_longtexts_msag.
DATA: lv_doku_object_name TYPE dokhl-object,
lt_doku_object_names TYPE STANDARD TABLE OF dokhl-object
WITH NON-UNIQUE DEFAULT KEY,
lt_dokil TYPE zif_abapgit_definitions=>ty_dokil_tt,
ls_dokil LIKE LINE OF lt_dokil,
lv_master_lang_only TYPE abap_bool.
FIELD-SYMBOLS: <ls_t100> TYPE t100.
IF lines( it_t100 ) = 0.
RETURN.
ENDIF.
LOOP AT it_t100 ASSIGNING <ls_t100>.
lv_doku_object_name = <ls_t100>-arbgb && <ls_t100>-msgnr.
INSERT lv_doku_object_name INTO TABLE lt_doku_object_names.
ENDLOOP.
lv_master_lang_only = ii_xml->i18n_params( )-serialize_master_lang_only.
IF lv_master_lang_only = abap_true.
SELECT * FROM dokil
INTO TABLE lt_dokil
FOR ALL ENTRIES IN lt_doku_object_names
WHERE id = 'NA'
AND object = lt_doku_object_names-table_line
AND masterlang = abap_true
ORDER BY PRIMARY KEY.
ELSE.
SELECT * FROM dokil
INTO TABLE lt_dokil
FOR ALL ENTRIES IN lt_doku_object_names
WHERE id = 'NA'
AND object = lt_doku_object_names-table_line
ORDER BY PRIMARY KEY.
ENDIF.
CLEAR ls_dokil-dokstate.
MODIFY lt_dokil FROM ls_dokil TRANSPORTING dokstate WHERE dokstate IS NOT INITIAL.
IF lines( lt_dokil ) > 0.
serialize_longtexts( ii_xml = ii_xml
it_dokil = lt_dokil ).
ENDIF.
ENDMETHOD.
METHOD serialize_texts.
DATA: lv_msg_id TYPE rglif-message_id,
lt_t100_texts TYPE ty_t100_texts,
lt_t100t TYPE TABLE OF t100t,
lt_i18n_langs TYPE TABLE OF langu.
lv_msg_id = ms_item-obj_name.
IF ii_xml->i18n_params( )-serialize_master_lang_only = abap_true.
RETURN. " skip
ENDIF.
" Collect additional languages
" Skip main lang - it has been already serialized
SELECT DISTINCT sprsl AS langu INTO TABLE lt_i18n_langs
FROM t100t
WHERE arbgb = lv_msg_id
AND sprsl <> mv_language. "#EC CI_BYPASS "#EC CI_GENBUFF
SORT lt_i18n_langs ASCENDING.
IF lines( lt_i18n_langs ) > 0.
SELECT * FROM t100t INTO CORRESPONDING FIELDS OF TABLE lt_t100t
WHERE sprsl <> mv_language
AND arbgb = lv_msg_id. "#EC CI_GENBUFF
SELECT * FROM t100 INTO CORRESPONDING FIELDS OF TABLE lt_t100_texts
FOR ALL ENTRIES IN lt_i18n_langs
WHERE sprsl = lt_i18n_langs-table_line
AND arbgb = lv_msg_id
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SORT lt_t100t BY sprsl ASCENDING.
SORT lt_t100_texts BY sprsl msgnr ASCENDING.
ii_xml->add( iv_name = 'I18N_LANGS'
ig_data = lt_i18n_langs ).
ii_xml->add( iv_name = 'T100T'
ig_data = lt_t100t ).
ii_xml->add( iv_name = 'T100_TEXTS'
ig_data = lt_t100_texts ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE lastuser FROM t100a INTO rv_user
WHERE arbgb = ms_item-obj_name. "#EC CI_GENBUFF
IF sy-subrc <> 0 OR rv_user = ''.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: ls_t100a TYPE t100a,
lv_frozen TYPE abap_bool,
lv_message_id TYPE arbgb,
lv_access_granted TYPE abap_bool.
* parameter SUPPRESS_DIALOG doesnt exist in all versions of FM RS_DELETE_MESSAGE_ID
* replaced with a copy
lv_message_id = ms_item-obj_name.
IF ms_item-obj_name = space.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."blank message id
ENDIF.
SELECT SINGLE * FROM t100a INTO ls_t100a WHERE arbgb = ms_item-obj_name.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."not found
ENDIF.
CLEAR lv_frozen.
CALL FUNCTION 'RS_ACCESS_PERMISSION'
EXPORTING
authority_check = 'X'
global_lock = 'X'
mode = 'MODIFY'
object = lv_message_id
object_class = 'T100'
IMPORTING
frozen = lv_frozen
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 OR lv_frozen <> space.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."can't access
ENDIF.
lv_access_granted = abap_true.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
global_lock = 'X'
object = lv_message_id
object_class = 'MSAG'
mode = 'D'
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 01
permission_failure = 02.
IF sy-subrc <> 0.
IF lv_access_granted = abap_true.
free_access_permission( lv_message_id ).
ENDIF.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."can't access
ENDIF.
delete_msgid( lv_message_id ).
IF lv_access_granted = abap_true.
free_access_permission( lv_message_id ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* fm RPY_MESSAGE_ID_INSERT almost works, but not in older versions
DATA: ls_t100a TYPE t100a,
ls_t100t TYPE t100t,
ls_t100u TYPE t100u,
lt_t100 TYPE TABLE OF t100,
lt_before TYPE TABLE OF t100u.
FIELD-SYMBOLS: <ls_t100> LIKE LINE OF lt_t100.
io_xml->read( EXPORTING iv_name = 'T100A'
CHANGING cg_data = ls_t100a ).
io_xml->read( EXPORTING iv_name = 'T100'
CHANGING cg_data = lt_t100 ).
corr_insert( iv_package ).
SELECT * FROM t100u INTO TABLE lt_before
WHERE arbgb = ls_t100a-arbgb ORDER BY msgnr. "#EC CI_GENBUFF "#EC CI_BYPASS
LOOP AT lt_t100 ASSIGNING <ls_t100>.
DELETE lt_before WHERE msgnr = <ls_t100>-msgnr.
MODIFY t100 FROM <ls_t100>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
CLEAR ls_t100u.
MOVE-CORRESPONDING <ls_t100> TO ls_t100u ##enh_ok.
ls_t100u-name = sy-uname.
ls_t100u-datum = sy-datum.
ls_t100u-selfdef = '3'.
MODIFY t100u FROM ls_t100u.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100U modify failed' ).
ENDIF.
ENDLOOP.
ls_t100a-masterlang = mv_language.
ls_t100a-lastuser = sy-uname.
ls_t100a-respuser = sy-uname.
ls_t100a-ldate = sy-datum.
ls_t100a-ltime = sy-uzeit.
MODIFY t100a FROM ls_t100a.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100A modify failed' ).
ENDIF.
ls_t100t-sprsl = mv_language.
ls_t100t-arbgb = ls_t100a-arbgb.
ls_t100t-stext = ls_t100a-stext.
MODIFY t100t FROM ls_t100t.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100T modify failed' ).
ENDIF.
LOOP AT lt_before INTO ls_t100u.
DELETE FROM t100 WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
DELETE FROM t100u WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
ENDLOOP.
deserialize_longtexts( io_xml ).
deserialize_texts( io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_arbgb TYPE t100a-arbgb.
SELECT SINGLE arbgb FROM t100a INTO lv_arbgb
WHERE arbgb = ms_item-obj_name. "#EC CI_GENBUFF
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_argument TYPE seqg3-garg.
lv_argument = |{ ms_item-obj_name }|.
OVERLAY lv_argument WITH ' '.
lv_argument = lv_argument && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = |ES_MSGSI|
iv_argument = lv_argument ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = 'MSAG'
in_new_window = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_msg_id TYPE rglif-message_id,
ls_inf TYPE t100a,
lt_source TYPE ty_t100s.
lv_msg_id = ms_item-obj_name.
SELECT SINGLE * FROM t100a INTO ls_inf
WHERE arbgb = lv_msg_id. "#EC CI_GENBUFF
IF sy-subrc <> 0.
RETURN.
ENDIF.
CLEAR ls_inf-respuser.
SELECT * FROM t100 INTO TABLE lt_source
WHERE sprsl = mv_language
AND arbgb = lv_msg_id
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
CLEAR: ls_inf-lastuser,
ls_inf-ldate,
ls_inf-ltime.
io_xml->add( iv_name = 'T100A'
ig_data = ls_inf ).
io_xml->add( ig_data = lt_source
iv_name = 'T100' ).
serialize_longtexts_msag( it_t100 = lt_source
ii_xml = io_xml ).
serialize_texts( io_xml ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
MODIFY t100a FROM ls_t100a.
```
Explanation: Modify only own DB tables.
```abap
MODIFY t100t FROM ls_t100t.
```
Explanation: Modify only own DB tables.
| 486 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
LOOP AT lt_before INTO ls_t100u.
DELETE FROM t100 WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
DELETE FROM t100u WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
ENDLOOP.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM t100 WHERE arbgb = ls_t100u-arbgb
```
Explanation: Modify only own DB tables.
```abap
DELETE FROM t100u WHERE arbgb = ls_t100u-arbgb
```
Explanation: Modify only own DB tables.
| 487 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD delete_extras.
DELETE FROM tddat WHERE tabname = iv_tabname.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM tddat WHERE tabname = iv_tabname.
```
Explanation: Modify only own DB tables.
| 489 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD update_extras.
IF is_tabl_extras-tddat IS INITIAL.
delete_extras( iv_tabname ).
ELSE.
MODIFY tddat FROM is_tabl_extras-tddat.
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
MODIFY tddat FROM is_tabl_extras-tddat.
```
Explanation: Modify only own DB tables.
| 490 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF lines( lt_tpool_i18n ) > 0.
MODIFY tstct FROM TABLE lt_tpool_i18n.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Update of t-code translations failed' ).
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
MODIFY tstct FROM TABLE lt_tpool_i18n.
```
Explanation: Modify only own DB tables.
| 491 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
METHOD save_authorizations.
CONSTANTS: lc_hex_chk TYPE x VALUE '04'.
DATA: ls_transaction TYPE tstc.
transaction_read( EXPORTING iv_transaction = iv_transaction
IMPORTING es_transaction = ls_transaction ).
DELETE FROM tstca WHERE tcode = iv_transaction.
IF ls_transaction IS NOT INITIAL.
INSERT tstca FROM TABLE it_authorizations.
ls_transaction-cinfo = ls_transaction-cinfo + lc_hex_chk.
UPDATE tstc SET cinfo = ls_transaction-cinfo WHERE tcode = ls_transaction-tcode.
ENDIF.
ENDMETHOD.
```
|
I found vulnerabilities in the line:
```abap
DELETE FROM tstca WHERE tcode = iv_transaction.
```
Explanation: Modify only own DB tables.
| 492 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
IF ls_transaction IS NOT INITIAL.
INSERT tstca FROM TABLE it_authorizations.
ls_transaction-cinfo = ls_transaction-cinfo + lc_hex_chk.
UPDATE tstc SET cinfo = ls_transaction-cinfo WHERE tcode = ls_transaction-tcode.
ENDIF.
```
|
I found vulnerabilities in the line:
```abap
INSERT tstca FROM TABLE it_authorizations.
```
Explanation: Modify only own DB tables.
```abap
UPDATE tstc SET cinfo = ls_transaction-cinfo WHERE tcode = ls_transaction-tcode.
```
Explanation: Modify only own DB tables.
| 493 |
Find vulnerabilities in this ABAP code snippet.
|
```abap
CLASS zcl_abapgit_object_type IMPLEMENTATION.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
read( ).
rv_bool = abap_true.
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
lv_typdname = ms_item-obj_name.
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TYPD_GET_OBJECT' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
TRY.
read( IMPORTING
ev_ddtext = lv_ddtext
et_source = lt_source ).
CATCH zcx_abapgit_not_found.
RETURN.
ENDTRY.
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_DD_TYGR_INSERT_SOURCES' ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_objname TYPE rsedd0-ddobjname.
lv_objname = ms_item-obj_name.
CALL FUNCTION 'RS_DD_DELETE_OBJ'
EXPORTING
no_ask = abap_true
objname = lv_objname
objtype = 'G'
EXCEPTIONS
not_executed = 1
object_not_found = 2
object_not_specified = 3
permission_failure = 4
dialog_needed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error deleting TYPE' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
jump_se11( iv_radio = 'RSRD1-TYMA'
iv_field = 'RSRD1-TYMA_VAL' ).
ENDMETHOD.
METHOD zif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
ENDCLASS.
```
|
I found vulnerabilities in the line:
```abap
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
```
Explanation: Potential dangerous statement INSERT REPORT.
| 496 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.