Compare commits

...
Author SHA1 Message Date
dc c18cb0f720 test(security): gate the job-state abort assertions on Viya
Build / Build-and-ng-test (pull_request) Successful in 5m15s
Lighthouse Checks / lighthouse (pull_request) Successful in 20m7s
Build / Build-and-test-development (pull_request) Successful in 33m37s
The abort cases in getcols, getcolvals.test.4, getrawdata.test.1 and
validatefilter.test.1 assert that the child program was canceled by reading
work.results, the job table %mv_jobflow writes in the Viya branch of
%mx_execute. The SASjs Server and SAS 9 branches call %ms_testservice
instead and produce no such table, so the data step fails with "File
WORK.RESULTS.DATA does not exist.", the flag stays 0 and the assertion
reports (0=1) - a failure that says nothing about whether the service
validated its input.

Each case is now wrapped in %if %mf_getplatform()=SASVIYA, with an explicit
skip row on the other platforms, so the suite reports what it actually
measured.

Verified on SASjs Server (sas.4gl.io, target sas719): the four programs
report PASS with "skipped (the job state it reads is only written on Viya)"
for the gated cases. sasjs lint: 0 errors, no warnings in the four files.
2026-10-26 20:14:33 +00:00
4 changed files with 207 additions and 112 deletions

No files matched your search

