Kitxuuu commited on
Commit
5d08f08
·
verified ·
1 Parent(s): 4103187

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. local-test-tika-delta-04/afc-tika/tika-parsers/tika-parsers-extended/tika-parsers-extended-integration-tests/pom.xml +79 -0
  2. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/jcc/testdata/.gitignore +2 -0
  3. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/README.md +3 -0
  4. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/__init__.py +20 -0
  5. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/redos.py +84 -0
  6. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/eval_command_injection.py +52 -0
  7. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/build.sh +25 -0
  8. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/fuzz_ldap.py +42 -0
  9. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/build.sh +22 -0
  10. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.dict +1 -0
  11. local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/yaml_deserialization_general.py +47 -0
  12. local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/get_coverage.py +208 -0
  13. local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/platform_config/github_test.py +87 -0
  14. local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/Dockerfile +35 -0
  15. local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/build.sh +25 -0
  16. local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py +65 -0
  17. local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/vuln.dict +1 -0
  18. local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/cloudbuild.yaml +58 -0
  19. local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/e2e-replay-build.sh +63 -0
  20. local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/prepare-ccache +22 -0
local-test-tika-delta-04/afc-tika/tika-parsers/tika-parsers-extended/tika-parsers-extended-integration-tests/pom.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one
4
+ or more contributor license agreements. See the NOTICE file
5
+ distributed with this work for additional information
6
+ regarding copyright ownership. The ASF licenses this file
7
+ to you under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance
9
+ with the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing,
14
+ software distributed under the License is distributed on an
15
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations
18
+ under the License.
19
+ -->
20
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
21
+ <parent>
22
+ <artifactId>tika-parsers-extended</artifactId>
23
+ <groupId>org.apache.tika</groupId>
24
+ <version>4.0.0-SNAPSHOT</version>
25
+ </parent>
26
+ <modelVersion>4.0.0</modelVersion>
27
+
28
+ <artifactId>tika-parsers-extended-integration-tests</artifactId>
29
+ <name>Apache Tika extended parser integration tests</name>
30
+
31
+ <dependencies>
32
+ <dependency>
33
+ <groupId>${project.groupId}</groupId>
34
+ <artifactId>tika-parsers-standard-package</artifactId>
35
+ <version>${project.version}</version>
36
+ <scope>test</scope>
37
+ </dependency>
38
+ <dependency>
39
+ <groupId>${project.groupId}</groupId>
40
+ <artifactId>tika-parser-scientific-module</artifactId>
41
+ <version>${project.version}</version>
42
+ <scope>test</scope>
43
+ </dependency>
44
+ <dependency>
45
+ <groupId>${project.groupId}</groupId>
46
+ <artifactId>tika-parser-sqlite3-package</artifactId>
47
+ <version>${project.version}</version>
48
+ <scope>test</scope>
49
+ </dependency>
50
+ <dependency>
51
+ <groupId>${project.groupId}</groupId>
52
+ <artifactId>tika-parser-sqlite3-module</artifactId>
53
+ <version>${project.version}</version>
54
+ <scope>test</scope>
55
+ <type>test-jar</type>
56
+ </dependency>
57
+ <dependency>
58
+ <groupId>${project.groupId}</groupId>
59
+ <artifactId>tika-parser-scientific-module</artifactId>
60
+ <version>${project.version}</version>
61
+ <scope>test</scope>
62
+ <type>test-jar</type>
63
+ </dependency>
64
+ <dependency>
65
+ <groupId>org.apache.logging.log4j</groupId>
66
+ <artifactId>log4j-core</artifactId>
67
+ <scope>test</scope>
68
+ </dependency>
69
+ <dependency>
70
+ <groupId>org.apache.logging.log4j</groupId>
71
+ <artifactId>log4j-slf4j2-impl</artifactId>
72
+ <scope>test</scope>
73
+ </dependency>
74
+ </dependencies>
75
+
76
+ <scm>
77
+ <tag>3.0.0-rc1</tag>
78
+ </scm>
79
+ </project>
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/jcc/testdata/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ jcc-corrected-cfile.c
2
+ jcc-corrected-cfile.cpp
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # pysecsan
2
+
3
+ Security sanitizers for vulnerability detection during runtime.
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/__init__.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Glue for pysecsan library."""
15
+
16
+ # Import sanlib and expose only needs functionality by way of __all__
17
+ from .sanlib import *
18
+
19
+ # pylint: disable=undefined-all-variable
20
+ __all__ = ['add_hooks']
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/redos.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+ """Sanitizer for regular expression dos."""
17
+
18
+ # pylint: disable=protected-access
19
+
20
+ import time
21
+ import os
22
+ from pysecsan import sanlib
23
+
24
+ START_RE_TIME = None
25
+
26
+
27
+ # Hooks for regular expressions.
28
+ # Main problem is to identify ReDOS attemps. This is a non-trivial task
29
+ # - https://arxiv.org/pdf/1701.04045.pdf
30
+ # - https://dl.acm.org/doi/pdf/10.1145/3236024.3236027
31
+ # and the current approach we use is simply check for extensive computing time.
32
+ # In essence, this is more of a refinement of traditional timeout checker from
33
+ # the fuzzer, which, effectively will detect these types of attacks by way of
34
+ # timeouts.
35
+ #
36
+ # Perhaps the smartest would be to use something like e.g.
37
+ # https://github.com/doyensec/regexploit to scan the regex patterns.
38
+ # Other heuristics without going too technical on identifying super-linear
39
+ # regexes:
40
+ # - check
41
+ # - if 'taint' exists in re.compile(xx)
42
+ # - check
43
+ # - for backtracking possbility in PATTERN within re.comile(PATTERN)
44
+ # - and
45
+ # - 'taint' in findall(XX) calls.
46
+ # pylint: disable=global-statement
47
+ def hook_post_exec_re_pattern_findall(self, re_str):
48
+ """Hook post exeution re.compile().findall()."""
49
+ _ = self # Satisfy lint
50
+ global START_RE_TIME
51
+ try:
52
+ endtime = time.time() - START_RE_TIME
53
+ if endtime > 4:
54
+ sanlib.abort_with_issue(f'Potential ReDOS attack.\n {re_str}', 'ReDOS')
55
+ except NameError:
56
+ sanlib.sanitizer_log(
57
+ 'starttime is not set, which it should have. Error in PySecSan',
58
+ sanlib.LOG_INFO)
59
+ os._exit(1)
60
+
61
+
62
+ def hook_pre_exec_re_pattern_findall(self, string):
63
+ """Hook pre execution of re.pattern().findall()."""
64
+ _ = (self, string) # Satisfy lint
65
+ global START_RE_TIME
66
+ START_RE_TIME = time.time()
67
+
68
+
69
+ def hook_post_exec_re_compile(retval, pattern, flags=None):
70
+ """Hook for re.compile post execution to hook returned objects functions."""
71
+ _ = (pattern, flags) # Satisfy lint
72
+ sanlib.sanitizer_log('Inside of post compile hook', sanlib.LOG_DEBUG)
73
+ wrapper_object = sanlib.create_object_wrapper(
74
+ findall=(hook_pre_exec_re_pattern_findall,
75
+ hook_post_exec_re_pattern_findall))
76
+ hooked_object = wrapper_object(retval)
77
+ return hooked_object
78
+
79
+
80
+ def hook_pre_exec_re_compile(pattern, flags=None):
81
+ """Check if tainted input exists in pattern. If so, likely chance of making
82
+ ReDOS possible."""
83
+ _ = (pattern, flags) # Satisfy lint
84
+ sanlib.sanitizer_log('Inside re compile hook', sanlib.LOG_DEBUG)
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/eval_command_injection.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Fuzzer targetting command injection of eval."""
16
+ # pylint: disable=eval-used
17
+
18
+ import sys
19
+ import atheris
20
+ import pysecsan
21
+
22
+ pysecsan.add_hooks()
23
+
24
+
25
+ def list_files_perhaps(param, magicval):
26
+ """Pass fuzzer data into eval."""
27
+ if len(param) < 3:
28
+ return
29
+ if magicval == 1337:
30
+ try:
31
+ eval("FROMFUZZ")
32
+ except ValueError:
33
+ pass
34
+
35
+
36
+ def test_one_input(data):
37
+ """Fuzzer entrypoint."""
38
+ fdp = atheris.FuzzedDataProvider(data)
39
+ list_files_perhaps(fdp.ConsumeUnicodeNoSurrogates(24),
40
+ fdp.ConsumeIntInRange(500, 1500))
41
+
42
+
43
+ def main():
44
+ """Set up and start fuzzing."""
45
+
46
+ atheris.instrument_all()
47
+ atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
48
+ atheris.Fuzz()
49
+
50
+
51
+ if __name__ == '__main__':
52
+ main()
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/build.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eu
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ python3 -m pip install pysecsan
19
+
20
+ git clone https://github.com/python-ldap/python-ldap
21
+ cd python-ldap
22
+ git checkout 404c36b702c5b3a7e60729745c8bda16098b1472
23
+ python3 -m pip install .
24
+ cd ../
25
+ python3 ./fuzz_ldap.py
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/fuzz_ldap.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Targets: https://github.com/python-ldap/python-ldap/security/advisories/GHSA-r8wq-qrxc-hmcm""" # pylint: disable=line-too-long
16
+
17
+ import sys
18
+ import atheris
19
+ import pysecsan
20
+ import ldap.schema
21
+
22
+ pysecsan.add_hooks()
23
+
24
+
25
+ def test_one_input(data):
26
+ """Fuzzer targetting regex dos in ldap."""
27
+ fdp = atheris.FuzzedDataProvider(data)
28
+ try:
29
+ ldap.schema.split_tokens(fdp.ConsumeUnicodeNoSurrogates(1024))
30
+ except ValueError:
31
+ pass
32
+
33
+
34
+ def main():
35
+ """Set up and start fuzzing."""
36
+ atheris.instrument_all()
37
+ atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
38
+ atheris.Fuzz()
39
+
40
+
41
+ if __name__ == '__main__':
42
+ main()
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/build.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eu
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ git clone --depth 1 --branch 1.5.10 https://github.com/PyTorchLightning/pytorch-lightning.git
19
+ cd pytorch-lightning
20
+ python3 -m pip install .
21
+ cd ../
22
+ python3 ./fuzz_pytorch_lightning.py
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.dict ADDED
@@ -0,0 +1 @@
 
 
1
+ "os.system('exec-sanitizer')"
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/yaml_deserialization_general.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Fuzzer for insecure yaml deserialization."""
16
+
17
+ import sys
18
+ import yaml
19
+ import atheris
20
+ import pysecsan
21
+
22
+
23
+ def serialize_with_tainted_data(param):
24
+ """Hit insecure yaml function."""
25
+ try:
26
+ yaml.load(param, yaml.Loader)
27
+ except yaml.YAMLError:
28
+ pass
29
+
30
+
31
+ def test_one_input(data):
32
+ """Fuzzer routine."""
33
+ fdp = atheris.FuzzedDataProvider(data)
34
+ serialize_with_tainted_data(fdp.ConsumeUnicodeNoSurrogates(32))
35
+
36
+
37
+ def main():
38
+ """Set up and start fuzzing."""
39
+ pysecsan.add_hooks()
40
+
41
+ atheris.instrument_all()
42
+ atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
43
+ atheris.Fuzz()
44
+
45
+
46
+ if __name__ == '__main__':
47
+ main()
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/get_coverage.py ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Module for determining coverage of fuzz targets."""
15
+ import json
16
+ import logging
17
+ import os
18
+ import sys
19
+
20
+ import http_utils
21
+
22
+ # pylint: disable=wrong-import-position,import-error
23
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
24
+ import utils
25
+
26
+ # The path to get OSS-Fuzz project's latest report json file.`
27
+ OSS_FUZZ_LATEST_COVERAGE_INFO_PATH = 'oss-fuzz-coverage/latest_report_info/'
28
+
29
+
30
+ # pylint: disable=too-few-public-methods
31
+ class CoverageError(Exception):
32
+ """Exceptions for project coverage."""
33
+
34
+
35
+ class BaseCoverage:
36
+ """Gets coverage data for a project."""
37
+
38
+ def __init__(self, repo_path):
39
+ self.repo_path = _normalize_repo_path(repo_path)
40
+
41
+ def get_files_covered_by_target(self, target):
42
+ """Returns a list of source files covered by the specific fuzz target.
43
+
44
+ Args:
45
+ target: The name of the fuzz target whose coverage is requested.
46
+
47
+ Returns:
48
+ A list of files that the fuzz target covers or None.
49
+ """
50
+ target_cov = self.get_target_coverage(target)
51
+ if not target_cov:
52
+ logging.info('No coverage available for %s.', target)
53
+ return None
54
+
55
+ coverage_per_file = get_coverage_per_file(target_cov)
56
+ if not coverage_per_file:
57
+ logging.info('No files found in coverage report.')
58
+ return None
59
+
60
+ affected_file_list = []
61
+ for file_cov in coverage_per_file:
62
+ norm_file_path = os.path.normpath(file_cov['filename'])
63
+ if not norm_file_path.startswith(self.repo_path):
64
+ # Exclude files outside of the main repo.
65
+ continue
66
+
67
+ if not is_file_covered(file_cov):
68
+ # Don't consider a file affected if code in it is never executed.
69
+ continue
70
+
71
+ # TODO(metzman): It's weird to me that we access file_cov['filename']
72
+ # again and not norm_file_path, figure out if this makes sense.
73
+ relative_path = utils.remove_prefix(file_cov['filename'], self.repo_path)
74
+ affected_file_list.append(relative_path)
75
+
76
+ return affected_file_list
77
+
78
+ def get_target_coverage(self, target):
79
+ """Get the coverage report for a specific fuzz target.
80
+
81
+ Args:
82
+ target: The name of the fuzz target whose coverage is requested.
83
+
84
+ Returns:
85
+ The target's coverage json dict or None on failure.
86
+ """
87
+ raise NotImplementedError('Child class must implement method.')
88
+
89
+
90
+ class OSSFuzzCoverage(BaseCoverage):
91
+ """Gets coverage data for a project from OSS-Fuzz."""
92
+
93
+ def __init__(self, repo_path, oss_fuzz_project_name):
94
+ """Constructor for OSSFuzzCoverage."""
95
+ super().__init__(repo_path)
96
+ self.oss_fuzz_project_name = oss_fuzz_project_name
97
+ self.fuzzer_stats_url = _get_oss_fuzz_fuzzer_stats_dir_url(
98
+ self.oss_fuzz_project_name)
99
+ if self.fuzzer_stats_url is None:
100
+ raise CoverageError('Could not get latest coverage.')
101
+
102
+ def get_target_coverage(self, target):
103
+ """Get the coverage report for a specific fuzz target.
104
+
105
+ Args:
106
+ target: The name of the fuzz target whose coverage is requested.
107
+
108
+ Returns:
109
+ The target's coverage json dict or None on failure.
110
+ """
111
+ if not self.fuzzer_stats_url:
112
+ return None
113
+
114
+ target_url = utils.url_join(self.fuzzer_stats_url, target + '.json')
115
+ return http_utils.get_json_from_url(target_url)
116
+
117
+
118
+ def _get_oss_fuzz_latest_cov_report_info(oss_fuzz_project_name):
119
+ """Gets and returns a dictionary containing the latest coverage report info
120
+ for |project|."""
121
+ latest_report_info_url = utils.url_join(utils.GCS_BASE_URL,
122
+ OSS_FUZZ_LATEST_COVERAGE_INFO_PATH,
123
+ oss_fuzz_project_name + '.json')
124
+ latest_cov_info = http_utils.get_json_from_url(latest_report_info_url)
125
+ if latest_cov_info is None:
126
+ logging.error('Could not get the coverage report json from url: %s.',
127
+ latest_report_info_url)
128
+ return None
129
+ return latest_cov_info
130
+
131
+
132
+ def _get_oss_fuzz_fuzzer_stats_dir_url(oss_fuzz_project_name):
133
+ """Gets latest coverage report info for a specific OSS-Fuzz project from
134
+ GCS.
135
+
136
+ Args:
137
+ oss_fuzz_project_name: The name of the project.
138
+
139
+ Returns:
140
+ The projects coverage report info in json dict or None on failure.
141
+ """
142
+ latest_cov_info = _get_oss_fuzz_latest_cov_report_info(oss_fuzz_project_name)
143
+
144
+ if not latest_cov_info:
145
+ return None
146
+
147
+ if 'fuzzer_stats_dir' not in latest_cov_info:
148
+ logging.error('fuzzer_stats_dir not in latest coverage info.')
149
+ return None
150
+
151
+ fuzzer_stats_dir_gs_url = latest_cov_info['fuzzer_stats_dir']
152
+ fuzzer_stats_dir_url = utils.gs_url_to_https(fuzzer_stats_dir_gs_url)
153
+ return fuzzer_stats_dir_url
154
+
155
+
156
+ class FilesystemCoverage(BaseCoverage):
157
+ """Class that gets a project's coverage from the filesystem."""
158
+
159
+ def __init__(self, repo_path, project_coverage_dir):
160
+ super().__init__(repo_path)
161
+ self.project_coverage_dir = project_coverage_dir
162
+
163
+ def get_target_coverage(self, target):
164
+ """Get the coverage report for a specific fuzz target.
165
+
166
+ Args:
167
+ target: The name of the fuzz target whose coverage is requested.
168
+
169
+ Returns:
170
+ The target's coverage json dict or None on failure.
171
+ """
172
+ logging.info('Getting coverage for %s from filesystem.', target)
173
+ fuzzer_stats_json_path = os.path.join(self.project_coverage_dir,
174
+ 'fuzzer_stats', target + '.json')
175
+ if not os.path.exists(fuzzer_stats_json_path):
176
+ logging.warning('%s does not exist.', fuzzer_stats_json_path)
177
+ return None
178
+
179
+ with open(fuzzer_stats_json_path) as fuzzer_stats_json_file_handle:
180
+ try:
181
+ return json.load(fuzzer_stats_json_file_handle)
182
+ except json.decoder.JSONDecodeError as err:
183
+ logging.error('Could not decode: %s. Error: %s.',
184
+ fuzzer_stats_json_path, err)
185
+ return None
186
+
187
+
188
+ def is_file_covered(file_cov):
189
+ """Returns whether the file is covered."""
190
+ return file_cov['summary']['regions']['covered']
191
+
192
+
193
+ def get_coverage_per_file(target_cov):
194
+ """Returns the coverage per file within |target_cov|."""
195
+ try:
196
+ return target_cov['data'][0]['files']
197
+ except (IndexError, TypeError, KeyError):
198
+ logging.error('target_cov: %s is malformed.', target_cov)
199
+ return None
200
+
201
+
202
+ def _normalize_repo_path(repo_path):
203
+ """Normalizes and returns |repo_path| to make sure cases like /src/curl and
204
+ /src/curl/ are both handled."""
205
+ repo_path = os.path.normpath(repo_path)
206
+ if not repo_path.endswith('/'):
207
+ repo_path += '/'
208
+ return repo_path
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/platform_config/github_test.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Tests for platform_config.github."""
15
+ import os
16
+ import unittest
17
+ from unittest import mock
18
+
19
+ import platform_config.github
20
+ import test_helpers
21
+
22
+ # pylint: disable=arguments-differ
23
+
24
+
25
+ class GetProjectRepoOwnerAndNameTest(unittest.TestCase):
26
+ """Tests for get_project_repo_owner and get_project_repo_name."""
27
+
28
+ @mock.patch('platform_config.github._get_event_data', return_value={})
29
+ def setUp(self, _):
30
+ test_helpers.patch_environ(self)
31
+ self.repo_owner = 'repo-owner'
32
+ self.repo_name = 'repo-name'
33
+ os.environ['GITHUB_REPOSITORY'] = f'{self.repo_owner}/{self.repo_name}'
34
+ self.platform_conf = platform_config.github.PlatformConfig()
35
+
36
+ def test_github_repository_owner(self):
37
+ """Tests that the correct result is returned when repository contains the
38
+ owner and repo name (as it does on GitHub)."""
39
+ self.assertEqual(self.platform_conf.project_repo_owner, self.repo_owner)
40
+
41
+ def test_github_repository_name(self):
42
+ """Tests that the correct result is returned when repository contains the
43
+ owner and repo name (as it does on GitHub)."""
44
+ os.environ['GITHUB_REPOSITORY'] = f'{self.repo_owner}/{self.repo_name}'
45
+ self.assertEqual(self.platform_conf.project_repo_name, self.repo_name)
46
+
47
+
48
+ class ProjectSrcPathTest(unittest.TestCase):
49
+ """Tests for project_src_path."""
50
+
51
+ def setUp(self):
52
+ test_helpers.patch_environ(self)
53
+ self.workspace = '/workspace'
54
+ os.environ['GITHUB_WORKSPACE'] = self.workspace
55
+ self.project_src_dir_name = 'project-src'
56
+
57
+ @mock.patch('platform_config.github._get_event_data', return_value={})
58
+ def test_github_unset(self, _):
59
+ """Tests that project_src_path returns None when no PROJECT_SRC_PATH is
60
+ set."""
61
+ github_env = platform_config.github.PlatformConfig()
62
+ self.assertIsNone(github_env.project_src_path)
63
+
64
+ @mock.patch('platform_config.github._get_event_data', return_value={})
65
+ def test_github(self, _):
66
+ """Tests that project_src_path returns the correct result on GitHub."""
67
+ os.environ['PROJECT_SRC_PATH'] = self.project_src_dir_name
68
+ expected_project_src_path = os.path.join(self.workspace,
69
+ self.project_src_dir_name)
70
+ github_env = platform_config.github.PlatformConfig()
71
+ self.assertEqual(github_env.project_src_path, expected_project_src_path)
72
+
73
+
74
+ class GetGitUrlTest(unittest.TestCase):
75
+ """Tests for GenericPlatformConfig.git_url."""
76
+
77
+ @mock.patch('platform_config.github._get_event_data', return_value={})
78
+ def setUp(self, _):
79
+ test_helpers.patch_environ(self)
80
+ self.platform_conf = platform_config.github.PlatformConfig()
81
+
82
+ def test_repository(self):
83
+ """Tests that the correct result is returned when repository contains the
84
+ owner and repo name (as it does on GitHub)."""
85
+ os.environ['GITHUB_REPOSITORY'] = 'repo/owner'
86
+ self.assertEqual('https://github.com/repo/owner',
87
+ self.platform_conf.git_url)
local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/node-shell-quote-v1.7.3/Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # Build and run the proof of error in shell-quote v1.7.3.
16
+
17
+ FROM ghcr.io/aixcc-finals/base-builder
18
+
19
+ RUN apt update && \
20
+ apt install -y \
21
+ vim \
22
+ npm && \
23
+ git clone \
24
+ --depth 1 \
25
+ https://github.com/substack/node-shell-quote.git && \
26
+ npm config set @gitlab-org:registry \
27
+ https://gitlab.com/api/v4/packages/npm/
28
+
29
+ COPY ./build.sh $SRC
30
+ RUN ./build.sh
31
+
32
+ COPY . $SRC
33
+ RUN make SystemSan
34
+
35
+ CMD ["make", "run"]
local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/build.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eu
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ # Build and install project (using current CFLAGS, CXXFLAGS).
19
+ cd pytorch-lightning
20
+ pip3 install .
21
+
22
+ # Build fuzzers in $OUT.
23
+ for fuzzer in $(find $SRC -name '*_fuzzer.py'); do
24
+ compile_python_fuzzer $fuzzer
25
+ done
local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/local/bin/python3
2
+ #
3
+ # Copyright 2022 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ ################################################################################
18
+ """Exploit pytorch lightning with fuzzer's input as a random env variable.
19
+
20
+ This PoC is extended from a report in GitHub Advisory Database:
21
+ https://github.com/advisories/GHSA-r5qj-cvf9-p85h
22
+ The original report documents an exploit using a specific environment variable,
23
+ we show a way to achieve the same exploit with an arbitrary env variable.
24
+ """
25
+
26
+ import os
27
+ import sys
28
+ import atheris
29
+
30
+ with atheris.instrument_imports():
31
+ from pytorch_lightning import Trainer
32
+ from pytorch_lightning.utilities.argparse import parse_env_variables
33
+
34
+
35
+ def prepare_fuzzing_input(data):
36
+ """Prepare the data needed by the exploit with input data from fuzzers."""
37
+ data = data.replace(b'\0', b'')
38
+ env_name = 'AN_ARBITRARY_ENV_NAME'
39
+ return data, env_name
40
+
41
+
42
+ def exploit_target(env_value, env_name):
43
+ """This target is based on a snippet from the official documentation of
44
+ `parse_env_variables`:
45
+ https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.utilities.argparse.html # pylint: disable=line-too-long
46
+ It might not be the most realistic example,
47
+ but serves as a PoC to show that SystemSan works for Python."""
48
+ os.environb[env_name.encode()] = env_value
49
+ parse_env_variables(Trainer, template=env_name)
50
+
51
+
52
+ def TestOneInput(data): # pylint: disable=invalid-name
53
+ """Exploit the target only with input data from fuzzers."""
54
+ env_value, env_name = prepare_fuzzing_input(data)
55
+ exploit_target(env_value, env_name)
56
+
57
+
58
+ def main():
59
+ """Fuzz target with atheris."""
60
+ atheris.Setup(sys.argv, TestOneInput)
61
+ atheris.Fuzz()
62
+
63
+
64
+ if __name__ == '__main__':
65
+ main()
local-test-tika-delta-04/fuzz-tooling/infra/experimental/SystemSan/PoEs/pytorch-lightning-1.5.10/vuln.dict ADDED
@@ -0,0 +1 @@
 
 
1
+ "os.system('/tmp/tripwire')"
local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/cloudbuild.yaml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ ################################################################################
16
+ # CloudBuild for generating Chronos-cached images.
17
+ # Supports building by way of ccache now.
18
+ # High-level steps:
19
+ # 1) Build image for project
20
+ # 2) Run an ASAN build and store ccache
21
+ # 3) Copy ccache cache to host and copy into project's OSS-Fuzz folder
22
+ # 4) Build image for project and copy ccache in, storing image as *-ofg-cache-address
23
+ # 5) Run an coverage build and store ccache
24
+ # 6) Copy ccache cache to host and copy into project's OSS-Fuzz folder
25
+ # 7) Build image for project and copy ccache in, storing image as *-ofg-cache-coverage
26
+ # TODO (David): add support for use of dedicated replay_build.sh
27
+ steps:
28
+ - name: 'gcr.io/cloud-builders/docker'
29
+ entrypoint: /bin/bash
30
+ args:
31
+ - /workspace/infra/experimental/chronos/build_cache_local.sh
32
+ - ${_PROJECT}
33
+ - ${_FUZZING_LANGUAGE}
34
+ - address
35
+ env:
36
+ - RUN_ALL=1
37
+ - name: 'gcr.io/cloud-builders/docker'
38
+ entrypoint: /bin/bash
39
+ args:
40
+ - /workspace/infra/experimental/chronos/build_cache_local.sh
41
+ - ${_PROJECT}
42
+ - ${_FUZZING_LANGUAGE}
43
+ - coverage
44
+ env:
45
+ - RUN_ALL=1
46
+ images:
47
+ - us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-cached-address
48
+ - us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-cached-coverage
49
+ - us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-ccache-address
50
+ - us-central1-docker.pkg.dev/oss-fuzz/oss-fuzz-gen/${_PROJECT}-ofg-ccache-coverage
51
+ timeout: 72000s # 20 hours, same as build_lib.py
52
+ logsBucket: oss-fuzz-gcb-logs
53
+ tags:
54
+ - ${_PROJECT}
55
+ - chronos
56
+ options:
57
+ pool:
58
+ name: projects/oss-fuzz/locations/us-central1/workerPools/buildpool-chronos
local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/e2e-replay-build.sh ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/bash
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ # Sample projects: simd, wt, libheif, htslib
19
+ PROJECT=liblouis
20
+ LOG=replay-${PROJECT}.txt
21
+ OUT1=replay-out-${PROJECT}-1
22
+ OUT2=replay-out-${PROJECT}-2
23
+ python infra/helper.py build_image --no-pull "$PROJECT"
24
+
25
+ # AddressSanitizer.
26
+ mkdir -p build/out/${PROJECT}
27
+ echo "start" >> ${LOG}
28
+ echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
29
+ # Remove container name we are about to use.
30
+ docker container rm "${PROJECT}-origin-asan"
31
+
32
+ # Build once, clean container if needed
33
+ docker run -v $PWD/build/out/${PROJECT}:/out \
34
+ -ti --entrypoint="/bin/sh" \
35
+ --env FUZZING_LANGUAGE=c --env SANITIZER="address" \
36
+ --name "${PROJECT}-origin-asan" \
37
+ "gcr.io/oss-fuzz/${PROJECT}" -c "compile"
38
+
39
+ # Copy outs and log data
40
+ cp -rf $PWD/build/out/${PROJECT} ${OUT1}
41
+ rm -rf $PWD/build/out/${PROJECT}
42
+ ls -la $PWD/build/out/ >> ${LOG}
43
+ echo "next" >> ${LOG}
44
+ echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
45
+ docker commit "${PROJECT}-origin-asan" "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan"
46
+
47
+ # Run the replay command
48
+ docker run -v $PWD/build/out/${PROJECT}:/out \
49
+ -e REPLAY_ENABLED=1 -ti --entrypoint="/bin/sh" \
50
+ --env FUZZING_LANGUAGE=c --env SANITIZER="address" \
51
+ "gcr.io/oss-fuzz/${PROJECT}-ofg-cached-asan" -c "compile"
52
+ echo "finish" >> ${LOG}
53
+ echo $(date +%Y:%m:%d:%H:%M:%S) >> ${LOG}
54
+ cp -rf $PWD/build/out/${PROJECT} ${OUT2}
55
+
56
+ # Now match the artifacts
57
+ SUCCESS=$(infra/experimental/chronos/match_artifacts $OUT1 $OUT2)
58
+
59
+ if [[ $SUCCESS -eq 0 ]]; then
60
+ echo "SUCCESS REPLAY" >> ${LOG}
61
+ else
62
+ echo "FAIL REPLAY" >> ${LOG}
63
+ fi
local-test-tika-delta-04/fuzz-tooling/infra/experimental/chronos/prepare-ccache ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/bash
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+
18
+ PROJECT=$1
19
+ {
20
+ echo "COPY ccache-cache/ /ccache/cache";
21
+ echo "ENV PATH=\"/ccache/bin:\$PATH\""
22
+ } >> "projects/$PROJECT/Dockerfile"