Skip to content

feat(security): add System Use Notification gate for FedRAMP AC-8 (WCH-AC8-001) - #324

Open
smohite-nice wants to merge 10 commits into
mainfrom
fedramp/CSA-97598/WCH-AC8-001/systemUseNotification
Open

feat(security): add System Use Notification gate for FedRAMP AC-8 (WCH-AC8-001)#324
smohite-nice wants to merge 10 commits into
mainfrom
fedramp/CSA-97598/WCH-AC8-001/systemUseNotification

Conversation

@smohite-nice

@smohite-nice smohite-nice commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Implements the AC-8 System Use Notification as a separate feature from the existing privacyNotice, satisfying FedRAMP Moderate control AC-8.

Jira: CSA-97598
Confluence: WCH-AC8-001
Platform PR: cognigy-ai-app #66423 — adds FEATURE_SYSTEM_USE_NOTIFICATION_ENABLED Helm flag to serviceEndpoint

Key design decisions

Separate from privacyNotice — these serve different purposes and must not be merged:

privacyNotice (existing) systemUseNotification (new)
Purpose GDPR / data consent US Gov security warning (AC-8)
Who needs it All customers (EU, Asia, etc.) Regulated deployments only
Persistence Per userId (once per user lifetime) Per sessionId (prior to every user session)
Default enabled: false enabled: false — auto-enabled via FEATURE_SYSTEM_USE_NOTIFICATION_ENABLED platform flag

Per-session display — shown before every new conversation (sessionId changes), not every page refresh. Resets on SWITCH_SESSION and re-checks storage for the new session.

No silent bypassdisableLocalStorage: true returns false (show notice), not true (skip).

Changes

  • webchat-config.tssystemUseNotification? config section added
  • config-reducer.ts — defaults with AC-8 placeholder text (pending compliance approval)
  • privacyPolicy.tshasAcceptedSunInStorage / setHasAcceptedSunInStorage keyed by sessionId
  • ui-reducer.tshasAcceptedSystemUseNotification state + action; resets on SWITCH_SESSION
  • ui-middleware.ts — persists SUN acceptance by sessionId; re-checks storage after SWITCH_SESSION
  • SystemUseNotification.tsx — new component (reuses PrivacyNotice UI)
  • WebchatUI.tsx — SUN gate shown before PrivacyNotice; all send gates updated
  • Webchat.tsx — restores SUN acceptance on mount from sessionId
  • ConnectedWebchatUI.tsx — wires new state + action
  • systemUseNotification.cy.ts — E2E test suite (11 tests: rendering, accept flow, per-session gating, ordering, WCAG 2.2 AA)

Still needed before production

  • Legal/Compliance approves final AC-8 banner text (replace placeholder in config-reducer.ts)
  • Platform team merges cognigy-ai-app #66423 so FEATURE_SYSTEM_USE_NOTIFICATION_ENABLED=true auto-activates the notice

Success criteria

  • Notice shown before every new conversation session (keyed by sessionId)
  • Notice NOT shown on page refresh within the same session
  • Notice shown again after switchSession (new conversation)
  • Socket does not connect before the user accepts the notice
  • Non-regulated customers (EU/Asia) are unaffected — privacyNotice behaviour unchanged
  • disableLocalStorage: true does not bypass the notice

Security

  • No security implications

Accessibility (WCAG 2.2 AA)

  • npm run lint:a11y passes
  • Added cy.checkA11yCompliance() for the new SUN surface (systemUseNotification.cy.ts)
  • Keyboard-only operable; focus visible and managed
  • All interactive elements have an accessible name

Documentation Considerations

AC-8 banner text in config-reducer.ts is a placeholder pending Legal/Compliance approval.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 7, 2026 07:24
@snyk-io

snyk-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a FedRAMP AC-8 “System Use Notification” (SUN) gate in Webchat v3 by adding a new configurable notice screen and persisting per-session acceptance in browser storage, integrating it into the existing “privacy notice” gating flow.

