Skip to content

Commit 9f0f40d

Browse files
committed
Add "Correct Usage" and "Incorrect Usage" headings
1 parent 9521994 commit 9f0f40d

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

actions/ql/src/Security/CWE-275/MissingActionsPermissions.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ If a GitHub Actions job or workflow has no explicit permissions set, then the re
44

55
## Recommendation
66

7-
Add the `permissions` key to the job or the root of workflow (in this case it is applied to all jobs in the workflow that do not have their own `permissions` key) and assign the least privileges required to complete the task:
7+
Add the `permissions` key to the job or the root of workflow (in this case it is applied to all jobs in the workflow that do not have their own `permissions` key) and assign the least privileges required to complete the task.
8+
9+
## Example
10+
11+
### Incorrect Usage
12+
13+
```yaml
14+
name: "My workflow"
15+
# No permissions block
16+
```
17+
18+
### Correct Usage
819

920
```yaml
1021
name: "My workflow"

actions/ql/src/Security/CWE-312/SecretsInArtifacts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Only store information that is meant to be publicly available in a GitHub Action
88

99
## Example
1010

11+
### Incorrect Usage
12+
1113
The following example uses `actions/checkout` to checkout code which stores the GITHUB_TOKEN in the \`.git/config\` file and then stores the contents of the \`.git\` repository into the artifact:
1214

1315
```yaml
@@ -26,6 +28,8 @@ jobs:
2628
path: .
2729
```
2830
31+
### Correct Usage
32+
2933
The issue has been fixed below, where the `actions/upload-artifact` uses a version (v4+) which does not include hidden files or directories into the artifact.
3034

3135
```yaml

java/ql/src/Violations of Best Practice/Undesirable Calls/DoNotCallFinalize.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Avoid calling `finalize()` in application code. Allow the JVM to determine a gar
88

99
## Example
1010

11+
### Incorrect Usage
12+
1113
```java
1214
class LocalCache {
1315
private Collection<File> cacheFiles = ...;
@@ -21,6 +23,8 @@ void main() {
2123
}
2224
```
2325

26+
### Correct Usage
27+
2428
```java
2529
import java.lang.AutoCloseable;
2630
import java.lang.Override;

ruby/ql/src/queries/variables/UninitializedLocal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Note: You do not need to explicitly initialize the variable, if you can make the
1111

1212
## Example
1313

14+
### Incorrect Usage
15+
1416
In the following code, the call to `create_file` may fail and then the call `f.close` will raise a `NoMethodError` since `f` will be `nil` at that point.
1517

1618
```ruby
@@ -22,6 +24,8 @@ ensure
2224
end
2325
```
2426

27+
### Correct Usage
28+
2529
We can fix this by using safe navigation:
2630
```ruby
2731
def dump(x)

0 commit comments

Comments
 (0)