variables in zap.yaml

789 views
Skip to first unread message

Richard DAmelio

unread,
May 11, 2022, 4:07:43 PM5/11/22
to OWASP ZAP User Group
Has anyone used variables for there The top level url in their yaml file or any other value then executed it using -autorun commandline option?

I'm running the following command,

docker container run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-live bash -c "zap.sh -cmd -addonupdate -addoninstall jython; zap.sh -cmd -autorun /zap/wrk/zap.yaml"

But now i want to parameterize some of the values in the zap.yaml so it will be more robust.

Is there an example on how to do this and then how to execute it?

Simon Bennetts

unread,
May 12, 2022, 6:49:15 AM5/12/22
to OWASP ZAP User Group
Note the lines:

     users:

     - name: "guest"

       username: "${JIGSAW_USER}"

       password: "${JIGSAW_PWORD}"

Note the lines:

export JIGSAW_USER="guest"

export JIGSAW_PWORD="guest"

Does that help?

Cheers,

Simon

Richard DAmelio

unread,
May 13, 2022, 10:20:04 AM5/13/22
to OWASP ZAP User Group
Yes exactly like that, thank you.

Will this work for the env section too, or just the parameters section?

env:
  contexts:                                     
  - name: "Default Context"                      
    urls:
    - "https://#.###.###.###"  // Can i make this a parameter?

Simon Bennetts

unread,
May 13, 2022, 10:37:42 AM5/13/22
to OWASP ZAP User Group
Yes, URLs are one of the key places we expect variables to be used.

If you find anywhere where you need variables to work and they dont then let us know - we want these things to be useful ;)

Cheers,

Simon
Reply all
Reply to author
Forward
0 new messages