Skip to content

Commit 041d42b

Browse files
authored
Merge branch 'master' into security-scan-pr
2 parents fca3d63 + 56a127d commit 041d42b

File tree

8 files changed

+42
-14
lines changed

8 files changed

+42
-14
lines changed

.github/workflows/IntegrationTesting.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: python setup.py sdist
2727

2828
- name: Upload SDK build artifact
29-
uses: actions/upload-artifact@v3
29+
uses: actions/upload-artifact@v4
3030
with:
3131
name: sdk-build-artifact
3232
path: .
@@ -45,7 +45,7 @@ jobs:
4545
python-version: '3.8'
4646

4747
- name: Download X-Ray SDK build artifact
48-
uses: actions/download-artifact@v3
48+
uses: actions/download-artifact@v4
4949
with:
5050
name: sdk-build-artifact
5151
path: ./sample-apps/flask
@@ -59,7 +59,7 @@ jobs:
5959
working-directory: ./sample-apps/flask
6060

6161
- name: Upload WebApp with X-Ray SDK build artifact
62-
uses: actions/upload-artifact@v3
62+
uses: actions/upload-artifact@v4
6363
with:
6464
name: sdk-flask-build-artifact
6565
path: ./sample-apps/flask/deploy.zip
@@ -74,7 +74,7 @@ jobs:
7474
uses: actions/checkout@v3
7575

7676
- name: Download WebApp with X-Ray SDK build artifact
77-
uses: actions/download-artifact@v3
77+
uses: actions/download-artifact@v4
7878
with:
7979
name: sdk-flask-build-artifact
8080

@@ -112,7 +112,7 @@ jobs:
112112
working-directory: ./terraform
113113

114114
- name: Upload terraform state files for destorying resources
115-
uses: actions/upload-artifact@v3
115+
uses: actions/upload-artifact@v4
116116
with:
117117
name: terraform-state-artifact
118118
path: ./terraform
@@ -151,15 +151,14 @@ jobs:
151151

152152
steps:
153153
- name: Download terraform state artifact
154-
uses: actions/download-artifact@v3
154+
uses: actions/download-artifact@v4
155155
with:
156156
name: terraform-state-artifact
157157

158158
- name: Configure AWS Credentials
159-
uses: aws-actions/configure-aws-credentials@v1
159+
uses: aws-actions/configure-aws-credentials@v4
160160
with:
161-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
162-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
161+
role-to-assume: ${{ secrets.AWS_INTEG_TEST_ROLE_ARN }}
163162
aws-region: us-west-2
164163

165164
- name: Setup Terraform

.github/workflows/Release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99

1010
jobs:
1111
release:
12+
permissions:
13+
contents: write
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Checkout master branch

.github/workflows/UnitTesting.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Unit Testing
2+
permissions:
3+
contents: read
24
on:
35
push:
46
branches:

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ CHANGELOG
55
Unreleased
66
==========
77

8+
2.15.0
9+
==========
10+
* bugfix: Fix log stack overflow if metadata contains circular reference `https://github.com/aws/aws-xray-sdk-python/pull/464`
11+
812
2.14.0
913
==========
1014
* bugfix: Fix warning message condition for subsegment ending `https://github.com/aws/aws-xray-sdk-python/pull/434`

aws_xray_sdk/core/utils/conversion.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def metadata_to_dict(obj):
3030
return metadata
3131
else:
3232
return obj
33-
except Exception:
34-
log.exception("Failed to convert metadata to dict")
33+
except Exception as e:
34+
import pprint
35+
log.warning("Failed to convert metadata to dict:\n%s", pprint.pformat(getattr(e, "args", None)))
3536
return {}

aws_xray_sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.14.0'
1+
VERSION = '2.15.0'

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
# built documents.
6363
#
6464
# The short X.Y version.
65-
version = u'2.14.0'
65+
version = u'2.15.0'
6666
# The full version, including alpha/beta/rc tags.
67-
release = u'2.14.0'
67+
release = u'2.15.0'
6868

6969
# The language for content autogenerated by Sphinx. Refer to documentation
7070
# for a list of supported languages.

tests/util.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
from aws_xray_sdk.core.recorder import AWSXRayRecorder
55
from aws_xray_sdk.core.emitters.udp_emitter import UDPEmitter
66
from aws_xray_sdk.core.sampling.sampler import DefaultSampler
7+
from aws_xray_sdk.core.utils.conversion import metadata_to_dict
8+
9+
10+
class CircularReferenceClass:
11+
"""Test class that can create circular references"""
12+
def __init__(self, name):
13+
self.name = name
14+
self.ref = None
715

816

917
class StubbedEmitter(UDPEmitter):
@@ -99,3 +107,15 @@ def _search_entity_by_annotation(entity, key, value):
99107
if result is not None:
100108
return result
101109
return None
110+
111+
112+
def test_metadata_to_dict_self_reference():
113+
"""Test that self-referencing objects don't cause stack overflow"""
114+
obj = CircularReferenceClass("self_ref")
115+
obj.ref = obj # Self reference
116+
117+
# This should not cause stack overflow
118+
result = metadata_to_dict(obj)
119+
120+
# The function should handle the self reference gracefully
121+
assert isinstance(result, dict)

0 commit comments

Comments
 (0)