Skip to content

Commit f7f9c0f

Browse files
authored
Add Pipelines As Code Documentation (#188)
1 parent b8181bf commit f7f9c0f

File tree

3 files changed

+113
-1
lines changed

3 files changed

+113
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ See the [documentation](docs/content/en/rules) for a list of rules currently sup
2424

2525
## Why `poutine`?
2626

27-
In French, the word "poutine", when not referring to the [dish](https://en.wikipedia.org/wiki/Poutine), can be used to mean "messy". Inspired by the complexity and intertwined dependencies of modern open-source projects, `poutine` reflects both a nod to our Montreal roots and the often messy, complex nature of securing software supply chains.
27+
In French, the word "poutine", when not referring to the [dish](https://en.wikipedia.org/wiki/Poutine), can be used to mean "messy". Inspired by the complexity and intertwined dependencies of modern open-source projects, `poutine` reflects both a nod to our Montreal roots and the often messy, complex nature of securing software supply chains.
28+
29+
## Supported Platforms
30+
31+
- GitHub Actions
32+
- Gitlab Pipelines
33+
- Azure DevOps
34+
- Pipelines As Code Tekton
2835

2936
## Getting Started
3037

docs/content/en/rules/injection.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,58 @@ jobs:
7575
})
7676
```
7777
78+
## Remediation
79+
80+
### Pipeline as Code Tekton
81+
82+
#### Anti-Pattern
83+
```yaml
84+
apiVersion: tekton.dev/v1beta1
85+
kind: PipelineRun
86+
metadata:
87+
name: linters
88+
annotations:
89+
pipelinesascode.tekton.dev/on-event: "[push, pull_request]"
90+
pipelinesascode.tekton.dev/on-target-branch: "[*]"
91+
pipelinesascode.tekton.dev/task: "[git-clone]"
92+
spec:
93+
params:
94+
- name: repo_url
95+
value: "{{repo_url}}"
96+
- name: revision
97+
value: "{{revision}}"
98+
pipelineSpec:
99+
params:
100+
- name: repo_url
101+
- name: revision
102+
tasks:
103+
- name: fetchit
104+
displayName: "Fetch git repository"
105+
params:
106+
- name: url
107+
value: $(params.repo_url)
108+
- name: revision
109+
value: $(params.revision)
110+
taskRef:
111+
name: git-clone
112+
workspaces:
113+
- name: output
114+
workspace: source
115+
- name: validate
116+
displayName: "Injecting body in script"
117+
runAfter:
118+
- fetchit
119+
taskSpec:
120+
workspaces:
121+
- name: source
122+
steps:
123+
- name: execute
124+
image: some.registry/some-image
125+
script: |
126+
validate_pr "{{body.pull_request.body}}"
127+
...
128+
```
129+
78130
## See Also
79131
- [Understanding the risk of script injections](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections)
80132
- [Good practices for mitigating script injection attacks](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#good-practices-for-mitigating-script-injection-attacks)

docs/content/en/rules/untrusted_checkout_exec.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,59 @@ Organization Setting:
207207
Avoid activating the following settings to prevent issues:
208208
![img_1.png](img_1.png)
209209
210+
### Pipeline As Code Tekton
211+
212+
#### Anti-Pattern
213+
214+
```yaml
215+
apiVersion: tekton.dev/v1beta1
216+
kind: PipelineRun
217+
metadata:
218+
name: linters
219+
annotations:
220+
pipelinesascode.tekton.dev/on-event: "[push, pull_request]"
221+
pipelinesascode.tekton.dev/on-target-branch: "[*]"
222+
pipelinesascode.tekton.dev/task: "[git-clone]"
223+
spec:
224+
params:
225+
- name: repo_url
226+
value: "{{repo_url}}"
227+
- name: revision
228+
value: "{{revision}}"
229+
pipelineSpec:
230+
params:
231+
- name: repo_url
232+
- name: revision
233+
tasks:
234+
- name: fetchit
235+
displayName: "Fetch git repository"
236+
params:
237+
- name: url
238+
value: $(params.repo_url)
239+
- name: revision
240+
value: $(params.revision)
241+
taskRef:
242+
name: git-clone
243+
workspaces:
244+
- name: output
245+
workspace: source
246+
- name: npm
247+
displayName: "NPM Install"
248+
runAfter:
249+
- fetchit
250+
taskSpec:
251+
workspaces:
252+
- name: source
253+
steps:
254+
- name: npm-install
255+
image: node:16
256+
workingDir: $(workspaces.source.path)
257+
script: |
258+
npm install
259+
...
260+
261+
```
262+
210263

211264

212265
## See Also

0 commit comments

Comments
 (0)