Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Escape injected variables in shell scripts #1860

Merged
merged 8 commits into from
Dec 16, 2018

Conversation

Gerhut
Copy link
Member

@Gerhut Gerhut commented Dec 10, 2018

No description provided.

@coveralls
Copy link

coveralls commented Dec 10, 2018

Coverage Status

Coverage increased (+0.02%) to 51.785% when pulling b62d00a on qixcheng/rest-server/shell-inject into c5ce662 on master.

@Gerhut
Copy link
Member Author

Gerhut commented Dec 10, 2018

The bottom one is for backward compatibility

Copy link

@sterowang sterowang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

echo PAI_DEFAULT_FS_URI={{ hdfsUri }} >> $ENV_LIST
echo PAI_JOB_NAME={{ jobData.jobName }} >> $ENV_LIST
echo PAI_USER_NAME={{ jobData.userName }} >> $ENV_LIST
echo PAI_DATA_DIR={{ jobData.dataDir }} >> $ENV_LIST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User can set/modify arbitrary environment variable here because the job data will be unescaped by echo.
(I don't know how to make use of it...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job env will be only enabled in docker containers, so I think any unpredicted modifications will be safe.

@Gerhut Gerhut force-pushed the qixcheng/rest-server/shell-inject branch from 54767ab to b62d00a Compare December 14, 2018 07:17
@Gerhut Gerhut merged commit 26e050d into master Dec 16, 2018
@Gerhut Gerhut deleted the qixcheng/rest-server/shell-inject branch December 16, 2018 07:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants