Skip to content

Commit a210745

Browse files
author
Dart CI
committed
Version 3.4.0
Merge 3.4.0-282.4.beta into stable
2 parents d70d99a + e56cb47 commit a210745

File tree

12,761 files changed

+347671
-272992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

12,761 files changed

+347671
-272992
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.cpp text eol=lf
55
*.h text eol=lf
66
*.dart text eol=lf
7+
*.sh text eol=lf
78

89
# Explicitly declare text files we want to be normalized.
910
*.gyp text

.github/ISSUE_TEMPLATE/2_cherry_pick.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ assignees:
88
- vsmenon
99
- itsjustkevin
1010
body:
11-
- type: input
11+
- type: textarea
1212
id: commit_hash
1313
attributes:
1414
label: Commit(s) to merge
15-
description: What are the commit hash(es) that have been merged to main?
15+
description: What are the changelist(s) that have been merged to main?
1616
validations:
1717
required: true
1818
- type: input
1919
id: target
2020
attributes:
2121
label: Target
22-
description: Should this be cherry-picked to beta, stable or both?
22+
description: Should the changes be cherry-picked to beta, stable, or both?
2323
validations:
2424
required: true
2525
- type: input
2626
id: changelist
2727
attributes:
2828
label: Prepared changelist for beta/stable
29-
description: Gerrit changelist against beta/stable per https://github.com/dart-lang/sdk/wiki/Cherry-picks-to-a-release-channel
29+
description: Gerrit changelist(s) against beta and/or stable per https://github.com/dart-lang/sdk/wiki/Cherry-picks-to-a-release-channel
3030
validations:
3131
required: true
3232
- type: textarea
@@ -50,15 +50,11 @@ body:
5050
description: Describe the reasons, impacted users and functional issues to explain why this should be cherry-picked.
5151
validations:
5252
required: true
53-
- type: dropdown
53+
- type: textarea
5454
id: risk
5555
attributes:
5656
label: Risk
5757
description: What is the risk level of this cherry-pick?
58-
options:
59-
- low
60-
- medium
61-
- high
6258
validations:
6359
required: true
6460
- type: input

.github/extract_deps.py

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright 2013 The Flutter Authors. All rights reserved.
4+
# Use of this source code is governed by a BSD-style license that can be
5+
# found in the LICENSE file.
6+
#
7+
# Usage: scan_deps.py --deps <DEPS file> --output <parsed lockfile>
8+
#
9+
# This script extracts the dependencies provided from the DEPS file and
10+
# finds the appropriate git commit hash per dependency for osv-scanner
11+
# to use in checking for vulnerabilities.
12+
# It is expected that the lockfile output of this script is then
13+
# uploaded using GitHub actions to be used by the osv-scanner reusable action.
14+
15+
import argparse
16+
import json
17+
import os
18+
import re
19+
import shutil
20+
import subprocess
21+
import sys
22+
23+
SCRIPT_DIR = os.path.dirname(sys.argv[0])
24+
CHECKOUT_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
25+
DEP_CLONE_DIR = CHECKOUT_ROOT + '/clone-test'
26+
DEPS = os.path.join(CHECKOUT_ROOT, 'DEPS')
27+
28+
29+
# Used in parsing the DEPS file.
30+
class VarImpl:
31+
_env_vars = {
32+
'host_cpu': 'x64',
33+
'host_os': 'linux',
34+
}
35+
36+
def __init__(self, local_scope):
37+
self._local_scope = local_scope
38+
39+
def lookup(self, var_name):
40+
"""Implements the Var syntax."""
41+
if var_name in self._local_scope.get('vars', {}):
42+
return self._local_scope['vars'][var_name]
43+
# Inject default values for env variables.
44+
if var_name in self._env_vars:
45+
return self._env_vars[var_name]
46+
raise Exception('Var is not defined: %s' % var_name)
47+
48+
49+
def extract_deps(deps_file):
50+
local_scope = {}
51+
var = VarImpl(local_scope)
52+
global_scope = {
53+
'Var': var.lookup,
54+
'deps_os': {},
55+
}
56+
# Read the content.
57+
with open(deps_file, 'r') as file:
58+
deps_content = file.read()
59+
60+
# Eval the content.
61+
exec(deps_content, global_scope, local_scope)
62+
63+
if not os.path.exists(DEP_CLONE_DIR):
64+
os.mkdir(DEP_CLONE_DIR) # Clone deps with upstream into temporary dir.
65+
66+
# Extract the deps and filter.
67+
deps = local_scope.get('deps', {})
68+
filtered_osv_deps = []
69+
for _, dep in deps.items():
70+
# We currently do not support packages or cipd which are represented
71+
# as dictionaries.
72+
if not isinstance(dep, str):
73+
continue
74+
75+
dep_split = dep.rsplit('@', 1)
76+
filtered_osv_deps.append({
77+
'package': {'name': dep_split[0], 'commit': dep_split[1]}
78+
})
79+
80+
try:
81+
# Clean up cloned upstream dependency directory.
82+
shutil.rmtree(
83+
DEP_CLONE_DIR
84+
) # Use shutil.rmtree since dir could be non-empty.
85+
except OSError as clone_dir_error:
86+
print(
87+
'Error cleaning up clone directory: %s : %s' %
88+
(DEP_CLONE_DIR, clone_dir_error.strerror)
89+
)
90+
91+
osv_result = {
92+
'packageSource': {'path': deps_file, 'type': 'lockfile'},
93+
'packages': filtered_osv_deps
94+
}
95+
return osv_result
96+
97+
98+
def parse_args(args):
99+
args = args[1:]
100+
parser = argparse.ArgumentParser(
101+
description='A script to find common ancestor commit SHAs'
102+
)
103+
104+
parser.add_argument(
105+
'--deps',
106+
'-d',
107+
type=str,
108+
help='Input DEPS file to extract.',
109+
default=os.path.join(CHECKOUT_ROOT, 'DEPS')
110+
)
111+
parser.add_argument(
112+
'--output',
113+
'-o',
114+
type=str,
115+
help='Output osv-scanner compatible deps file.',
116+
default=os.path.join(CHECKOUT_ROOT, 'osv-lockfile.json')
117+
)
118+
119+
return parser.parse_args(args)
120+
121+
122+
def write_manifest(deps, manifest_file):
123+
output = {'results': [deps]}
124+
print(json.dumps(output, indent=2))
125+
with open(manifest_file, 'w') as manifest:
126+
json.dump(output, manifest, indent=2)
127+
128+
129+
def main(argv):
130+
args = parse_args(argv)
131+
deps = extract_deps(args.deps)
132+
write_manifest(deps, args.output)
133+
return 0
134+
135+
136+
if __name__ == '__main__':
137+
sys.exit(main(sys.argv))

