Skip to content

Commit 8dc8e5d

Browse files
Merge pull request #40 from PowerShellWeb/GQL-Container-Fix
GQL 0.1.1
2 parents 14532b8 + 071608e commit 8dc8e5d

File tree

8 files changed

+144
-6
lines changed

8 files changed

+144
-6
lines changed

.github/workflows/BuildGQL.yml

+3
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ jobs:
533533
with:
534534
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
535535
flavor: latest=true
536+
env:
537+
REGISTRY: ghcr.io
538+
IMAGE_NAME: ${{ github.repository }}
536539
- name: Build and push Docker image (from main)
537540
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
538541
uses: docker/build-push-action@master

Build/GitHub/Steps/BuildAndPublishContainer.psd1

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
3333
'flavor'='latest=true'
3434
}
35+
env = @{
36+
REGISTRY = 'ghcr.io'
37+
IMAGE_NAME = '${{ github.repository }}'
38+
}
3539
}
3640
@{
3741
name = 'Build and push Docker image (from main)'

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## GQL 0.1.1
2+
3+
* Fixing Container Build (#38, #39)
4+
* Adding SECURITY.md (#17)
5+
6+
---
7+
18
## GQL 0.1
29

310
* Initial Release of GQL

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM mcr.microsoft.com/powershell AS powershell
33

44
# Set the module name to the name of the module we are building
5-
ENV ModuleName=HtmxPS
5+
ENV ModuleName=GQL
66
ENV InstallAptGet="git","curl","ca-certificates","libc6","libgcc1"
77
ENV InstallModule="ugit"
88
# Copy the module into the container

GQL.psd1

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.1'
2+
ModuleVersion = '0.1.1'
33
RootModule = 'GQL.psm1'
44
Guid = '9bf5c922-9f36-4c52-a7b6-d435837d4fa9'
55
Author = 'James Brundage'
@@ -12,11 +12,10 @@
1212
ProjectURI = 'https://github.com/PowerShellWeb/GQL'
1313
LicenseURI = 'https://github.com/PowerShellWeb/GQL/blob/main/LICENSE'
1414
ReleaseNotes = @'
15-
## GQL 0.1
15+
## GQL 0.1.1
1616
17-
* Initial Release of GQL
18-
* One Simple Command for GraphQL: `Get-GQL` (or `GQL`)
19-
* Container and GitHub action included!
17+
* Fixing Container Build (#38, #39)
18+
* Adding SECURITY.md (#17)
2019
2120
---
2221

SECURITY.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Security
2+
3+
We take security seriously. If you believe you have discovered a vulnerability, please [file an issue](https://github.com/PowerShellWeb/GQL/issues).
4+
5+
## Special Security Considerations
6+
7+
When using this module, take care to secure your GraphQL token. _Never_ hardcode a value, even as an example.
8+
9+
GraphQL is very powerful, and the Graph API should be queried carefully.
10+
11+
It is also highly recommended you use a Graph API token with limited rights.
12+
13+
Using your own personal access token can compromise your account.
14+
15+
Finally, and importantly, review any queries that you run before you run them.
16+
17+
Any GraphQL query you did not write could do more than you expect it to.
18+
19+
### -WhatIf and -Confirm for extra safety
20+
21+
For safety purposes, GQL SupportsShouldProcess.
22+
23+
This adds two parameters, -WhatIf and -Confirm.
24+
25+
Use -WhatIf to determine how to run the query with Invoke-RestMethod, without running it directly.
26+
27+
Use -Confirm to prompt for confirmation before each query is executed.
28+
29+
~~~PowerShell
30+
GQL ./Examples/GetSchemaTypes.gql -Confirm
31+
~~~
32+
33+
### Use Variables for more security
34+
35+
Hardcoded values can reveal insecure information.
36+
37+
## Never Execute Result Data
38+
39+
Seriously:
40+
41+
**Never Execute Result Data**
42+
43+
In PowerShell, on of the most dangerous things you can do is `Invoke-Expression`.
44+
45+
This runs whatever is in the data, and is the path to code injection attacks.
46+
47+
Another dangerous thing you can do is `$executionContext.SessionState.InvokeCommand.ExpandString`.
48+
49+
This expands a string containing subexpressions, which can also inject code.
50+
51+
If you were to directly Invoke or expand code from a GraphQL result, it could compromise your system (and possibly your network)
52+
53+
If you were to directly evaluate code from a GraphQL result in any other language, it could compromise that application (and possibly your network)
54+
55+
So, once more:
56+
57+
*Never Execute Result Data*
58+
59+
## Please Enjoy Responsibly

docs/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## GQL 0.1.1
2+
3+
* Fixing Container Build (#38, #39)
4+
* Adding SECURITY.md (#17)
5+
6+
---
7+
18
## GQL 0.1
29

310
* Initial Release of GQL

docs/SECURITY.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Security
2+
3+
We take security seriously. If you believe you have discovered a vulnerability, please [file an issue](https://github.com/PowerShellWeb/GQL/issues).
4+
5+
## Special Security Considerations
6+
7+
When using this module, take care to secure your GraphQL token. _Never_ hardcode a value, even as an example.
8+
9+
GraphQL is very powerful, and the Graph API should be queried carefully.
10+
11+
It is also highly recommended you use a Graph API token with limited rights.
12+
13+
Using your own personal access token can compromise your account.
14+
15+
Finally, and importantly, review any queries that you run before you run them.
16+
17+
Any GraphQL query you did not write could do more than you expect it to.
18+
19+
### -WhatIf and -Confirm for extra safety
20+
21+
For safety purposes, GQL SupportsShouldProcess.
22+
23+
This adds two parameters, -WhatIf and -Confirm.
24+
25+
Use -WhatIf to determine how to run the query with Invoke-RestMethod, without running it directly.
26+
27+
Use -Confirm to prompt for confirmation before each query is executed.
28+
29+
~~~PowerShell
30+
GQL ./Examples/GetSchemaTypes.gql -Confirm
31+
~~~
32+
33+
### Use Variables for more security
34+
35+
Hardcoded values can reveal insecure information.
36+
37+
## Never Execute Result Data
38+
39+
Seriously:
40+
41+
**Never Execute Result Data**
42+
43+
In PowerShell, on of the most dangerous things you can do is `Invoke-Expression`.
44+
45+
This runs whatever is in the data, and is the path to code injection attacks.
46+
47+
Another dangerous thing you can do is `$executionContext.SessionState.InvokeCommand.ExpandString`.
48+
49+
This expands a string containing subexpressions, which can also inject code.
50+
51+
If you were to directly Invoke or expand code from a GraphQL result, it could compromise your system (and possibly your network)
52+
53+
If you were to directly evaluate code from a GraphQL result in any other language, it could compromise that application (and possibly your network)
54+
55+
So, once more:
56+
57+
*Never Execute Result Data*
58+
59+
## Please Enjoy Responsibly

0 commit comments

Comments
 (0)