JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
CodeSonar's annotation import/export functionality enables users to copy user-editable warning fields (Priority, State, Finding, Owner, and Notes) between corresponding warnings on different hubs.
Important Note: the CodeSonar Web GUI makes extensive use of JavaScript. Make sure JavaScript is enabled in your web browser.
| warning
annotation (or simply annotation) |
refers to the setting of one or more of a warning group's user-modifiable fields: Priority, State, Finding, Owner, Notes. | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| an annotation tuple |
is a tuple
(project, fingerprint, comment_index, comment_text,
created)
that captures all annotations on a single warning group.
|
||||||||||
| a nontrivial annotation tuple | is an annotation tuple that reflects at least one modification to Priority, State, Finding, Owner, or Notes. |
The annotation files imported and exported by CodeSonar contain sets of annotation tuples in CSV (comma-separated value) format compliant with RFC 4180.
Use cases for CodeSonar's annotation import/export functionality include the following.
On a regular basis (say, weekly):
User annotations are typically the most valuable information on a hub: in some cases you may prefer to export annotations instead of carrying out the full backup operation.
CodeSonar 6.1 introduced UTF8 encoding for all hub annotations. Hubs with ASCII-only annotations will have their annotations automatically transcoded to UTF8 as part of the upgrade from (or past) CodeSonar 6.0. For hubs whose annotations used other encodings, use the Updating Hub Annotation Encoding process described below to ensure that all annotations are correctly transcoded to UTF8.
[Jump to How to Export Annotations]
Exporting annotations for a set of warning groups entails writing the corresponding set of nontrivial annotation tuples to a file.
Warning annotations can be exported from several GUI page types, as described in the following table.
| GUI Page | Export link location | Annotation tuples exported |
|---|---|---|
| Analysis: Warnings tab | Below the warning table. | All nontrivial annotation tuples for all warning groups represented by one or more instances in the table of warnings. Note that the table contents, and therefore the exported tuples, depend on the Visible Warnings setting. |
| Warning Cluster | Below the warning table. | All nontrivial annotation tuples for all warning groups represented by one or more instances in the table of warnings. |
| Warning Search Results | Below the table of search results. | All nontrivial annotation tuples for all warning groups represented by one or more instances in the result table. Note that the table contents, and therefore the exported tuples, depend on the Visible Warnings setting as well as the executed search. |
| Project | Below the table of project analyses. |
All nontrivial annotation tuples for all warning groups for
which the project has an extant warning instance.
|
| Home | Below the table of projects. | All nontrivial annotation tuples for all global-scoped and project-scoped warning groups on the hub (including those for which no warning instances currently exist). |
[Jump to How to Import Annotations]
Importing annotations for a set of warning groups entails reading the corresponding set of annotation tuples from a file and merging those annotations with a hub's existing annotations.
The availability of annotation import functionality depends on the hub's current setting for warning group sharing, as described in the following table.
| Sharing | Import functionality | Import link location | Behavior |
|---|---|---|---|
| ON | Home page only. | Below the table of projects. |
For every tuple
T=(P,F,I,C,t) in the file:
|
| OFF | Project pages only. | Below the table of analyses. |
When importing on the Project page associated with project
Q:
For every tuple T=(P,F,I,C,t) in the file:
|
Given a tuple T=(P,F,I,C,t), we define a new [X-scoped] warning group matching T as a new warning group with:
If X is not specified, the scope of the new warning group corresponds to P: if P=="" then the group has global scope, otherwise the group has project scope and is associated with project P.
Note that a new warning group based on some imported tuple will initially have no instances.
New tuples will only created during annotation import if the user performing the import has G_ANNOTATION_IMPORT permission.
When an imported tuple T=(P,F,I,C,t) corresponds to a warning group G that already exists on the target hub, the annotations described in T must be merged with any existing annotations on G.
For a particular property described in T, we say that T has precedence over G for this property if:
Merging is carried out as follows.
| Notes |
Add the Notes described
in T to the existing Notes on
G, interleaved by timestamp.
|
|---|---|
| Owner |
Set the Owner for
G as follows. Let O be the Owner value specified
by C.
|
| Priority, State, Finding |
Set the Priority,
for G as follows. State and Finding are analogous.
Note: If T describes a Priority (State, Finding) change that
Then the merge of Priority, State, and Finding for T is handled as follows.
|
| First Detected | If the First Detected value for G is later than t, change it to t. |
| Change History | All change history events associated with this import operation are marked with an "Imported by..." statement that specifies the user who performed the import operation, the date, and the time. |
In some situations the annotations on group G and the annotations encoded by tuple T may reflect some shared history. This can be due to
In this case, a warning group is considered to have "undergone one or more Priority changes" if its Priority has changed since the most recent shared Priority change. (State, Finding, and Owner are analogous).
In some circumstances, new hub user accounts will be created during annotation merging.
Properties for these new accounts are initialized as follows.
| Property | Description |
|---|---|
| Default Role | As for the default template user. |
| NULL | |
| Email Alerts? | As for the default template user. |
| Password | NULL |
| Roles | The same as the Roles set for the default template user, except that the new user account does not have the Enabled role. |
| Username | The name of the new Owner in the tuple that triggered account creation. |
| Visibility
Defaults |
As for the default template user. |
Note also that the user performing the annotation import must have G_ANNOTATION_IMPORT or G_CREATE_USER permission for new accounts to be created during import. Otherwise, Owner changes that do not correspond to an existing hub user account will be marked with "Property Conflict: Discarded".
| path/to/exp_anns.csv | is your existing file of exported annotations. |
| path/to/transcoding_output.csv | is the output file produced by changing the
encoding of path/to/exp_anns.csv. This is the file you will import into your hub. |
| [encoding] |
specifies the encoding of the exported
annotations: one of (case insensitive)
ASCII,
Big5,
EUC-JP,
EUC-KR,
EUC-TW,
HZ-GB-2312, GB2312/GB18030,
IBM855,
IBM866,
ISO-2022-CN,
ISO-2022-JP,
ISO-2022-KR,
ISO-8859-1,
ISO-8859-2,
ISO-8859-5,
ISO-8859-5,
ISO-8859-7,
ISO-8859-8,
KOI8-R,
MacCyrillic,
SHIFT_JIS,
TIS-620,
UTF-16,
UTF-32,
UTF-8,
and
windows-1251, windows-1250, windows-1251, windows-1252, windows-1253, windows-1255.
If not specified, transcode_annotations.py will attempt to deduce the encoding and prompt you for confirmation. |
Hubs undergo ASCII→UTF8 annotation transcoding as part of the upgrade from CodeSonar 6.0 (or earlier) to a later version. If some or all of the annotations on your hub previously used non-ASCII encodings, perform the following steps to ensure all existing annotations are correctly encoded. You will need G_ANNOTATION_IMPORT and G_ANNOTATION_EXPORT permissions.
If you have already performed these steps for your hub, you do not need to perform them again.
The export process depends on the warning group sharing setting for your hub.
For each project in turn:
If warning group sharing is OFF for your hub, and so you exported multiple annotation files in the previous step, convert each file separately. For example, if the project named ProjectX has ISO-8859-7-encoded annotations and you saved its exported annotation file as annotations_ProjectX.csv:
The Import process depends on the warning group sharing setting for your hub.
For each project in turn, do the following.
The following diagram illustrates a typical use case. Project P has two development branches: branch PA is developed by team A and analyzed on hub A, branch PB is developed by team B and analyzed on hub B. Exporting annotations between the two hubs once a week allows the teams to avoid duplicating effort in resolving shared problems.
One might reasonably ask why teams A and B need separate hubs at all. In fact, they don't. If the two teams now decide that they wish to share hub A, only two steps remain:
CodeSonar permissions apply to annotation import and export as follows.
| Operation | Permissions required | Notes |
|---|---|---|
| Annotation Import | G_ANNOTATION_IMPORT |
Users with G_ANNOTATION_IMPORT permission can
always import annotations. This permission is also sufficient
to create any warning
groups that are present in the imported annotation set but
not on the hub.
|
| otherwise |
For users without G_ANNOTATION_IMPORT:
These constraints mean that some or all of the tuples in the imported set may be ignored. |
|
| Annotation Export | G_ANNOTATION_EXPORT | Users with G_ANNOTATION_EXPORT permission can export annotations at all scopes. Note that this permission allows a user to export annotations for all warnings on the hub, even if the user does not otherwise have access to the analyses that issued some or all of those warnings. |
| otherwise | Users without G_ANNOTATION_EXPORT can export annotations from analyses for which they have ANALYSIS_WARNING_EXISTS permission. |
To report problems with this documentation, please visit https://support.codesecure.com/.