.github/workflows/scorecards-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: "Checkout code"
26-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
26+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
2727
with:
2828
persist-credentials: false
2929

@@ -43,7 +43,7 @@ jobs:
4343

4444
# Upload the results as artifacts (optional).
4545
- name: "Upload artifact"
46-
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
46+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
4747
with:
4848
name: SARIF file
4949
path: results.sarif
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Third party deps scan
2+
on:
3+
# Only the default branch is supported.
4+
branch_protection_rule:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
types: [ labeled ]
9+
10+
# Declare default permissions as read only.
11+
permissions: read-all
12+
13+
jobs:
14+
extract-deps:
15+
name: Extract Dependencies
16+
runs-on: ubuntu-20.04
17+
if: ${{ (github.repository == 'dart-lang/sdk' && github.event_name == 'push') || github.event.label.name == 'vulnerability scan' }}
18+
permissions:
19+
# Needed to upload the SARIF results to code-scanning dashboard.
20+
security-events: write
21+
contents: read
22+
steps:
23+
- name: "Checkout code"
24+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
25+
with:
26+
persist-credentials: false
27+
- name: "setup python"
28+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
29+
with:
30+
python-version: '3.7.7' # install the python version needed
31+
- name: "extract deps, find commit hash, pass to osv-scanner"
32+
run: python .github/extract_deps.py --output osv-lockfile-${{github.sha}}.json
33+
- name: "upload osv-scanner deps"
34+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
35+
with:
36+
# use github.ref in name to avoid duplicated artifacts
37+
name: osv-lockfile-${{github.sha}}
38+
path: osv-lockfile-${{github.sha}}.json
39+
retention-days: 2
40+
vuln-scan:
41+
name: Vulnerability scanning
42+
needs:
43+
extract-deps
44+
uses: "google/osv-scanner/.github/workflows/osv-scanner-reusable.yml@main"
45+
with:
46+
# Download the artifact uploaded in extract-deps step
47+
download-artifact: osv-lockfile-${{github.sha}}
48+
scan-args: |-
49+
--lockfile=osv-scanner:osv-lockfile-${{github.sha}}.json
50+
fail-on-vuln: false
51+
# makes sure the osv-formatted vulns are uploaded
52+
permissions:
53+
# Needed to upload the SARIF results to code-scanning dashboard.
54+
security-events: write
55+
contents: read

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,4 @@ tools/xcodebuild
111111
logs/logs.json
112112
logs/results.json
113113
.dart_tool/bisect_dart/
114+
doc/api/

BUILD.gn

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ group("runtime") {
4242

4343
deps = [
4444
"runtime/bin:dart",
45-
"runtime/bin:entrypoints_verification_test",
4645
"runtime/bin:ffi_test_dynamic_library",
4746
"runtime/bin:ffi_test_functions",
4847
"runtime/bin:process_test",
@@ -52,6 +51,10 @@ group("runtime") {
5251
"utils/dartdev:dartdev",
5352
"utils/kernel-service:kernel-service",
5453
]
54+
if (!is_win) {
55+
# The test isn't run on windows
56+
deps += [ "runtime/bin:entrypoints_verification_test" ]
57+
}
5558

5659
# This flag is set in runtime/runtime_args.gni
5760
# The analyze_snapshot tool is only supported on 64 bit AOT builds running
@@ -188,15 +191,14 @@ if (is_fuchsia) {
188191
]
189192
resource_files = [
190193
".dart_tool/package_config.json",
191-
"pkg/testing/test/hello_test.dart",
192194
"tools/addlatexhash.dart",
193195
]
194196
resource_dirs = [
195197
"pkg/async_helper",
196198
"pkg/expect",
197199
"pkg/meta",
198200
"tests/ffi",
199-
"third_party/pkg/ffi",
201+
"third_party/pkg/native/pkgs/ffi",
200202
"third_party/pkg/path",
201203
]
202204
resources = []

0 commit comments

Comments
 (0)