Even with source/object management systems in place, it's still possible for someone with sufficient authority...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
to alter a production source file member while using the STRSEU command.
It's too easy for managers or senior programmers who are looking at or researching production code to accidentally alter or delete lines of source or mistakenly start modifying a production source instead of a development version of source. You can track those kinds of mistakes through security auditing, journaling, etc., but it's better to prevent those simple errors rather than fixing them.
One way to help limit this exposure is thru the use of a validity checker program on the STRSEU command. Validity checker programs can be used on any AS/400 command, and these programs receive the command parameters before the actual execution of a command. That gives you an additional level of control (such as logging or altering the command parameters) for any AS/400 command, even if the user is QSECOFR. This example program intercepts the parms entered by the user on the STRSEU command and then changes the user's request to be browse-only if he isn't requesting to print the source member. It uses part of the library name to determine when to limit the editing of source members, but how you choose to determine what needs to be limited depends on your individual circumstances.
This method isn't foolproof, but it does offer a reasonable way to limit accidental changes in your production source code. If you need to alter a production source member with this method in place, you can still do it but you have to be much more intentional about it. If you do an option 25 (find string) on WRKMBRPDM and specify 2 for editing, that method apparently calls an API directly rather than using the STRSEU command so the validity checker program does not come into play. Because a validity checker program does alter an IBM-supplied command, you will have to reapply the validity checker program to the STRSEU command after every new release.
To add the validity checker program to the STRSEU command type the following:
CHGCMD CMD(STRSEU) VLDCKR(MYLIB/STRSEU)
STRSEU Command CL Source PGM PARM(&P20 &P10 &P8 &P6 &P50) DCL VAR(&P20) TYPE(*CHAR) LEN(20) DCL VAR(&P10) TYPE(*CHAR) LEN(10) DCL VAR(&P8) TYPE(*CHAR) LEN(08) DCL VAR(&P6) TYPE(*CHAR) LEN(06) DCL VAR(&P50) TYPE(*CHAR) LEN(50) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&FILE) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF0000) CHGVAR VAR(&FILE) VALUE(%SST(&P20 1 10)) CHGVAR VAR(&LIB) VALUE(%SST(&P20 11 10)) /* IF USER REQUESTED BY LIBL, DETERMINE WHERE SOURCE FILE RESIDES */ IF COND(&LIB *EQ ' ' *OR &LIB *EQ + '*LIBL ') THEN(RTVOBJD OBJ(&FILE) + OBJTYPE(*FILE) RTNLIB(&LIB)) /* INTERCEPT PARM AND CHANGE IT TO BROWSE ONLY IF NOT PRINTING */ IF COND(%SST(&LIB 5 3) *EQ 'PRD' *AND &P6 *NE + '6') THEN(CHGVAR VAR(&P6) VALUE('5 ')) ENDPGM
About the author: Tim is vice president of Technical Services at Interlink Technologies in Maumee, Ohio, where he serves as chief architect for their warehouse management system. He has worked in the banking, insurance, healthcare and distribution industries in various positions, including programmer/analyst, systems analyst and DP manager. Tim has worked on IBM midrange platforms since 1983.
- Prevent access for a user with *ALLOBJ special authority:
Find out how to prevent a user with *ALLOBJ special authority from accessing specific files/programs until you can get the *ALLOBJ authority away from them.
- Use security audit for your applications:
With this tips you can log access or security violations.
- Search400's Best Developer Web Links: tips, tutorials and more.
- Ask your programmer questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our programmer gurus are waiting to answer your technical questions.