Skip to content

Commit 8c5b9d6

Browse files
Merge remote-tracking branch 'origin' into debt/GPCAPIM-359-sort-out-env-vars
2 parents d48aec9 + b14f14b commit 8c5b9d6

16 files changed

Lines changed: 184 additions & 334 deletions

File tree

.github/SECURITY.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ deploy: clean build # Build project artefact and deploy locally @Pipeline
6161
else \
6262
$(docker) run --platform linux/amd64 --name gateway-api -p 5000:8080 --env-file .env -d ${IMAGE_NAME} ; \
6363
fi
64+
@max_attempts=5 ; \
65+
attempt=1 ; \
66+
while [[ $$attempt -le $$max_attempts ]]; do \
67+
if $(docker) ps --filter "name=gateway-api" --filter "status=running" --format "{{.Names}}" | grep -q "^gateway-api$$"; then \
68+
exit 0 ; \
69+
fi ; \
70+
sleep $$((attempt * 2)) ; \
71+
attempt=$$((attempt + 1)) ; \
72+
done ; \
73+
echo "ERROR: gateway-api container failed to start. Logs:" ; \
74+
$(docker) logs gateway-api ; \
75+
exit 1
6476

6577
deploy-%: # Build project artefact and deploy locally as specified environment - mandatory: name=[name of the environment, e.g. 'dev'] @Pipeline
6678
make env-$* deploy

