Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds parameter for security classification #451

Merged
merged 7 commits into from
May 24, 2024
Merged

Conversation

wpfl-dbt
Copy link
Collaborator

@wpfl-dbt wpfl-dbt commented May 23, 2024

Context

REDBOX-294. Just as we allow many different LLMs to be used, different departments will permit different levels of security assurance on documents staff are permitted to use with Redbox. This ticket is to add an environment variable to allow the frontend to make changes based on an app-wide setting.

Changes proposed in this pull request

  • Add MAX_SECURITY_CLASSIFICATION
  • Add places for Django to pick it up and display it

Guidance to review

  • Checked my overall strategy with @KevinEtchells but make sure you're happy with how I pass that env around
  • In particular, I use case switch because I think an extension of this kind of work would involve quite a few different settings that result from the max security level of documents permitted

Relevant links

Things to check

  • I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • I have run integration tests

Copy link
Contributor

@brunns brunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using an enum, but it's up to you.

# Security classifications
# https://www.gov.uk/government/publications/government-security-classifications/

MAX_SECURITY_CLASSIFICATION = env.str("MAX_SECURITY_CLASSIFICATION")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make this an enum:

class Classification(enum.StrEnum):
    OFFICIAL = "Official"
    OFFICIAL_SENSITIVE = "Official Sensitive"
    ...
    
MAX_SECURITY_CLASSIFICATION = Classification[env.str("MAX_SECURITY_CLASSIFICATION")]

We'd need to use underscores rather than dashes in the names for them, of course.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - would we want a default value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine withw/without an enum. r.e. default, we want it to fall over if they haven't set it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about it and decided to use the enum.

@@ -63,6 +63,7 @@ def environment(**options):
"url": url,
"humanize_timedelta": humanize_timedelta,
"environment": settings.ENVIRONMENT,
"security": settings.MAX_SECURITY_REPR,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were to use an enum, we'd want MAX_SECURITY_CLASSIFICATION.value.

Copy link
Contributor

@brunns brunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@wpfl-dbt wpfl-dbt merged commit c51532a into main May 24, 2024
9 checks passed
@wpfl-dbt wpfl-dbt deleted the feature/sec-classification branch May 24, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants