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

Obfuscate execpath from pipeline objects returned to clients #229

Merged
merged 1 commit into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions frontend/src/views/pipeline/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
<article class="tile is-child notification content-article box">
<table class="pipeline-detail-table">
<tr><th>Name</th><td>{{pipeline.name}}</td></tr>
<tr><th>Type</th><td>{{pipeline.type}}</td></tr>
<tr><th>Repo</th><td>{{pipeline.repo.url}}</td></tr>
<tr><th>Branch</th><td>{{pipeline.repo.selectedbranch}}</td></tr>
<tr><th>Location</th><td>{{pipeline.execpath}}</td></tr>
<tr><th>Created</th><td><span :title="pipeline.created" v-tippy="{ arrow : true, animation : 'shift-away'}">{{
convertTime(pipeline.created) }}</span></td></tr>
<tr><th>Trigger Token</th><td>{{pipeline.trigger_token}}</td></tr>

<tr v-if="lastSuccessfulRun">
Expand Down Expand Up @@ -124,12 +126,16 @@
</template>

<script>
import Vue from 'vue'
import Vis from 'vis'
import { Modal } from 'vue-bulma-modal'
import { VueGoodTable } from 'vue-good-table'
import 'vue-good-table/dist/vue-good-table.css'
import moment from 'moment'
import helper from '../../helper'
import VueTippy from 'vue-tippy'

Vue.use(VueTippy)

export default {
components: {
Expand Down Expand Up @@ -196,7 +202,9 @@ export default {
arrows: { to: true }
}
},
pipeline: null
pipeline: null,
lastSuccessfulRun: null,
lastRun: null
}
},

Expand Down Expand Up @@ -511,6 +519,10 @@ export default {

checkPipelineArgsAndStartPipeline () {
helper.StartPipelineWithArgsCheck(this, this.pipeline)
},

convertTime (time) {
return moment(time).fromNow()
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions handlers/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ func PipelineGetAll(c echo.Context) error {
// Get all active pipelines
pipelines := pipeline.GlobalActivePipelines.GetAll()

// Obscure non-necessary information
for id := range pipelines {
obscurePipelineData(&pipelines[id])
}

// Return as json
return c.JSON(http.StatusOK, pipelines)
}
Expand All @@ -121,6 +126,7 @@ func PipelineGet(c echo.Context) error {
// Look up pipeline for the given id
for _, p := range pipeline.GlobalActivePipelines.GetAll() {
if p.ID == pipelineID {
obscurePipelineData(&p)
return c.JSON(http.StatusOK, p)
}
}
Expand Down Expand Up @@ -452,6 +458,7 @@ func PipelineGetAllWithLatestRun(c echo.Context) error {

// Append run if one exists
g := getAllWithLatestRun{}
obscurePipelineData(&p)
g.Pipeline = p
if run != nil {
g.PipelineRun = *run
Expand Down Expand Up @@ -484,3 +491,8 @@ func PipelineCheckPeriodicSchedules(c echo.Context) error {
// All entries are valid.
return c.JSON(http.StatusOK, nil)
}

// obscurePipelineData obscures pipeline data from the given pipeline object
func obscurePipelineData(p *gaia.Pipeline) {
p.ExecPath = ""
}