SECURITY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Security
2+
3+
We take security and the protection of private data extremely seriously. If you believe you have found a vulnerability or other issue which has compromised or could compromise the security of any of our systems or private data managed by our systems, please do not hesitate to contact us using the method outlined below.
4+
5+
## Table of Contents
6+
7+
- [Security](#security)
8+
- [Table of Contents](#table-of-contents)
9+
- [Reporting a vulnerability](#reporting-a-vulnerability)
10+
- [General Security Enquiries](#general-security-enquiries)
11+
12+
## Reporting a vulnerability
13+
14+
If you believe you have found a security issue in this repository, please report it using GitHub's private vulnerability reporting:
15+
16+
1. [Report a vulnerability](https://github.com/NHSDigital/clinical-data-gateway-api/security/advisories/new)
17+
2. Provide details of the issue and steps to reproduce
18+
19+
This creates a private channel for discussion and allows us to coordinate a fix before any public disclosure.
20+
21+
## General Security Enquiries
22+
23+
If you have general enquiries regarding our cybersecurity, please reach out to us at [cybersecurity@nhs.net](cybersecurity@nhs.net)

bruno/gateway-api/collections/APIM/User_Info.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ info:
55

66
http:
77
method: GET
8-
url: https://internal-dev.api.service.nhs.uk/oauth2-mock/userinfo
8+
url: https://{{host}}/oauth2-mock/userinfo
99
auth:
1010
type: bearer
11-
token: ""
11+
token: "{{token}}"
1212

1313
settings:
1414
encodeUrl: true
1515
timeout: 0
1616
followRedirects: true
1717
maxRedirects: 5
18+
19+
docs: Use the `token` environment variable to set the Authorization header. Do not enter it directly into the header. This ensures that the value is never saved into git.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: internal-dev
2+
variables:
3+
- name: host
4+
value: internal-dev.api.service.nhs.uk
5+
- secret: true
6+
name: token

gateway-api/src/fhir/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ class FHIRSystem(StrEnum):
1111
SDS_USER_ID = "https://fhir.nhs.uk/Id/sds-user-id"
1212
SDS_ROLE_PROFILE_ID = "https://fhir.nhs.uk/Id/sds-role-profile-id"
1313
NHS_SERVICE_INTERACTION_ID = "https://fhir.nhs.uk/Id/nhsServiceInteractionId"
14-
NHS_MHS_PARTY_KEY = "https://fhir.nhs.uk/Id/nhsMhsPartyKey"
1514
NHS_SPINE_ASID = "https://fhir.nhs.uk/Id/nhsSpineASID"

gateway-api/src/fhir/r4/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from .elements.identifier import (
55
ASIDIdentifier,
66
OrganizationIdentifier,
7-
PartyKeyIdentifier,
87
PatientIdentifier,
98
UUIDIdentifier,
109
)
@@ -25,7 +24,6 @@
2524
"GeneralPractitioner",
2625
"OrganizationIdentifier",
2726
"Organization",
28-
"PartyKeyIdentifier",
2927
"Patient",
3028
"PatientIdentifier",
3129
"Practitioner",

gateway-api/src/fhir/r4/elements/identifier.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ class ASIDIdentifier(Identifier, expected_system="https://fhir.nhs.uk/Id/nhsSpin
3333
"""A FHIR R4 ASID Identifier."""
3434

3535

36-
class PartyKeyIdentifier(
37-
Identifier, expected_system="https://fhir.nhs.uk/Id/nhsMhsPartyKey"
38-
):
39-
"""A FHIR R4 Party Key Identifier."""
40-
41-
4236
class AgnosticDeviceIdentifier(Identifier, expected_system="__unknown__"):
4337
"""TODO [GPCAPIM-358]: define system once JWT Device details are understood."""
4438

gateway-api/src/fhir/r4/resources/device.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from ..elements.identifier import (
88
AgnosticDeviceIdentifier,
99
ASIDIdentifier,
10-
PartyKeyIdentifier,
1110
)
1211

1312

@@ -17,6 +16,6 @@ class Device(Resource, resource_type="Device"):
1716
model_config = ConfigDict(extra="allow")
1817

1918
identifier: Annotated[
20-
list[ASIDIdentifier | PartyKeyIdentifier | AgnosticDeviceIdentifier],
19+
list[ASIDIdentifier | AgnosticDeviceIdentifier],
2120
Field(frozen=True, min_length=1),
2221
]

gateway-api/src/fhir/r4/resources/test_resources.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
Entry,
1313
GeneralPractitioner,
1414
OrganizationIdentifier,
15-
PartyKeyIdentifier,
1615
Patient,
1716
PatientIdentifier,
1817
Practitioner,
@@ -375,46 +374,11 @@ def test_create_with_asid_identifier(self) -> None:
375374
"identifier value should match"
376375
)
377376

378-
def test_create_with_party_key_identifier(self) -> None:
379-
device = Device.create(
380-
identifier=[
381-
PartyKeyIdentifier(
382-
system="https://fhir.nhs.uk/Id/nhsMhsPartyKey",
383-
value="P12345-000001",
384-
)
385-
],
386-
)
387-
388-
assert device.identifier[0].system == "https://fhir.nhs.uk/Id/nhsMhsPartyKey", (
389-
"system should match the party key URI"
390-
)
391-
392-
def test_create_with_mixed_identifiers(self) -> None:
393-
device = Device.create(
394-
identifier=[
395-
ASIDIdentifier(
396-
system="https://fhir.nhs.uk/Id/nhsSpineASID",
397-
value="123",
398-
),
399-
PartyKeyIdentifier(
400-
system="https://fhir.nhs.uk/Id/nhsMhsPartyKey",
401-
value="PK-1",
402-
),
403-
],
404-
)
405-
406-
assert len(device.identifier) == 2, "should have two identifiers"
407-
408377
def test_asid_identifier_expected_system(self) -> None:
409378
assert ASIDIdentifier._expected_system == (
410379
"https://fhir.nhs.uk/Id/nhsSpineASID"
411380
), "_expected_system should be the ASID URI"
412381

413-
def test_party_key_identifier_expected_system(self) -> None:
414-
assert PartyKeyIdentifier._expected_system == (
415-
"https://fhir.nhs.uk/Id/nhsMhsPartyKey"
416-
), "_expected_system should be the party key URI"
417-
418382

419383
class TestDeviceModelValidate:
420384
def test_valid_device(self) -> None:

0 commit comments

Comments
 (0)