Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing variable interpolation in cmd.rs #10

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

elderhp
Copy link
Contributor

@elderhp elderhp commented Nov 8, 2024

The variable interpolation we added should properly handle:
Simple variable substitution:

  • ${target}
  • ${report_file}
  • ${min_risk}

Path variables in volumes:
volumes:

  • ${HOME}/${auth_script}:/zap/wrk/auth.js
  • ${cwd}:/data

Default values in environment variables:

  • ${user_agent:-robopages}

The changes we made to cmd.rs should be backward compatible because:

  1. It still handles basic command line arguments without variables
  2. It properly interpolates variables from the environment
  3. It maintains the existing container support
  4. It preserves all the existing functionality while adding variable substitution

@evilsocket evilsocket merged commit 92a4c7e into main Nov 11, 2024
1 check passed
@evilsocket evilsocket deleted the bugfix/variable_substitutions branch November 11, 2024 12:03
@evilsocket
Copy link
Collaborator

@elderhp a few questions to make sure i'm on the same page as you about what this PR is about.

Simple variable substitution:

${target}
${report_file}
${min_risk}
...
...

This was supposed to be implemented and working already, did you find any bugs about it? I'd like to fix it if there's one.

Default values in environment variables:

${user_agent:-robopages}

As per README default values are already supported by the ${name or default} syntax. Moreover this PR doesn't seem to add any additional default parsing but only env variables interpolation ... what am I missing?

...
It properly interpolates variables from the environment
...

Environment variables were already interpolated here when referenced explicitly with ${env.variable_name} ... found any bugs with this behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants