Skip to content

Commit c0d795a

Browse files
committed
otp: add bidi scanner
addition of bidi scanner and fix of invisible unicode from when Erlang/OTP translated XML to markdown.
1 parent 9d78ea3 commit c0d795a

5 files changed

Lines changed: 244 additions & 149 deletions

File tree

.github/workflows/main.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,34 @@ jobs:
8989
exit 1
9090
fi
9191
92+
semgrep:
93+
name: Semgrep Scan
94+
runs-on: ubuntu-latest
95+
permissions:
96+
contents: read
97+
security-events: write
98+
99+
container:
100+
image: semgrep/semgrep@sha256:a3d49dc967b8534a6a76628e50c51cbfe33eb7195dc2feab1fdc0f100852c8ef
101+
102+
steps:
103+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104+
- name: Run Semgrep
105+
env:
106+
SEMGREP_SEND_METRICS: off
107+
run: |
108+
semgrep \
109+
--config ".semgrep/" \
110+
--error \
111+
--sarif \
112+
--output semgrep.sarif
113+
114+
- name: Upload SARIF to GitHub Security tab
115+
uses: github/codeql-action/upload-sarif@2d6b98c7cf7260afd6954ee7de478b21127b40f4 # ratchet:github/codeql-action/upload-sarif@v3.29.7
116+
with:
117+
sarif_file: semgrep.sarif
118+
if: always()
119+
92120
pack:
93121
name: Build Erlang/OTP (64-bit)
94122
runs-on: ubuntu-latest

.semgrep/bidi-unicode.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# %CopyrightBegin%
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Copyright Ericsson AB 2026. All Rights Reserved.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
# %CopyrightEnd%
21+
#
22+
rules:
23+
- id: bidi-invisible-unicode
24+
patterns:
25+
- pattern-regex: "[\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u00AD]"
26+
message: >
27+
Dangerous bidirectional or invisible Unicode character detected in $PATH.
28+
This may indicate a Trojan Source attack (CVE-2021-42574).
29+
Remove or replace the character.
30+
languages:
31+
- generic
32+
severity: ERROR
33+
metadata:
34+
category: security
35+
cwe: "CWE-116"
36+
references:
37+
- https://trojansource.codes

.semgrepignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
%
2+
% %CopyrightBegin%
3+
%
4+
% SPDX-License-Identifier: Apache-2.0
5+
%
6+
% Copyright Ericsson AB 2026. All Rights Reserved.
7+
%
8+
% Licensed under the Apache License, Version 2.0 (the "License");
9+
% you may not use this file except in compliance with the License.
10+
% You may obtain a copy of the License at
11+
%
12+
% http://www.apache.org/licenses/LICENSE-2.0
13+
%
14+
% Unless required by applicable law or agreed to in writing, software
15+
% distributed under the License is distributed on an "AS IS" BASIS,
16+
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
% See the License for the specific language governing permissions and
18+
% limitations under the License.
19+
%
20+
% %CopyrightEnd%
21+
%
22+
.semgrep/
23+
lib/stdlib/uc_spec/
24+
lib/stdlib/test/io_proto_SUITE_data/external_utf8_bom.dat
25+
lib/stdlib/test/io_proto_SUITE_data/testdata_utf8_bom.dat
26+
lib/kernel/test/interactive_shell_SUITE.erl
27+
lib/stdlib/test/json_SUITE_data/i_structure_UTF-8_BOM_empty_object.json
28+
lib/stdlib/test/json_SUITE_data/n_structure_UTF8_BOM_no_data.json
29+
lib/stdlib/test/re_SUITE_data/testoutput4
30+
semgrep.sarif

erts/doc/references/erlc_cmd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ of situations that force a restart:
257257
[compile server](erlc_cmd.md#compile_server) by the given name, allowing a
258258
single user to run multiple unrelated builds in parallel without them
259259
affecting each other, which can be useful for shared build machines and the
260-
like. The name must be alpha­numeric, and it defaults to being empty.
260+
like. The name must be alpha-numeric, and it defaults to being empty.
261261

262262
## See Also
263263

0 commit comments

Comments
 (0)