Changes:

  • Adds systemUseNotification settings to the config schema and default config state.
  • Introduces a new SystemUseNotification presentational screen and renders it before the privacy notice in WebchatUI.
  • Stores/restores SUN acceptance via Redux UI state + browser storage, wired through UI middleware.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/webchat/store/ui/ui-reducer.ts Adds SUN acceptance state + action.
src/webchat/store/ui/ui-middleware.ts Persists SUN acceptance to browser storage.
src/webchat/store/config/config-reducer.ts Adds default systemUseNotification config block.
src/webchat/helper/privacyPolicy.ts Adds storage helpers for per-session SUN acceptance.
src/webchat/components/Webchat.tsx Restores SUN acceptance from storage on mount.
src/webchat/components/ConnectedWebchatUI.tsx Plumbs SUN acceptance state/dispatch into WebchatUI props.
src/webchat-ui/components/WebchatUI.tsx Gates chat start/send behind SUN (before privacy notice) and renders the new screen.
src/webchat-ui/components/presentational/SystemUseNotification.tsx New SUN screen component.
src/common/interfaces/webchat-config.ts Extends IWebchatSettings with systemUseNotification.
Suppressed comments (2)

src/webchat-ui/components/WebchatUI.tsx:1726

  • The implementation treats hasAcceptedSystemUseNotification as a global boolean, but sessions can change at runtime via SWITCH_SESSION (new conversation / previous conversations). Once set to true, the notice will stay bypassed even after switching to a new sessionId, which contradicts the intended per-session gating.
			// System Use Notification (AC-8 / FedRAMP) is shown BEFORE the privacy notice.
			// It is gated per session: a new conversation (new sessionId) requires re-acceptance.
			if (sun?.enabled && !hasAcceptedSystemUseNotification)

src/webchat-ui/components/presentational/SystemUseNotification.tsx:67

  • External links rendered from markdown open a new tab (target="_blank") but use rel="noreferrer" only. Use rel="noopener noreferrer" to prevent reverse-tabnabbing and to align with existing Cypress expectations for external links.
							a: ({ node, ...props }) => (
								// eslint-disable-next-line jsx-a11y/anchor-has-content
								<a {...props} target="_blank" rel="noreferrer" />
							),

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/webchat-ui/components/WebchatUI.tsx
Comment thread src/webchat/store/ui/ui-reducer.ts Outdated
Comment thread src/webchat-ui/components/presentational/SystemUseNotification.tsx
Comment thread src/webchat/components/Webchat.tsx
Comment thread src/webchat-ui/components/WebchatUI.tsx
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
@smohite-nice
smohite-nice force-pushed the fedramp/CSA-97598/WCH-AC8-001/systemUseNotification branch from 3690e5a to c58c8e8 Compare September 7, 2026 09:23
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
smohite-nice and others added 5 commits September 11, 2026 11:37
…H-AC8-001)

Implements the AC-8 System Use Notification as a separate feature from
the existing privacyNotice, satisfying FedRAMP Moderate control AC-8.

Design decisions:
- Separate config section (systemUseNotification) — not merged with
  privacyNotice. These serve different purposes (AC-8 vs GDPR), apply
  to different customer segments (FedRAMP vs all), and have different
  persistence semantics.
- Per-session acceptance keyed by sessionId (not userId): every new
  conversation session requires re-acceptance, matching the AC-8
  requirement of prior-to-every-user-session display.
- Non-FedRAMP customers unaffected: systemUseNotification.enabled
  defaults to false; existing privacyNotice behaviour unchanged.
- disableLocalStorage bypass fixed: returns false (show notice) rather
  than true (skip notice) when no storage is available.

Changes:
- webchat-config.ts: systemUseNotification? config section added
- config-reducer.ts: defaults with AC-8 placeholder text
- privacyPolicy.ts: hasAcceptedSunInStorage / setHasAcceptedSunInStorage
  keyed by sessionId; no-storage returns false (not true)