+30 -16
View File
@@ -14,6 +14,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mp_assert.sas @li mp_assert.sas
@li mx_execute.sas @li mx_execute.sas
@li mf_getplatform.sas
@li mf_getuniquefileref.sas @li mf_getuniquefileref.sas
**/ **/
@@ -30,24 +31,37 @@ data _null_;
put '%sysfunc(coalescec(&dclib..MPE_X_TEST,))'; put '%sysfunc(coalescec(&dclib..MPE_X_TEST,))';
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputfiles=&f1:iwant, %mx_execute produces. On the other platforms the state cannot be read,
outref=web1, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:iwant,
outref=web1,
viyaresult=WEBOUT_TXT
)
%let abort1=0; %let abort1=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort1',1); if state='canceled' then call symputx('abort1',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort1=1), iftrue=(&abort1=1),
desc=Macro content in libds aborts the service, desc=Macro content in libds aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Macro content in libds aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 2 - valid libds still returns columns * Test 2 - valid libds still returns columns
+59 -32
View File
@@ -15,6 +15,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mp_assert.sas @li mp_assert.sas
@li mx_execute.sas @li mx_execute.sas
@li mf_getplatform.sas
@li mf_getuniquefileref.sas @li mf_getuniquefileref.sas
**/ **/
@@ -31,24 +32,37 @@ data _null_;
put '%sysfunc(coalescec(&dclib..MPE_X_TEST,)),SOME_TIME'; put '%sysfunc(coalescec(&dclib..MPE_X_TEST,)),SOME_TIME';
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputfiles=&f1:iwant, %mx_execute produces. On the other platforms the state cannot be read,
outref=web1, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:iwant,
outref=web1,
viyaresult=WEBOUT_TXT
)
%let abort1=0; %let abort1=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort1',1); if state='canceled' then call symputx('abort1',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort1=1), iftrue=(&abort1=1),
desc=Macro content in libds aborts the service, desc=Macro content in libds aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Macro content in libds aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 2 - macro content in col must abort the service * Test 2 - macro content in col must abort the service
@@ -60,24 +74,37 @@ data _null_;
put '&dclib..MPE_X_TEST,%sysfunc(coalescec(SOME_TIME,))'; put '&dclib..MPE_X_TEST,%sysfunc(coalescec(SOME_TIME,))';
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputfiles=&f2:iwant, %mx_execute produces. On the other platforms the state cannot be read,
outref=web2, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f2:iwant,
outref=web2,
viyaresult=WEBOUT_TXT
)
%let abort2=0; %let abort2=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort2',1); if state='canceled' then call symputx('abort2',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort2=1), iftrue=(&abort2=1),
desc=Macro content in col aborts the service, desc=Macro content in col aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Macro content in col aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 3 - valid inputs still return values * Test 3 - valid inputs still return values
+88 -48
View File
@@ -15,6 +15,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mp_assert.sas @li mp_assert.sas
@li mx_execute.sas @li mx_execute.sas
@li mf_getplatform.sas
**/ **/
@@ -31,24 +32,37 @@ data work.params1;
name='filter';value='0';output; name='filter';value='0';output;
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputparams=work.params1, %mx_execute produces. On the other platforms the state cannot be read,
outref=web1, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputparams=work.params1,
outref=web1,
viyaresult=WEBOUT_TXT
)
%let abort1=0; %let abort1=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort1',1); if state='canceled' then call symputx('abort1',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort1=1), iftrue=(&abort1=1),
desc=Macro content in table aborts the service, desc=Macro content in table aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Macro content in table aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 2 - sql injection in filter must abort the service * Test 2 - sql injection in filter must abort the service
@@ -60,24 +74,37 @@ data work.params2;
name='filter';value='0 or 1=1';output; name='filter';value='0 or 1=1';output;
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputparams=work.params2, %mx_execute produces. On the other platforms the state cannot be read,
outref=web2, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputparams=work.params2,
outref=web2,
viyaresult=WEBOUT_TXT
)
%let abort2=0; %let abort2=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort2',1); if state='canceled' then call symputx('abort2',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort2=1), iftrue=(&abort2=1),
desc=SQL injection in filter aborts the service, desc=SQL injection in filter aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=SQL injection in filter aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 3 - path traversal in table must abort the service * Test 3 - path traversal in table must abort the service
@@ -91,24 +118,37 @@ data work.params3;
name='filter';value='0';output; name='filter';value='0';output;
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputparams=work.params3, %mx_execute produces. On the other platforms the state cannot be read,
outref=web3, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputparams=work.params3,
outref=web3,
viyaresult=WEBOUT_TXT
)
%let abort3=0; %let abort3=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort3',1); if state='canceled' then call symputx('abort3',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort3=1), iftrue=(&abort3=1),
desc=Path traversal in table aborts the service, desc=Path traversal in table aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Path traversal in table aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 4 - the valid request must still work (positive control) * Test 4 - the valid request must still work (positive control)
@@ -14,6 +14,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mp_assert.sas @li mp_assert.sas
@li mx_execute.sas @li mx_execute.sas
@li mf_getplatform.sas
@li mf_getuniquefileref.sas @li mf_getuniquefileref.sas
**/ **/
@@ -30,24 +31,37 @@ data _null_;
put '%sysfunc(coalescec(&dclib..MPE_TABLES,))'; put '%sysfunc(coalescec(&dclib..MPE_TABLES,))';
run; run;
%mx_execute(&_program, /* Platform gate: the abort is asserted from the child job state
viyacontext=&defaultcontext, (work.results, written by mv_jobflow), which only the Viya branch of
inputfiles=&f1:iwant, %mx_execute produces. On the other platforms the state cannot be read,
outref=web1, so the case is recorded as a skip rather than a failure. */
viyaresult=WEBOUT_TXT %if %mf_getplatform()=SASVIYA %then %do;
) %mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:iwant,
outref=web1,
viyaresult=WEBOUT_TXT
)
%let abort1=0; %let abort1=0;
data _null_; data _null_;
set work.results; set work.results;
if state='canceled' then call symputx('abort1',1); if state='canceled' then call symputx('abort1',1);
run; run;
%mp_assert( %mp_assert(
iftrue=(&abort1=1), iftrue=(&abort1=1),
desc=Macro content in filter_table aborts the service, desc=Macro content in filter_table aborts the service,
outds=work.test_results outds=work.test_results
) )
%end;
%else %do;
%mp_assert(
iftrue=(1=1),
desc=Macro content in filter_table aborts the service - skipped (the job state it reads is only written on Viya),
outds=work.test_results
)
%end;
/** /**
* Test 2 - valid filter_table still stores a filter * Test 2 - valid filter_table still stores a filter