- ui-reducer.ts: hasAcceptedSystemUseNotification state + action
- ui-middleware.ts: persist SUN acceptance by sessionId on accept
- SystemUseNotification.tsx: new component (reuses PrivacyNotice UI)
- WebchatUI.tsx: SUN gate shown BEFORE privacyNotice; header title aware
- Webchat.tsx: restore SUN acceptance on mount from sessionId
- ConnectedWebchatUI.tsx: wire new state/action

Jira: CSA-97598
Confluence: https://cognigy.atlassian.net/wiki/spaces/Engineering/pages/2753232912

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…CH-AC8-001)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ute (WCH-AC8-001)

Address two Copilot review comments:

1. hasAcceptedSystemUseNotification was never reset when the user started
   a new conversation (SWITCH_SESSION). The boolean stayed true, bypassing
   the per-session gate even for a different sessionId.
   Fix: ui-reducer resets hasAcceptedSystemUseNotification=false on
   SWITCH_SESSION. ui-middleware then re-checks storage for the new
   sessionId — if already accepted (e.g. returning to an existing
   conversation), the flag is immediately restored; otherwise the notice
   shows for the new session.

2. SystemUseNotification rendered external links with rel="noreferrer"
   only. Added rel="noopener noreferrer" to prevent reverse-tabnabbing,
   aligning with PrivacyNotice.tsx.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…(WCH-AC8-001)

1. ui-reducer.ts: add SetHasAcceptedSystemUseNotificationAction and
   SwitchSessionAction to UIAction union — fixes broken reducer typing
   (missing types caused dispatch/type errors).

2. SystemUseNotification.tsx: replace fixed 303px AcceptButton width with
   width:100% + maxWidth:303 to prevent horizontal overflow on small
   viewports (WCAG 1.4.10 Reflow at 320px CSS px).

3. Webchat.tsx: always dispatch setInitialSessionId from the socket
   client's actual sessionId (not just when provided via initWebchat
   options) so that state.options.sessionId matches the sessionId used
   for SUN storage checks, eliminating the mismatch that prevented
   acceptance from being correctly restored on page reload.

4. WebchatUI.tsx: handleAcceptSystemUseNotification now uses currentSession
   (synced from socket client) instead of options.sessionId, and calls
   onShowChatScreen() after acceptance when the privacy notice gate is not
   active — ensuring storedMessages are flushed via connection-middleware.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…H-AC8-001)

Covers all Copilot comment 5 requirements:
- Rendering: enabled/disabled, title/text/button customisation
- Accept flow: notice dismissed, chat history visible, blocks before accept
- Per-session gating: no re-appearance within same session after accept
- Ordering: SUN shown before PrivacyNotice when both enabled
- WCAG 2.2 AA: cy.checkA11yCompliance on SUN surface and post-accept chat

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
smohite-nice and others added 5 commits September 11, 2026 11:37
…ion.cy.ts

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…C8-001)

- systemUseNotification.cy.ts: fix wrong 5-tab indentation inside the
  disabled-config object (content was at same level as the opening key)
- WebchatUI.tsx: inline the privacyGateActive variable into the if-condition
  to avoid a multi-line assignment that Prettier merges

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…AC8-001)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…t (WCH-AC8-001)

The SUN gate only triggers when the user attempts to start a conversation.
Without cy.startConversation() the SUN screen never renders and the test
timed out looking for .webchat-system-use-notification-root.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…-8 text (WCH-AC8-001)

Replace placeholder text with the InfoSec-approved AC-8 mandatory language:
"You are accessing a U.S. Government information system. Information system
usage may be monitored, recorded, and subject to audit. Unauthorized use of
the information system is prohibited and subject to criminal and civil
penalties. Use of the information system indicates consent to monitoring
and recording."

Jira: CSA-97598

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants